lotus/storage/sectorstorage/mock/util.go

24 lines
297 B
Go
Raw Normal View History

2020-03-23 11:40:02 +00:00
package mock
2020-01-13 20:47:27 +00:00
import (
"crypto/rand"
"io"
"io/ioutil"
)
func randB(n uint64) []byte {
b, err := ioutil.ReadAll(io.LimitReader(rand.Reader, int64(n)))
if err != nil {
panic(err)
}
return b
}
func commDR(in []byte) (out [32]byte) {
for i, b := range in {
out[i] = ^b
}
return out
}