Skip to content

lotus-king/SM3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

An Implementation of SM3 by Golang

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.

Official Documents of SM3

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'.

Refrenced Projects

  1. https://github.com/guanzhi/GmSSL/tree/master/crypto/sm3
  2. https://github.com/yixiangzhike/AlgorithmSM/blob/master/sm/SM3.py
  3. https://github.com/JamisHoo/Cryptographic-Algorithms/blob/master/src/sm3.cc

About

Implementing SM3(crypt algorithm) by Go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages