-
-
Save AshyIsMe/1c49716365f6ac07c0a74bad9f984ae7 to your computer and use it in GitHub Desktop.
0 : 0 | |
Can you crack Aaron’s password hash? He seems to like | |
simple passwords. I’m sure he’ll use his name and birthday | in it. Hint: Aaron writes important dates as YYYYMMDD | |
rather than YYYY-MM-DD or any other special character | separator. Hash: 7f4986da7d7b52fa81f98278e6ec9dcb. | |
Author: moat, Pacific Northwest National Laboratory | |
) | |
y=:":"0 (1900 + i.120) | |
m=:(i.11) { ('0' ,"1 ":"0 (1+i.9)) , ('1' ,"1 ":"0 (1+i.9)) | |
d=:('0' ,"1 ":"0 (1+i.9)) , (":"0) 10+i.22 | |
md5=:15&(128!:6) | |
NB. md5 'foo' | |
NB. acbd18db4cc2f85cedef654fccc4a4d8 |
md5=:15&(128!:6)
NB. md5 'foo'
NB. acbd18db4cc2f85cedef654fccc4a4d8
NB. Thanks to moon-child in #jsoftware. The date formats aren't quite right (no leading zeros on single digit days/months)
NB. but this shows how fast md5 hashing is on modern hardware.
dates=:,/ (1+i.31) ,"1 0/~ ,/ (1900+i.120) ,"0/ (1+i.12)
sdates=:":dates
NB. #sdates
NB. 44640
NB. timespacex 'md5 sdates'
NB. 0.006334 2.09834e6
NB. md5 sdates
NB. ...
NB. 56982992f6217e67dcfd7ee23edfc55a
NB. 0a900286cc075086700d7bccadd1892a
NB. 4511ddfc8b94e9e14c9f5a93512bf033
NB. 56f6e46829ddd5201d7ad075e963c698
NB. ...
require 'format/printf'
dates=:,/ (1+i.31) ,"1 0/~ ,/ (1900+i.120) ,"0/ (1+i.12)
sdates =: '%d%02d%02d' sprintf dates
passwords=:'Aaron',"1 1 sdates
hashes=:md5 passwords
NB. First 10 hashes;
(i.10) { hashes
98973283b3af42f7aa10372df7d62652
a7460a6feb4205c9ae7ca77f867fdc3b
1545446bd3903d812f5a5826727ef53a
fdcba9439b2d86e1b59a6edb4af37a52
7e7ad7a858a4368351846dfa8044e2f6
a9dfffd098cd64b5a8c26575a43ecc26
0897c50557a8202f26083f2bf3d0c7a2
bbb63a0d9c3fa5ea9ead2c6abbdb5017
54fe0d6b2c91024ca6d2762e629b9559
3555724e95175a629e15d90df1c25ccc
...
require 'format/printf'
dates=:,/ (1+i.31) ,"1 0/~ ,/ (1900+i.120) ,"0/ (1+i.12)
sdates =: '%d%02d%02d' sprintf dates
passwords=:'Aaron',"1 1 sdates
hashes=:md5 passwords
NB. Compare the needle with the haystack.
NB. This compares each character and returns a list of bools for each comparison.
NB. Then we sum the bits together.
sums =: +/"1 '7f4986da7d7b52fa81f98278e6ec9dcb' ="1 1 hashes
NB. Find the index of a match
sums i: 32
NB. Grab the matching password
(sums i: 32) { passwords
nice try man