static const char *const kwlist[] = { "key", "i", 0 };
struct bin k;
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&O&:new", KWLIST,
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&|O&:new", KWLIST,
convbin, &k, convu32, &i))
goto end;
if (keysz(k.sz, info->keysz) != k.sz) VALERR("bad key length");
{
const gccrand_info *info = GCCRAND_INFO(ty);
static const char *const kwlist[] = { "key", "nonce", 0 };
+ static const octet zn[24] = { 0 };
struct bin k, n;
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&O&:new", KWLIST,
+ n.p = zn; n.sz = info->noncesz; assert(info->noncesz <= sizeof(zn));
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&|O&:new", KWLIST,
convbin, &k, convbin, &n))
goto end;
if (keysz(k.sz, info->keysz) != k.sz) VALERR("bad key length");
rcls = C.gccrands[r]
rng = rcls(T.span(rcls.keysz.default), **kw)
me.assertTrue(rng.cryptop)
+ if kw:
+ rng = rcls(T.span(rcls.keysz.default))
+ me.check_rand(rng)
def test_sslrand(me):
rng = C.SSLRand(T.span(16), T.span(32), C.md5, C.sha)
span(n) + \
byteseq([0xff])
-Z64 = C.ByteString.zero(8)
def detrand(seed):
"""Return a fast deterministic random generator with the given SEED."""
- return C.chacha8rand(C.sha256().hash(bin(seed)).done(), Z64)
+ return C.chacha8rand(C.sha256().hash(bin(seed)).done())
class GenericTestMixin (U.TestCase):
"""