2019-02-07 09:04:29 +00:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
package pkcrypto
|
|
|
|
|
|
|
|
import (
|
2019-02-07 17:08:52 +00:00
|
|
|
"crypto/sha256"
|
2019-03-18 10:55:06 +00:00
|
|
|
"hash"
|
2019-02-07 09:04:29 +00:00
|
|
|
)
|
|
|
|
|
2019-03-18 10:55:06 +00:00
|
|
|
// NewHash returns default hash in storj.
|
|
|
|
func NewHash() hash.Hash { return sha256.New() }
|
|
|
|
|
2019-02-07 09:04:29 +00:00
|
|
|
// SHA256Hash calculates the SHA256 hash of the input data
|
2019-02-07 17:08:52 +00:00
|
|
|
func SHA256Hash(data []byte) []byte {
|
|
|
|
sum := sha256.Sum256(data)
|
|
|
|
return sum[:]
|
2019-02-07 09:04:29 +00:00
|
|
|
}
|