register.go 628 B

123456789101112131415161718192021222324252627282930313233
  1. // Copyright 2017 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. //go:build go1.9
  5. // +build go1.9
  6. package blake2b
  7. import (
  8. "crypto"
  9. "hash"
  10. )
  11. func init() {
  12. newHash256 := func() hash.Hash {
  13. h, _ := New256(nil)
  14. return h
  15. }
  16. newHash384 := func() hash.Hash {
  17. h, _ := New384(nil)
  18. return h
  19. }
  20. newHash512 := func() hash.Hash {
  21. h, _ := New512(nil)
  22. return h
  23. }
  24. crypto.RegisterHash(crypto.BLAKE2b_256, newHash256)
  25. crypto.RegisterHash(crypto.BLAKE2b_384, newHash384)
  26. crypto.RegisterHash(crypto.BLAKE2b_512, newHash512)
  27. }