Skip to content
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

SM3 hash is incorrect for inputs of a certain size #1

Open
dewyatt opened this issue Apr 2, 2017 · 1 comment
Open

SM3 hash is incorrect for inputs of a certain size #1

dewyatt opened this issue Apr 2, 2017 · 1 comment
Assignees
Labels

Comments

@dewyatt
Copy link

dewyatt commented Apr 2, 2017

Example

Input:
ff27186ddc9b5f29a9c928583472f113c860b4781b24ea63852f211e48829fb7f93c8540e79aa3487f9789ddb0348e1a9090838f44d77fe7
Output:
F46E545D5B0D71AA45AC1790DFAD39DECE6AF7C22F966A361A35FEFAB5371E74

Info

I have tested 3 other implementations and, given the above input, they produce:
D649A9CF8544E0B7FD8DB124C1E85CBD934D66D6660F8EC6F45D571B5146597A

It seems that all inputs of lengths between 56-63 bytes consistently produce a hash that does not match up with other implementations, so I suspect this implementation has a bug.

The other implementations I tested were:

@Xiangsong-Guan
Copy link
Owner

sorry for the late reply.

I have already confirmed that this is an implementation mistake in padding process. Due to this implementation mistake, the output will not be correct when the input length is from (64-8) to 63 bytes.

When I have time, I will fix this mistake.

@Xiangsong-Guan Xiangsong-Guan self-assigned this Dec 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants