diff options
author | Jeremy Faller <jeremy@golang.org> | 2020-09-30 17:57:14 -0400 |
---|---|---|
committer | Jeremy Faller <jeremy@golang.org> | 2020-09-30 18:00:58 -0400 |
commit | 91e4d2d57bc341dd82c98247117114c851380aef (patch) | |
tree | 15a2d023cdc63543cf8a6e99f8a561c0a0459000 /src/cmd/go/internal/work/buildid.go | |
parent | c863e14a6c15e174ac0979ddd7f9530d6a4ec9cc (diff) | |
parent | 846dce9d05f19a1f53465e62a304dea21b99f910 (diff) | |
download | go-91e4d2d57bc341dd82c98247117114c851380aef.tar.gz go-91e4d2d57bc341dd82c98247117114c851380aef.zip |
[dev.link] Merge branch 'master' into dev.link
2 conflicts, that make sense.
src/cmd/internal/obj/objfile.go
src/cmd/link/internal/loader/loader.go
Change-Id: Ib224e2d248cb568fa1e888af79dd908b2f5e05ff
Diffstat (limited to 'src/cmd/go/internal/work/buildid.go')
-rw-r--r-- | src/cmd/go/internal/work/buildid.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/cmd/go/internal/work/buildid.go b/src/cmd/go/internal/work/buildid.go index 6613b6fe3f..a3c9b1a2c1 100644 --- a/src/cmd/go/internal/work/buildid.go +++ b/src/cmd/go/internal/work/buildid.go @@ -110,15 +110,15 @@ func contentID(buildID string) string { // hashToString converts the hash h to a string to be recorded // in package archives and binaries as part of the build ID. -// We use the first 96 bits of the hash and encode it in base64, -// resulting in a 16-byte string. Because this is only used for +// We use the first 120 bits of the hash (5 chunks of 24 bits each) and encode +// it in base64, resulting in a 20-byte string. Because this is only used for // detecting the need to rebuild installed files (not for lookups -// in the object file cache), 96 bits are sufficient to drive the +// in the object file cache), 120 bits are sufficient to drive the // probability of a false "do not need to rebuild" decision to effectively zero. // We embed two different hashes in archives and four in binaries, -// so cutting to 16 bytes is a significant savings when build IDs are displayed. -// (16*4+3 = 67 bytes compared to 64*4+3 = 259 bytes for the -// more straightforward option of printing the entire h in hex). +// so cutting to 20 bytes is a significant savings when build IDs are displayed. +// (20*4+3 = 83 bytes compared to 64*4+3 = 259 bytes for the +// more straightforward option of printing the entire h in base64). func hashToString(h [cache.HashSize]byte) string { const b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_" const chunks = 5 @@ -425,7 +425,7 @@ func (b *Builder) useCache(a *Action, actionHash cache.ActionID, target string) // It's important that the overall buildID be unlikely verging on impossible // to appear in the output by chance, but that should be taken care of by // the actionID half; if it also appeared in the input that would be like an - // engineered 96-bit partial SHA256 collision. + // engineered 120-bit partial SHA256 collision. a.actionID = actionHash actionID := hashToString(actionHash) if a.json != nil { |