md5.go 180 B

12345678910111213141516
  1. package hash
  2. import (
  3. "crypto/md5"
  4. )
  5. func MD5(bs []byte) (hs []byte, err error) {
  6. h := md5.New()
  7. _, err = h.Write(bs)
  8. if err != nil {
  9. return
  10. }
  11. hs = h.Sum(nil)
  12. return
  13. }