1
0

register.go 611 B

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