SM3 hash algorithm

Sm3 is China’s domestic hash algorithm, is a cryptographic hash function standard, released by the National Cryptography Administration and December 17, 2010, the algorithm is mainly used for digital signature and verification, message authentication code generation and verification, random number generation, etc., the algorithm is open, its efficiency is similar to SHA256.

Go language application

package main

import (
	"fmt"
	"github.com/tjfoc/gmsm/sm3"
)

func main(a){
	src := []byte("Sm3 is our homegrown hash algorithm.")
	hash := sm3.New()
	hash.Write(src)
	hashed := hash.Sum(nil)
	fmt.Printf("Hash result: %x", hashed)
}
Copy the code

Running results:

Hash result is: the 3 b366d29964b5543be7aa7cc064f9eeef9481baaa656c8bd3a88b431a8fb6f6cCopy the code