mirror of https://github.com/wolfSSL/wolfssl
Update random.py
Realized that `ffi.string()` could truncate the output on null bytes.
This commit is contained in:
parent
e96a720f04
commit
a094a36fa8
|
@ -52,7 +52,7 @@ class Random(object):
|
|||
if ret < 0:
|
||||
raise WolfCryptError("RNG generate byte error (%d)" % ret)
|
||||
|
||||
return _ffi.string(result, 1)
|
||||
return _ffi.buffer(result, 1)[:]
|
||||
|
||||
|
||||
def bytes(self, length):
|
||||
|
@ -65,4 +65,4 @@ class Random(object):
|
|||
if ret < 0:
|
||||
raise WolfCryptError("RNG generate block error (%d)" % ret)
|
||||
|
||||
return _ffi.string(result, length)
|
||||
return _ffi.buffer(result, length)[:]
|
||||
|
|
Loading…
Reference in New Issue