whitehash: 3x faster.
This commit is contained in:
parent
cb49a0997a
commit
6fc28084d9
|
@ -47,16 +47,19 @@ def mergeparts(tabs,part):
|
||||||
|
|
||||||
spc = [ i.encode("utf-8")
|
spc = [ i.encode("utf-8")
|
||||||
for i in ("", " ", " ", " ", " ", " ", " ", " ") ]
|
for i in ("", " ", " ", " ", " ", " ", " ", " ") ]
|
||||||
def recur(pre,n):
|
def recur(m,pre,n):
|
||||||
if n == len(part)-1:
|
if n == len(part)-1:
|
||||||
for i in spc:
|
for i in spc:
|
||||||
sha1 = (hashlib.sha1(pre+i+part[n]).hexdigest())[0:searchlen];
|
sub = m.copy()
|
||||||
if sha1 in searchstrings:
|
sub.update(i+part[n])
|
||||||
print(hashlib.sha1(pre+i+part[n]).hexdigest())
|
if (sub.hexdigest())[0:searchlen] in searchstrings:
|
||||||
|
print(sub.hexdigest())
|
||||||
print((pre+i+part[n]).decode())
|
print((pre+i+part[n]).decode())
|
||||||
else:
|
else:
|
||||||
for i in spc:
|
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
|
bits = searchlen*4
|
||||||
part = readparts();
|
part = readparts();
|
||||||
|
@ -75,4 +78,6 @@ searchstrings = [ i[0:searchlen] for i in
|
||||||
+
|
+
|
||||||
# Generate 012..f 123..0 .. f01..e
|
# Generate 012..f 123..0 .. f01..e
|
||||||
[ s[-i:]+s[:-i] for i in range(16)] ]
|
[ 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)
|
||||||
|
|
Loading…
Reference in a new issue