rclone/vendor/storj.io/common/pkcrypto/hashing.go

24 lines
409 B
Go
Raw Normal View History

2020-05-11 18:57:46 +00:00
// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
// +build !stdsha256
2020-05-11 18:57:46 +00:00
package pkcrypto
import (
"hash"
"github.com/minio/sha256-simd"
2020-05-11 18:57:46 +00:00
)
// NewHash returns default hash in storj.
func NewHash() hash.Hash {
return sha256.New()
}
// SHA256Hash calculates the SHA256 hash of the input data.
2020-05-11 18:57:46 +00:00
func SHA256Hash(data []byte) []byte {
sum := sha256.Sum256(data)
return sum[:]
}