很抱歉标题。我无法想出更好的方法来表达我的问题,如果其他人可以的话,我会很高兴地改变它。
哈舍尔定义为
hasher := md5.New()
无论如何,我很好奇为什么会这样:
fmt.Println(hex.EncodeToString(hasher.Sum([]byte(input))))
给我 6869d41d8cd98f00b204e9800998ecf8427e,而这个:
hasher.Write([]byte(input)) fmt.Println(hex.EncodeToString(hasher.Sum(nil))
给我49f68a5c8493ec2c0bf489821c21fc3b和这个:
fmt.Printf("%x\n", md5.Sum([]byte(input)))
给我49f68a5c8493ec2c0bf489821c21fc3b。
慕桂英3389331
相关分类