Maybe you can try this https://github.com/minio/sha256-simd

在 2017年10月17日星期二 UTC+8下午4:13:41,Christian LeMoussel写道:
>
> I need to calculate 10 millions of  sha256 checksums, 
>
> Actually I do this :
>
> var bl int
> var pnb = make([]byte, 10)
> var hash = [32]byte
> var sha256Hash string
> var steps = 10000000
>
> startBench := time.Now()
>
> for i := 0; i < steps; i++ {
>     bl = 0
>     bl += copy(pnb[bl:], "TEST")
>     bl += copy(nonce[bl:], fmt.Sprintf("%04x", i))
>     bl += copy(pnb[bl:], "00")
>     hash = sha256.Sum256(pnb)
>     sha256Hash = hex.EncodeToString(hash[:])
> }
>
> elapsedBench := time.Since(startBench)
>
> log.Printf("%d iterations => sha256 took %v", steps, elapsedBench)
>
> Is it possible to improve the speed?
>
> Thank for your help
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to