It would be very nice to have the posiblity to do a CRC32 fingerprint directly on files (even on very big files instead reading the big files into memory)
In this case i would like to have an advanced version for such commands to define the start- and endpostion of a file. What dd you think about this?
CRC32FileFingerprint(filename$, [startpos, endpos])
MD5FileFingerprint(Filename$, [startpos, endpos])
[Implemented] More flexible cipher lib commands please
[Implemented] More flexible cipher lib commands please
va!n aka Thorsten
Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
i second the request and an initial parameter would be also very usefull. as far as i can remember, fred said 4 years ago that he will implement this "soon".
c ya,
nco2k

Code: Select all
CRC32Fingerprint(Buffer, Length, Initial)
MD5Fingerprint(Buffer, Length, Initial)
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
i mean initial like in this code by horst:
so we could use the last crc32 chunk as starting value for the next chunk and so on.
c ya,
nco2k
Code: Select all
; ---------------------------------------------------------------
; CRC32 Calculation - supports handling file by chunks
; Note: The CRC table is initialized at startup
; by Horst Schaeffer - horst.schaeffer@gmx.net
; ---------------------------------------------------------------
; Note: CRC of a file can be computed ..
; (1) by reading the complete file into a memory buffer
; Parameters: *Memory,Size,0 (initial CRC = 0)
; (2) by reading portions of the file: the CRC of the previous
; portion is always used as starting value for the next
; portion; initial CRC = 0
; ---------------------------------------------------------------
; initialize
*CRCtable = AllocateMemory(1024)
*CRCpoint.long = *CRCtable
For index = 0 To 255
Value = index
For i = 1 To 8
LSB = Value & 1
Value >> 1 & $7FFFFFFF
If LSB : Value ! $EDB88320 : EndIf
Next
*CRCpoint\l = Value : *CRCpoint + 4
Next
; Compute CRC32 for data area given by *Memory pointer and Size,
; and InitialCRC from last chunk (first time: 0)
; returns (new) CRC
Procedure CRC32compute(*Memory.byte,Size,InitialCRC)
Shared *CRCtable
Protected CRC.l, *CRCpoint.long
CRC = ~InitialCRC
While Size
Value = ((CRC ! *Memory\b) & $FF) << 2
CRC >> 8 & $00FFFFFF
*CRCpoint = *CRCtable + Value
CRC ! *CRCpoint\l
*Memory +1 : Size -1
Wend
ProcedureReturn ~CRC
EndProcedure
c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf