[INC] SHA-256 Hash Function
1 Attachment(s)
[INC] SHA-256 Hash Function A single file include with a SHA-256 hash function. Supports UTF-8 text, hexadecimal or binary string inputs. Disclaimer While I have tested this code and it seems to work pretty well, I can't guarantee it's 100% working and bug free. If you're using this for any security purposes, you use it at your own risk. And also, you shouldn't be using SHA-256 for securing anything anyway. Example Code PHP Code:
PHP Code:
The code has been tested with the NIST's publically available tests SHA Test Vectors for Hashing Byte-Oriented Messages provided by their Cryptographic Algorithm Validation Program. The tests are provided in the repo along with the python script to generate the test plugin from the original .rsp files. No, that doesn't mean this code is officially validated. The only one test that consistently fails is the "00" (0x00) test, which is because the test is wrong. That test assumes a null string (length 0) is the same as a null byte (0x00, length 1). Other SHA-256 implementations will fail this test too (like 7-Zip's). Download sha256.inc If you find any bugs or issues let me know. |
Re: [INC] SHA-256 Hash Function
Thanks a lot, great work!
|
Re: [INC] SHA-256 Hash Function
Cool, thank you!
|
All times are GMT -4. The time now is 17:58. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.