SHA1Fingerprint()
Syntax
Result$ = SHA1Fingerprint(*Buffer, Size)Description
Returns a 40 characters long SHA1 (Secure Hash Algorithm 1) hash code of the given memory buffer.
Parameters
*Buffer The buffer containing the data to be hashed. Size The size of the given buffer.
Return value
Returns the hash code as a string.
Remarks
SHA1 can be used to calculate a checksum to verify that a 'message' has not been altered. Unlike CRC32 it is nearly impossible to modify the original message and still produce the same SHA1 fingerprint.
Here is a quick explanation taken from the RFC 3174 on SHA1:
'The SHA-1 is called secure because it is computationally infeasible to find a message which corresponds to a given message digest, or to find two different messages which produce the same message digest. Any change to a message in transit will, with very high probability, result in a different message digest, and the signature will fail to verify.'
More information can be found in the RFC 3174: http://www.ietf.org/rfc/rfc3174.txt.
Example: a string as memory buffer
test.s = "This is a test string!" Debug SHA1Fingerprint(@test, StringByteLength(test))
Example: with memory buffer
*Buffer = AllocateMemory(500) If *Buffer PokeS(*Buffer, "The quick brown fox jumps over the lazy dog.") SHA1$ = SHA1Fingerprint(*Buffer, MemorySize(*Buffer)) Debug "SHA1 Fingerprint = " + SHA1$ FreeMemory(*Buffer) ; would also be done automatically at the end of the program EndIf
See Also
SHA1FileFingerprint(), ExamineSHA1Fingerprint(), MD5Fingerprint(), CRC32Fingerprint()
Supported OS
All