Constants

  1. const BlockSize = 64
  2. const Size = 16

func Sum(data []byte) [Size]byte 返回数据data的MD5校验和

  1. data := []byte("These pretzels are making me thirsty.")
  2. fmt.Printf("%x", md5.Sum(data))
  3. b0804ec967f48520697662a204f5fe72

func New() hash.Hash 返回一个新的使用MD5校验的hash.Hash接口

  1. h := md5.New()
  2. io.WriteString(h, "The fog is getting thicker!")
  3. io.WriteString(h, "And Leon's getting laaarger!")
  4. fmt.Printf("%x", h.Sum(nil))
  5. e2c569be17396eca2a2e3c11578123ed