frostfs-sdk-go/checksum/test/generate.go
Evgenii Stratonikov 49ad985cad [#161] *: Do not use math/rand.Read()
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2023-09-08 17:17:02 +03:00

21 lines
315 B
Go

package checksumtest
import (
"crypto/rand"
"crypto/sha256"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/checksum"
)
// Checksum returns random checksum.Checksum.
func Checksum() checksum.Checksum {
var cs [sha256.Size]byte
_, _ = rand.Read(cs[:])
var x checksum.Checksum
x.SetSHA256(cs)
return x
}