MCPcopy Create free account
hub / github.com/commonmark/cmark / badhash

Function badhash

test/pathological_tests.py:31–39  ·  view source on GitHub ↗
(ref)

Source from the content-addressed store, hash-verified

29 COUNT = 25000
30
31 def badhash(ref):
32 h = 0
33 for c in ref:
34 a = (h << 6) & 0xFFFFFFFF
35 b = (h << 16) & 0xFFFFFFFF
36 h = ord(c) + a + b - h
37 h = h & 0xFFFFFFFF
38
39 return (h % REFMAP_SIZE) == 0
40
41 keys = ("x%d" % i for i in itertools.count())
42 collisions = itertools.islice((k for k in keys if badhash(k)), COUNT)

Callers 1

hash_collisionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected