浏览代码

crypto/hmac: Deprecate hmac.NewMD5, hmac.NewSHA1 and hmac.NewSHA256

Remove NewMD5, NewSHA1 and NewSHA256 in favor of using New and
explicitly importing the used hash-function. This way when using, for
example, HMAC with RIPEMD there's no md5, sha1 and sha256 linked in
through the hmac package.

A gofix rule is included, and applied to the standard library (3 files
altered).

This change is the result of a discussion at
https://golang.org/cl/5550043/ to pull the discussion about
deprecating these functions out of that issue.

R=golang-dev, agl
CC=golang-dev, r, rsc
https://golang.org/cl/5556058
tls13
Luit van Drongelen 12 年前
committed by Adam Langley
父节点
当前提交
0464590bc2
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. +1
    -1
      cipher_suites.go

+ 1
- 1
cipher_suites.go 查看文件

@@ -91,7 +91,7 @@ func macSHA1(version uint16, key []byte) macFunction {
copy(mac.key, key)
return mac
}
return tls10MAC{hmac.NewSHA1(key)}
return tls10MAC{hmac.New(sha1.New, key)}
}

type macFunction interface {


正在加载...
取消
保存