Exemple #1
0
def test_null_key():
    h0 = _pydmc.hash('foo')
    h1 = _pydmc.hash('foo\0bar')
    h2 = _pydmc.hash('foo\0baz')
    assert h0 != h1, 'Hash collision for appended null'
    assert h0 != h2, 'Hash collision for appended null'
    assert h1 != h2, 'Hash collision for bytes after null'
Exemple #2
0
def test__mhash3():
    h1 = _pydmc.hash('foo')
    h2 = _pydmc.hash('foo', h1 & 0xFFFFFFFF)
    print h1, h2
    assert (-39287385592190013122878999397579195001,
            -73964642705803263641983394469427790275) == (h1, h2)