Note by Lotus-king:
I modify it so it's interface can exactly like SHA
There is no Golang implementation of SM3 in Github. So I Write it when need it. And also I have wrote some unit test for it.
BUT one thing should be noticed: The code is a little mess.
If you want to quickly handle it. You'd better read the document first.
You can download the official douments Here.
There is a MISTAKE in the it.
In page 7, The padding message of the second test case is:
61626364 61626364 61626364 61626364 61626364 61626364 61626364 61626364
61626364 61626364 61626364 61626364 61626364 61626364 61626364 61626364
80000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
80000000 00000000 00000000 00000000 00000000 00000000 00000000 00000200
But should be:
61626364 61626364 61626364 61626364 61626364 61626364 61626364 61626364
61626364 61626364 61626364 61626364 61626364 61626364 61626364 61626364
80000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000200
The difference is the first digit in the last line. It should be '0' not '8'.