Result = StartFingerprint(#Fingerprint, Plugin [, Bits])Description
Initializes the calculation of a fingerprint in several steps. Unlike Fingerprint() function this allows to calculate the fingerprint of large data without the need to load it all into one continuous memory buffer.
#Fingerprint The number to refer to this checksum calculation in later calls. #PB_Any can be used to auto-generate this number. Plugin The plugin to use. It can be one of the following value:#PB_Cipher_CRC32: uses CRC32 algorithm. UseCRC32Fingerprint() needs to be called before to register this plugin. #PB_Cipher_MD5 : uses MD5 algorithm. UseMD5Fingerprint() needs to be called before to register this plugin. #PB_Cipher_SHA1 : uses SHA1 algorithm. UseSHA1Fingerprint() needs to be called before to register this plugin. #PB_Cipher_SHA2 : uses SHA2 algorithm. UseSHA2Fingerprint() needs to be called before to register this plugin. #PB_Cipher_SHA3 : uses SHA3 algorithm. UseSHA3Fingerprint() needs to be called before to register this plugin. Bits (optional) The bits number to use for the fingerprint. It is only supported for the following plugin:#PB_Cipher_SHA2 : can be 224, 256 (default), 384 or 512. #PB_Cipher_SHA3 : can be 224, 256 (default), 384 or 512.
Returns the #Fingerprint value if #PB_Any was used for that parameter.
AddFingerprintBuffer() can be used to add memory blocks into the calculation and FinishFingerprint() to finish the calculation and read the resulting hash.
UseMD5Fingerprint() *Buffer = AllocateMemory(200) ; Prepare a buffer with data If *Buffer PokeS(*Buffer, "The quick brown fox jumps over the lazy dog.", -1, #PB_Ascii) Length = MemoryStringLength(*Buffer, #PB_Ascii) If StartFingerprint(0, #PB_Cipher_MD5) ; start the calculation AddFingerprintBuffer(0, *Buffer, Length/2) ; calculate part 1 AddFingerprintBuffer(0, *Buffer+Length/2, Length/2) ; calculate part 2 MD5$ = FinishFingerprint(0) ; finish calculation Debug "MD5 checksum = " + MD5$ MD5$ = Fingerprint(*Buffer, Length, #PB_Cipher_MD5) ; compare to a calculation in 1 step Debug "MD5 checksum = " + MD5$ EndIf FreeMemory(*Buffer) EndIf
Fingerprint(), FileFingerprint(), StringFingerprint()