예제 #1
0
파일: test_hash.py 프로젝트: nbdy/roach
def test_hash():
    assert crc32("hello") == 0x3610a686
    assert hex(md5("hello")) == "5d41402abc4b2a76b9719d911017c592"
    assert hex(sha1("hello")) == ("aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d")
    assert hex(sha224("hello")) == (
        "ea09ae9cc6768c50fcee903ed054556e5bfc8347907f12598aa24193")
    assert hex(sha256("hello")) == (
        "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824")
    assert hex(sha384("hello")) == (
        "59e1748777448c69de6b800d7a33bbfb9ff1b463e44354c3553bcdb9c666fa90125a3c79f90397bdf5f6a13de828684f"
    )
    assert hex(sha512("hello")) == (
        "9b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caadae2dff72519673ca72323c3d99ba5c11d7c7acc6e14b8c5da0c4663475c2e5c"
        "3adef46f73bcdec043")
예제 #2
0
파일: test_string.py 프로젝트: nbdy/roach
def test_hex():
    assert hex("hello") == "68656c6c6f"
    assert unhex("68656c6c6f") == "hello"