Skip to content

Commit 99b08a1

Browse files
authored
Merge pull request #190 from pjbgf/revert-170-no-auto-reg
Revert "Remove `crypto.RegisterHash` call"
2 parents e9a6874 + 7e8e4d5 commit 99b08a1

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

cgo/sha1.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package cgo
55
import "C"
66

77
import (
8+
"crypto"
89
"hash"
910
"unsafe"
1011
)
@@ -14,6 +15,10 @@ const (
1415
BlockSize = 64
1516
)
1617

18+
func init() {
19+
crypto.RegisterHash(crypto.SHA1, New)
20+
}
21+
1722
func New() hash.Hash {
1823
d := new(digest)
1924
d.Reset()

sha1cd.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ package sha1cd
1212
// Original: https://github.com/golang/go/blob/master/src/crypto/sha1/sha1.go
1313

1414
import (
15+
"crypto"
1516
"encoding/binary"
1617
"errors"
1718
"hash"
@@ -21,6 +22,10 @@ import (
2122

2223
//go:generate go run -C asm . -out ../sha1cdblock_amd64.s -pkg $GOPACKAGE
2324

25+
func init() {
26+
crypto.RegisterHash(crypto.SHA1, New)
27+
}
28+
2429
// The size of a SHA-1 checksum in bytes.
2530
const Size = shared.Size
2631

0 commit comments

Comments
 (0)