Пример #1
0
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)))
}