コード例 #1
0
ファイル: test_mhash.py プロジェクト: joshlk/pybloof
def test_null_key():
    h0 = _pybloof.hash('foo')
    h1 = _pybloof.hash('foo\0bar')
    h2 = _pybloof.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'
コード例 #2
0
ファイル: test_mhash.py プロジェクト: wumpus/pybloof
def test_null_key():
    h0 = _pybloof.hash('foo')
    h1 = _pybloof.hash('foo\0bar')
    h2 = _pybloof.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'
コード例 #3
0
ファイル: test_mhash.py プロジェクト: joshlk/pybloof
def test__mhash3():
    h1 = _pybloof.hash('foo')
    h2 = _pybloof.hash('foo', h1 & 0xFFFFFFFF)
    print h1, h2
    assert (-39287385592190013122878999397579195001,
            -73964642705803263641983394469427790275) == (h1, h2)
コード例 #4
0
ファイル: test_mhash.py プロジェクト: wumpus/pybloof
def test__mhash3():
    h1 = _pybloof.hash('foo')
    h2 = _pybloof.hash('foo', h1 & 0xFFFFFFFF)
    assert (-39287385592190013122878999397579195001,
            -73964642705803263641983394469427790275) == (h1, h2)