aboutsummaryrefslogtreecommitdiff
path: root/src/crypto/sha256/sha256.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/crypto/sha256/sha256.go')
-rw-r--r--src/crypto/sha256/sha256.go15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/crypto/sha256/sha256.go b/src/crypto/sha256/sha256.go
index 465d00e0e6..e3c15e66ca 100644
--- a/src/crypto/sha256/sha256.go
+++ b/src/crypto/sha256/sha256.go
@@ -8,13 +8,12 @@ package sha256
import (
"crypto"
+ "crypto/internal/boring"
"encoding/binary"
"errors"
"hash"
)
-import "crypto/internal/boring"
-
func init() {
crypto.RegisterHash(crypto.SHA224, New224)
crypto.RegisterHash(crypto.SHA256, New)
@@ -263,11 +262,7 @@ func (d *digest) checkSum() [Size]byte {
// Sum256 returns the SHA256 checksum of the data.
func Sum256(data []byte) [Size]byte {
if boring.Enabled {
- h := New()
- h.Write(data)
- var ret [Size]byte
- h.Sum(ret[:0])
- return ret
+ return boring.SHA256(data)
}
var d digest
d.Reset()
@@ -278,11 +273,7 @@ func Sum256(data []byte) [Size]byte {
// Sum224 returns the SHA224 checksum of the data.
func Sum224(data []byte) [Size224]byte {
if boring.Enabled {
- h := New224()
- h.Write(data)
- var ret [Size224]byte
- h.Sum(ret[:0])
- return ret
+ return boring.SHA224(data)
}
var d digest
d.is224 = true