示例#1
0
文件: rand.go 项目: ZiRo-/srndv2
func randbytes(size C.size_t) *Buffer {

	buff := malloc(size)
	C.randombytes_buf(buff.ptr, size)
	return buff

}
示例#2
0
func GenerateKey() []byte {
	key := [KeyBytes]byte{}
	C.randombytes_buf(unsafe.Pointer(&key), KeyBytes)
	return key[:]
}
示例#3
0
func Randombytes(bytes []byte) {
	C.randombytes_buf(unsafe.Pointer(&bytes[0]), C.size_t(cap(bytes)))
}