]> Cypherpunks repositories - gostls13.git/commit
cmd: use 128-bit SHA256 & encode in base64 for content hashes
authorRuss Cox <rsc@golang.org>
Thu, 5 May 2022 13:41:53 +0000 (09:41 -0400)
committerGopher Robot <gobot@golang.org>
Thu, 5 May 2022 14:44:31 +0000 (14:44 +0000)
commit485a572243568530721009829393ba2c0deb7bd0
tree19d1c13f5b02fd07a39c686e1eb54aa040f0d570
parent1926fa5f84b87a7a6cb9f153337424baf367937a
cmd: use 128-bit SHA256 & encode in base64 for content hashes

We used to use SHA1 for content hashes, but CL 402595 changed
all the “don't care” hashes to cmd/internal/notsha256 (negated SHA256).
This made object files a little bit bigger: fmt.a on my Mac laptop grows
from 910678 to 937612 bytes (+3%).

To remove that growth, truncate the hash we use for these purposes
to 128 bits (half a SHA256), and also use base64 instead of hex for
encoding it when a string form is needed. This brings fmt.a down to
901706 bytes (-1% from original, -4% from current).

Change-Id: Id81da1cf3ee85ed130b3cda73aa697d8c0053a62
Reviewed-on: https://go-review.googlesource.com/c/go/+/404294
Auto-Submit: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/cmd/compile/internal/staticdata/data.go
src/cmd/internal/goobj/objfile.go
src/cmd/internal/obj/sym.go