Golang Hash MD4

//Go标准包中只有MD5的实现
//还好,github上有MD4实现。

package main

import (
    "golang.org/x/crypto/md4"
    "encoding/hex"
    "fmt"
)

func get_md4(buf []byte) ([] byte) {
	ctx := md4.New()
	ctx.Write(buf)
	return ctx.Sum(nil)
}


func main() {

	s1 := "Hello, MD4 test text"
	hash := get_md4([]byte(s1))

	out := hex.EncodeToString(hash)

	fmt.Println(out)

}


你可能感兴趣的:(Golang Hash MD4)