Esempio n. 1
0
def test_unicode_input(unicrud):
    unicrud = list(set(unicrud))
    assume(len(unicrud) > 5)

    # MPH is an entropy game, hence things with low-entropy will
    # confuse the hash algorithms preventing convergence on a
    # solution, making this test fail
    assume(_entropy(unicrud) == -0.0)

    mph = cmph.generate_hash(unicrud)

    # ... break the encapsulation, knowing that we
    # do this under the hood
    test_strs = [convert_to_bytes(s) for s in unicrud]
    for original, escaped in zip(unicrud, test_strs):
        assert mph(escaped) == mph(original)
Esempio n. 2
0
def test_unicode_input(unicrud):
    unicrud = list(set(unicrud))
    assume(len(unicrud) > 5)

    # MPH is an entropy game, hence things with low-entropy will
    # confuse the hash algorithms preventing convergence on a
    # solution, making this test fail
    assume(_entropy(unicrud) == -0.0)

    mph = cmph.generate_hash(unicrud)

    # ... break the encapsulation, knowing that we
    # do this under the hood
    test_strs = [convert_to_bytes(s) for s in unicrud]
    for original, escaped in zip(unicrud, test_strs):
        assert mph(escaped) == mph(original)
Esempio n. 3
0
def test_unicode_bytes(unicrud):
    assert unicrud_type(convert_to_bytes(unicrud), 'utf8') == unicrud