github.com/codysnider/go-ethereum@v1.10.18-0.20220420071915-14f4ae99222a/crypto/blake2b/register.go (about)

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