SHA1Fingerprint()
Syntax
Result$ = SHA1Fingerprint(*Buffer, Size)Description
Returns a 40 characters long SHA1 (Secure Hash Algorithm 1) hash code of the given memory buffer. 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.
SHA1FileFingerprint() can be used to calculate the SHA1 checksum of a file.
ExamineSHA1Fingerprint() can be used to calculate a SHA1 checksum in multiple steps.
Example 1 (a string as memory buffer):test.s = "This is a test string!" Debug SHA1Fingerprint(@test, StringByteLength(test))Example 2 (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
Supported OS
All