Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add variations of sha2 #149

Merged
merged 1 commit into from
Oct 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions core/magic.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ var ErrSumNotSupported = errors.New("no such hash registered")
const (
IDENTITY = 0x00
SHA1 = 0x11
SHA2_224 = 0x1013
SHA2_256 = 0x12
SHA2_384 = 0x20
SHA2_512 = 0x13
SHA2_512_224 = 0x1014
SHA2_512_256 = 0x1015
SHA3_224 = 0x17
SHA3_256 = 0x16
SHA3_384 = 0x15
Expand Down
4 changes: 4 additions & 0 deletions core/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ func init() {
Register(IDENTITY, func() hash.Hash { return &identityMultihash{} })
Register(MD5, md5.New)
Register(SHA1, sha1.New)
Register(SHA2_224, sha256.New224)
Register(SHA2_256, sha256.New)
Register(SHA2_384, sha512.New384)
Register(SHA2_512, sha512.New)
Register(SHA2_512_224, sha512.New512_224)
Register(SHA2_512_256, sha512.New512_256)
Register(DBL_SHA2_256, func() hash.Hash { return &doubleSha256{sha256.New()} })
}