Use sha256-simd for hashing (#1656)

This commit is contained in:
Michal Niewrzal 2019-04-04 10:12:08 +02:00 committed by GitHub
parent bb892d33d1
commit cab8fa349f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 3 deletions

2
go.mod
View File

@ -68,7 +68,7 @@ require (
github.com/minio/lsync v0.0.0-20180328070428-f332c3883f63 // indirect
github.com/minio/mc v0.0.0-20180926130011-a215fbb71884 // indirect
github.com/minio/minio-go v6.0.3+incompatible
github.com/minio/sha256-simd v0.0.0-20171213220625-ad98a36ba0da // indirect
github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5
github.com/minio/sio v0.0.0-20180327104954-6a41828a60f0 // indirect
github.com/mitchellh/go-homedir v0.0.0-20180801233206-58046073cbff // indirect
github.com/nats-io/gnatsd v1.3.0 // indirect

2
go.sum
View File

@ -221,6 +221,8 @@ github.com/minio/minio-go v6.0.3+incompatible h1:yTq5mJOcWg6ot6STkEMnrNN896L0aDD
github.com/minio/minio-go v6.0.3+incompatible/go.mod h1:7guKYtitv8dktvNUGrhzmNlA5wrAABTQXCoesZdFQO8=
github.com/minio/sha256-simd v0.0.0-20171213220625-ad98a36ba0da h1:tazA5y1hWYJO8VSYbU36yBhXeIvruLXMUKu6WBtcJck=
github.com/minio/sha256-simd v0.0.0-20171213220625-ad98a36ba0da/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U=
github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5 h1:l16XLUUJ34wIz+RIvLhSwGvLvKyy+W598b135bJN6mg=
github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U=
github.com/minio/sio v0.0.0-20180327104954-6a41828a60f0 h1:ys4bbOlPvaUBlA0byjm6TqydsXZu614ZIUTfF+4MRY0=
github.com/minio/sio v0.0.0-20180327104954-6a41828a60f0/go.mod h1:PDJGYr8GXjiOTIst0hQMOSK5FdXLwObr2cGbiMddDPc=
github.com/mitchellh/go-homedir v0.0.0-20180801233206-58046073cbff h1:jM4Eo4qMmmcqePS3u6X2lcEELtVuXWkWJIS/pRI3oSk=

View File

@ -4,12 +4,15 @@
package pkcrypto
import (
"crypto/sha256"
"hash"
sha256 "github.com/minio/sha256-simd"
)
// NewHash returns default hash in storj.
func NewHash() hash.Hash { return sha256.New() }
func NewHash() hash.Hash {
return sha256.New()
}
// SHA256Hash calculates the SHA256 hash of the input data
func SHA256Hash(data []byte) []byte {