register.go 594 B

123456789101112131415161718192021222324252627282930
  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. package blake2b
  5. import (
  6. "crypto"
  7. "hash"
  8. )
  9. func init() {
  10. newHash256 := func() hash.Hash {
  11. h, _ := New256(nil)
  12. return h
  13. }
  14. newHash384 := func() hash.Hash {
  15. h, _ := New384(nil)
  16. return h
  17. }
  18. newHash512 := func() hash.Hash {
  19. h, _ := New512(nil)
  20. return h
  21. }
  22. crypto.RegisterHash(crypto.BLAKE2b_256, newHash256)
  23. crypto.RegisterHash(crypto.BLAKE2b_384, newHash384)
  24. crypto.RegisterHash(crypto.BLAKE2b_512, newHash512)
  25. }