ver 4.60 RC1
windows 64bit (but others also?)
on help page for sha1fingerprint()
[string variable as buffer example works fine!]
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
will return a incorrect sha1 digest unless input string is exactly 500 bytes in length.
this is due to it using the buffer length not the data length.
code returns sha: ab57c34511256b11e101d3b1d17abfb80de95828SHA1
correct is: 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12
see http://en.wikipedia.org/wiki/SHA-1 for the above example.
bug in example sha1fingerprint()
Re: bug in example sha1fingerprint()
As the code is there, it works properly.
In the example is the fingerprint of the entire buffer can be calculated, not only of the string!
so, no bug!
In the example is the fingerprint of the entire buffer can be calculated, not only of the string!
so, no bug!
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module