mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd: use 20 bytes hash when possible
CL 402595 changes all usages of 20 bytes hash to 32 bytes hash by using notsha256. However, since CL 454836, notsha256 is not necessary anymore, so this CL reverts those changes to 20 bytes hash using cmd/internal/hash package. Updates #51940 Updates #64751 Change-Id: Icb08d5a0d8032a3c4d050ff7b2298d31c483b88b Reviewed-on: https://go-review.googlesource.com/c/go/+/610597 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
4fd73e5d4c
commit
f033bc1819
4 changed files with 6 additions and 6 deletions
|
|
@ -1012,7 +1012,7 @@ func typeSymbolMangle(name string) string {
|
|||
return name
|
||||
}
|
||||
if isType {
|
||||
hb := hash.Sum32([]byte(name[5:]))
|
||||
hb := hash.Sum20([]byte(name[5:]))
|
||||
prefix := "type:"
|
||||
if name[5] == '.' {
|
||||
prefix = "type:."
|
||||
|
|
@ -1025,7 +1025,7 @@ func typeSymbolMangle(name string) string {
|
|||
if j == -1 || j <= i {
|
||||
j = len(name)
|
||||
}
|
||||
hb := hash.Sum32([]byte(name[i+1 : j]))
|
||||
hb := hash.Sum20([]byte(name[i+1 : j]))
|
||||
return name[:i+1] + base64.StdEncoding.EncodeToString(hb[:6]) + name[j:]
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue