whitehash: 3x faster.

This commit is contained in:
Ole Tange 2022-02-13 00:43:32 +01:00
parent 470a9570d2
commit e1c0a17387

View file

@ -47,16 +47,19 @@ def mergeparts(tabs,part):
spc = [ i.encode("utf-8")
for i in ("", " ", " ", " ", " ", " ", " ", " ") ]
def recur(pre,n):
def recur(m,pre,n):
if n == len(part)-1:
for i in spc:
sha1 = (hashlib.sha1(pre+i+part[n]).hexdigest())[0:searchlen];
if sha1 in searchstrings:
print(hashlib.sha1(pre+i+part[n]).hexdigest())
sub = m.copy()
sub.update(i+part[n])
if (sub.hexdigest())[0:searchlen] in searchstrings:
print(sub.hexdigest())
print((pre+i+part[n]).decode())
else:
for i in spc:
recur(pre+i+part[n],n+1)
sub = m.copy()
sub.update(i+part[n])
recur(sub,pre+i+part[n],n+1)
bits = searchlen*4
part = readparts();
@ -75,4 +78,6 @@ searchstrings = [ i[0:searchlen] for i in
+
# Generate 012..f 123..0 .. f01..e
[ s[-i:]+s[:-i] for i in range(16)] ]
recur(part[0],1)
m = hashlib.sha1()
m.update(part[0])
recur(m,part[0],1)