Last active
December 15, 2015 16:19
-
-
Save mkandalf/5288009 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bitarray import bitarray, bitdiff | |
import random | |
from _skein import skein1024 | |
def main(): | |
min_rand = None | |
min_diff = 600 | |
target = bitarray(str(bin(int('5b4da95f5fa08280fc9879df44f418c8f9f12ba424b7757de02bbdfbae0d4c4fdf9317c80cc5fe04c6429073466cf29706b8c25999ddd2f6540d4475cc977b87f4757be023f19b8f4035d7722886b78869826de916a79cf9c94cc79cd4347d24b567aa3e2390a573a373a48a5e676640c79cc70197e1c5e7f902fb53ca1858b6', 16)))[2:].zfill(1024)) | |
while(True): | |
rand = bytearray(str(random.randint(1,1000000000000000000)), 'utf-8') | |
h = skein1024(rand, digest_bits=1024) | |
bin_hash = str(bin(int(h.hexdigest(),16)))[2:].zfill(1024) | |
diff = bitdiff(target, bitarray(bin_hash)) | |
if diff < min_diff: | |
min_diff = diff | |
min_rand = rand | |
print(min_rand, min_diff) | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment