RipeMd and Sha224 added to unit test.

This commit is contained in:
David Garske
2016-12-19 12:15:10 -08:00
committed by jrblixt
parent a40a3cb142
commit 4edcbc79c1
215 changed files with 58563 additions and 21354 deletions

View File

@@ -46,23 +46,23 @@ class Random(object):
"""
Generate and return a random byte.
"""
result = t2b("\0")
result = _ffi.new('byte[1]')
ret = _lib.wc_RNG_GenerateByte(self.native_object, result)
if ret < 0:
raise WolfCryptError("RNG generate byte error (%d)" % ret)
return result
return _ffi.buffer(result, 1)[:]
def bytes(self, length):
"""
Generate and return a random sequence of length bytes.
"""
result = t2b("\0" * length)
result = _ffi.new('byte[%d]' % length)
ret = _lib.wc_RNG_GenerateBlock(self.native_object, result, length)
if ret < 0:
raise WolfCryptError("RNG generate block error (%d)" % ret)
return result
return _ffi.buffer(result, length)[:]