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. See SHA1Fingerprint() for more information on the SHA1 algorithm.

The '#Fingerprint' value will be used in later calls to refer to this checksum calculation. If #PB_Any is used as '#Fingerprint' parameter, the value returned as a result will be used to identify the calculation.

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

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

Supported OS

All

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