ExamineSHA1Fingerprint()

Syntax

Result = ExamineSHA1Fingerprint(#Fingerprint)
Description
Initializes the calculation of a SHA1 (Secure Hash Algorithm 1) checksum in several steps. Unlike the SHA1Fingerprint() function this allows to calculate the checksum of large data without the need to load it all into one continuous memory buffer.

Parameters

#Fingerprint The number to refer to this checksum calculation in later calls. #PB_Any can be used to auto-generate this number.

Return value

Returns the #FingerPrint value if #PB_Any was used for that parameter.

Remarks

NextFingerprint() can be used to add memory blocks into the calculation and FinishFingerprint() to finish the calculation and read the SHA1 hash.

See SHA1Fingerprint() for more information on the SHA1 algorithm.

Example

  *Buffer = AllocateMemory(200)                  ; Prepare a buffer with data
  If *Buffer
    PokeS(*Buffer, "The quick brown fox jumps over the lazy dog.")
    Length = MemoryStringLength(*Buffer)
    
    If ExamineSHA1Fingerprint(1)                 ; start the calculation
      NextFingerprint(1, *Buffer, Length/2)          ; calculate part 1
      NextFingerprint(1, *Buffer+Length/2, Length/2) ; calculate part 2
      
      SHA1$ = FinishFingerprint(1)               ; finish calculation
      Debug "SHA1 checksum = " + SHA1$
      
      SHA1$ = SHA1Fingerprint(*Buffer, Length)   ; compare to a calculation in 1 step
      Debug "SHA1 checksum = " + SHA1$
    EndIf

    FreeMemory(*Buffer)
  EndIf

See Also

SHA1Fingerprint(), SHA1FileFingerprint(), MD5Fingerprint(), CRC32Fingerprint()

Supported OS

All

<- ExamineMD5Fingerprint() - Cipher Index - FinishCipher() ->