cmd/internal/gc: use crypto/md5 instead of md5.go
Note: for simplicity, this CL changes the identifiers assigned to
gclocals.* objects; e.g., on amd64, gclocals.ABCDEFGHIJKLMNOP is now
gclocals.HGFEDCBAPONMLKJI. However, since Go requires all packages to
be built with the same toolchain version anyway, this should be a
non-issue.
Similarly, type hashes change somewhat, but don't seem to be exposed
to users in any detectable manner.
Change-Id: Iadb3bce472af9b022b88d52b3c4c5e4113cda330
Reviewed-on: https://go-review.googlesource.com/6232
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
diff --git a/src/cmd/internal/gc/subr.go b/src/cmd/internal/gc/subr.go
index 9eeb5d9..a6e9bf3 100644
--- a/src/cmd/internal/gc/subr.go
+++ b/src/cmd/internal/gc/subr.go
@@ -7,6 +7,8 @@
import (
"bytes"
"cmd/internal/obj"
+ "crypto/md5"
+ "encoding/binary"
"fmt"
"os"
"sort"
@@ -1587,12 +1589,8 @@
}
//print("typehash: %s\n", p);
- var d MD5
- md5reset(&d)
-
- md5write(&d, []byte(p), len(p))
-
- return uint32(md5sum(&d, nil))
+ h := md5.Sum([]byte(p))
+ return binary.LittleEndian.Uint32(h[:4])
}
func Ptrto(t *Type) *Type {