-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KMACXOF(128/256) examples are not working with this implementation in PHP ( base on NIST docs) #1
Comments
Under Kali WSL php 8.1 using your code $ php shahash.php KMACXOF256 -H 404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F 00010203 256 $ php shahash.php KMACXOF128 -H 404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F 00010203 256 The rest of NIST samples are right too. |
Hello Denobisipsis,
I was checking an implementation that I am building and I did use your code ( 1000 thanks for it) super easy to understand since it is PHP.
I did use this Doc from NIST:
https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Standards-and-Guidelines/documents/examples/KMACXOF_samples.pdf
from tests, I did run the KMACs from "Sample 1 to 6" and none of them aim the correct results :-( I am almost sure that is me and not your code, if if you can spare some time to explain what I am doing wrong ie I use "Sample #1" in the document:
Calling KMAC KMACXOF128 ...
.. arg1 = [-H]
.. arg2 = [404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F]
.. arg3 = [00010203]
.. arg4 = [256]
.. arg5 = []
[
1c 7f 9b f1 c3 35 c9 7d fa 48 fb a5 00 27 05 92
30 f1 ba 42 ae 74 9a d5 34 2f 96 5d d4 d7 3d 0c
-> len(32)
]
Base on the NIST test Doc the output of "Sample #1" should be:
Outval is
CD 83 74 0B BD 92 CC C8 CF 03 2B 14 81 A0 F4 46
0E 7C A9 DD 12 B0 8A 0C 40 31 17 8B AC D6 EC 35
I did add a little bit of code at the end of your code just to print the arguments in HEX alike the NIST document:
What call that I be using in your code to KMACXOF128 ? ... I did also try the KMACXOF256 ( with the "Sample #5" on the NIST-DOC and it didn't match either)
Or I am using an old NIST-DOC and there is something new(with CVE fixes etc ) that I should be considering.
Please let me know your thoughts /comments etc.
Best Regards,
EM
The text was updated successfully, but these errors were encountered: