def test_arbitrary_hash(): """Let's try the hasher with a lot of hashes, say 75 maybe?""" all_ascii = string.ascii_letters + string.digits for i in range(100): inbytes = ''.join(random.choice(all_ascii) for _ in range(500)).encode() testhash = md5._hash(io.BytesIO(inbytes)) echo = subprocess.Popen(('/bin/echo', '-e', '-n', inbytes), stdout=subprocess.PIPE) syshash = subprocess.check_output('md5sum', stdin=echo.stdout).decode().split(' ')[0] # eww assert syshash == testhash
def test_arbitrary_hash(): """Let's try the hasher with a lot of hashes, say 75 maybe?""" all_ascii = string.ascii_letters + string.digits for i in range(100): inbytes = ''.join(random.choice(all_ascii) for _ in range(500)).encode() testhash = md5._hash(io.BytesIO(inbytes)) echo = subprocess.Popen(('/bin/echo', '-e', '-n', inbytes), stdout=subprocess.PIPE) syshash = subprocess.check_output( 'md5sum', stdin=echo.stdout).decode().split(' ')[0] # eww assert syshash == testhash
def test_hasher(): test, result = io.BytesIO(b'hello, world!\n'), '910c8bc73110b0cd1bc5d2bcae782511' assert md5._hash(test) == result
def test_hasher(): test, result = io.BytesIO( b'hello, world!\n'), '910c8bc73110b0cd1bc5d2bcae782511' assert md5._hash(test) == result