MCPcopy Index your code
hub / github.com/RustPython/RustPython / blake2_rfc7693

Method blake2_rfc7693

Lib/test/test_hashlib.py:814–834  ·  view source on GitHub ↗
(self, constructor, md_len, in_len)

Source from the content-addressed store, hash-verified

812 )
813
814 def blake2_rfc7693(self, constructor, md_len, in_len):
815 def selftest_seq(length, seed):
816 mask = (1<<32)-1
817 a = (0xDEAD4BAD * seed) & mask
818 b = 1
819 out = bytearray(length)
820 for i in range(length):
821 t = (a + b) & mask
822 a, b = b, t
823 out[i] = (t >> 24) & 0xFF
824 return out
825 outer = constructor(digest_size=32)
826 for outlen in md_len:
827 for inlen in in_len:
828 indata = selftest_seq(inlen, inlen)
829 key = selftest_seq(outlen, outlen)
830 unkeyed = constructor(indata, digest_size=outlen)
831 outer.update(unkeyed.digest())
832 keyed = constructor(indata, key=key, digest_size=outlen)
833 outer.update(keyed.digest())
834 return outer.hexdigest()
835
836 @unittest.expectedFailure # TODO: RUSTPYTHON; add to constructor const value
837 @requires_blake2

Callers 2

test_blake2bMethod · 0.95
test_blake2sMethod · 0.95

Calls 4

constructorFunction · 0.50
updateMethod · 0.45
digestMethod · 0.45
hexdigestMethod · 0.45

Tested by

no test coverage detected