forked from bisqwit/password_codecs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbubbob-password.php
More file actions
33 lines (28 loc) · 839 Bytes
/
bubbob-password.php
File metadata and controls
33 lines (28 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
$ciph = 'BAIFJCGEDH';
$num_codes = 0;
$codes = Array();
for($aa=0; $aa<10; ++$aa)
for($bb=0; $bb<10; ++$bb)
for($cc=0; $cc<10; ++$cc)
for($dd=0; $dd<10; ++$dd)
for($ee=0; $ee<10; ++$ee)
{
$e = $ee ^ $dd;
$d = $dd ^ $cc;
$c = $cc ^ $bb;
$b = $bb ^ $aa;
$a = $aa;
if( ($e | (($c & 6)*4)) == ($a + $b + ($c & 1) + $d) )
{
$code = sprintf('level %3d super=%d unknown=%d', ($c & 1) | ($a * 16) | ($b * 2), $d>>2, $d&3);
$codes[$code][] = $ciph[$aa] . $ciph[$bb] . $ciph[$cc] . $ciph[$dd] . $ciph[$ee];
++$num_codes;
}
}
ksort($codes);
foreach($codes as $code => $opts)
print "$code : " . join(' ', $opts) . "\n";
printf("%d valid codes (out of 100000)\n", $num_codes);
#$reverse = join('', array_map(function($n)use($ciph)
# { return chr(65 + strpos($ciph, $n)); }, range('A','J')));