github.com/cellofellow/gopkg@v0.0.0-20140722061823-eec0544a62ad/encoding/base58/util.go (about)

     1  // Copyright 2012 chaishushan@gmail.com. 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  package base58
     6  
     7  import (
     8  	"crypto/sha256"
     9  )
    10  
    11  func Hash(ba []byte) []byte {
    12  	sha := sha256.New()
    13  	sha2 := sha256.New() // hash twice
    14  	ba = sha.Sum(ba)
    15  	return sha2.Sum(ba)
    16  }