【发布时间】:2022-01-25 20:36:38
【问题描述】:
所以我在 Go 中遇到了以下代码,试图解释 md5 哈希是如何工作的。
package main
import (
"crypto/md5"
"fmt"
)
func HashFunc(word string) {
hash := md5.New()
bytes := []byte(word)
hash.Write(bytes)
hashValue := hash.Sum(nil)
hashSize := hash.Size()
for n := 0; n < hashSize; n += 4 {
var val = uint32(hashValue[n])<<24 +
uint32(hashValue[n+1])<<16 +
uint32(hashValue[n+2])<<8 +
uint32(hashValue[n+3])
fmt.Printf("%x ", val)
}
fmt.Println()
}
我只是想知道如何对上述函数加密的任何数据进行解密。
【问题讨论】:
标签: go encryption md5