frostfs-sdk-go/container/id/test/id.go
Evgenii Stratonikov 3d0df0d068 [#54] tests: unify test generator names
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-12-01 10:34:54 +03:00

26 lines
432 B
Go

package cidtest
import (
"crypto/sha256"
"math/rand"
cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
)
// ID returns random cid.ID.
func ID() *cid.ID {
checksum := [sha256.Size]byte{}
rand.Read(checksum[:])
return IDWithChecksum(checksum)
}
// IDWithChecksum returns cid.ID initialized
// with specified checksum.
func IDWithChecksum(cs [sha256.Size]byte) *cid.ID {
id := cid.New()
id.SetSHA256(cs)
return id
}