Random passwords vs Common passwords

CJam, 2262 908 620 512 503 bytes

0000000: 6c3a4c412c73277b2c39373e2b3a422d2c4c4c65752e3d65  l:LA,s'{,97>+:B-,LLeu.=e
0000018: 602c33653c5f333d5c5b513222011523a1d079937afebb7b  `,3e<_3=\[Q2"..#..y.z..{
0000030: 31a4ddf41a5e5038ef2aced9debeac5dc01fc4d27d809e0a  1....^P8.*.....]....}...
0000048: 2631e25b9e7d3314f1438f227b3235366233366242663d2f  &1.[.}3..C."{256b36bBf=/
0000060: 2b7d3a447e332205a4f76b4584be674d02001a36a250f949  +}:D~3"...kE..gM...6.P.I
0000078: 7bd0f1966deff2baab26a259813a0caa266155328064f0ee  {...m....&.Y.:..&aU2.d..
0000090: 20245dfab515c8faf39b08e80880c6e06c51728c57c153ec   $].............lQr.W.S.
00000a8: 9907a8365894bb8163bacd3a67173b50641c928f3ca87e89  ...6X...c..:g.;Pd...<.~.
00000c0: 81c1e95e5f049b61688fc7316e6a639876d00cdf4c01a100  ...^_..ah..1njc.v...L...
00000d8: 998bd12ccf3fb8ca61c89f5a57cedf8170b4b062653d947e  ...,.?..a..ZW...p..be=.~
00000f0: 9f6d5ba729db151b79151ae044cd6416274c73110e777172  .m[.)...y...D.d.'Ls..wqr
0000108: 22445132220133e9dcda9e224435224dc7621a0ae9224433  "DQ2".3...."D5"M.b..."D3
0000120: 220980cb1f885db429b742f47062cc1190767d82e6e956b7  ".....].).B.pb...v}...V.
0000138: 1de25dd9c2be7bf5224451322201c9167dd15a8c8cdd110f  ..]...{."DQ2"...}.Z.....
0000150: e956678cd6467ed95c22d7700c1d37a5b1ad94d3b3a3531e  .Vg..F~.\".p..7.......S.
0000168: 639ba99f27cde7e9c81c686adb874d6d5ac411d8d5e44363  c...'.....hj..MmZ.....Cc
0000180: deff8759ed48c97a32b5eeed5ef23be112773a0e0454e6a5  ...Y.H.z2...^.;..w:..T..
0000198: d064d43adf998c7050910c723616dccb5874a8b3640e39e0  .d.:...pP..r6...Xt..d.9.
00001b0: b7545841c7b3152d13ab3e83857530313cb737c799837a4b  .TXA...-..>..u01<.7...zK
00001c8: 396a39e68c9722443322d87648012832adde4e33e27615e2  9j9..."D3".vH.(2..N3.v..
00001e0: 4b6bf7e94bec9022445d3d7b4c5c23297d253a2b215e7c    Kk..K.."D]={L\#)}%:+!^|

This prints a positive integer for common passwords and zero for others.

Verification

$ xxd -c 24 -g 24 testall.cjam
0000000: 714e257b3a4c412c73277b2c39373e2b3a422d2c4c4c6575  qN%{:LA,s'{,97>+:B-,LLeu
0000018: 2e3d65602c33653c5f333d5c5b513222011523a1d079937a  .=e`,3e<_3=\[Q2"..#..y.z
0000030: febb7b31a4ddf41a5e5038ef2aced9debeac5dc01fc4d27d  ..{1....^P8.*.....]....}
0000048: 809e0a2631e25b9e7d3314f1438f227b3235366233366242  ...&1.[.}3..C."{256b36bB
0000060: 663d2f2b7d3a447e332205a4f76b4584be674d02001a36a2  f=/+}:D~3"...kE..gM...6.
0000078: 50f9497bd0f1966deff2baab26a259813a0caa2661553280  P.I{...m....&.Y.:..&aU2.
0000090: 64f0ee20245dfab515c8faf39b08e80880c6e06c51728c57  d.. $].............lQr.W
00000a8: c153ec9907a8365894bb8163bacd3a67173b50641c928f3c  .S....6X...c..:g.;Pd...<
00000c0: a87e8981c1e95e5f049b61688fc7316e6a639876d00cdf4c  .~....^_..ah..1njc.v...L
00000d8: 01a100998bd12ccf3fb8ca61c89f5a57cedf8170b4b06265  ......,.?..a..ZW...p..be
00000f0: 3d947e9f6d5ba729db151b79151ae044cd6416274c73110e  =.~.m[.)...y...D.d.'Ls..
0000108: 77717222445132220133e9dcda9e224435224dc7621a0ae9  wqr"DQ2".3...."D5"M.b...
0000120: 224433220980cb1f885db429b742f47062cc1190767d82e6  "D3".....].).B.pb...v}..
0000138: e956b71de25dd9c2be7bf5224451322201c9167dd15a8c8c  .V...]...{."DQ2"...}.Z..
0000150: dd110fe956678cd6467ed95c22d7700c1d37a5b1ad94d3b3  ....Vg..F~.\".p..7......
0000168: a3531e639ba99f27cde7e9c81c686adb874d6d5ac411d8d5  .S.c...'.....hj..MmZ....
0000180: e44363deff8759ed48c97a32b5eeed5ef23be112773a0e04  .Cc...Y.H.z2...^.;..w:..
0000198: 54e6a5d064d43adf998c7050910c723616dccb5874a8b364  T...d.:...pP..r6...Xt..d
00001b0: 0e39e0b7545841c7b3152d13ab3e83857530313cb737c799  .9..TXA...-..>..u01<.7..
00001c8: 837a4b396a39e68c9722443322d87648012832adde4e33e2  .zK9j9..."D3".vH.(2..N3.
00001e0: 7615e24b6bf7e94bec9022445d3d7b4c5c23297d253a2b21  v..Kk..K.."D]={L\#)}%:+!
00001f8: 5e7c7d2524656070                                  ^|}%$e`p
$ echo $LANG
en_US
$ cjam testall.cjam < 10k-common-passwords.txt
[[9989 1] [4 2] [2 3] [3 5] [2 7]]
$ cjam testall.cjam < generated_passwords.txt
[[1000 0]]

Python, 719 664 bytes

import re
lambda s:re.search(r"(?!.*([xvonkj]0|p[9q5]|i2|q[4rt]|xk|m8|jp|jg|4k|2n|0b|y.[xj7]|mnw|c.3|7.2|4wu|061|zt[ub]|r6[d8]|o.0|jd[be]|j[wz]o|hk[cj]|^(wb|wd|v3|ub|s2|s1|pb|ml|j5|hv|h1|g8|g6|ft|f4|94|0t)|(we|ha|93|80)4|(xj|x5|03|qa|fz|w)9|3[65]0|zbx|(w.|v|o.?|54)7|[th]82|ssg|g(lc|ij|v|1[34]|bx|bk)|wvf|uax|mss|uhl|306|4.[mr]|9p|rob$))^.*((^([14]?\D+|\D*\d+|\d{3}\D{5}|(?=^\D*\d\D*$).{6}|\D+4\D+|[1-4a-eqwr]+)|sx|[ekru]s|t4u|zx|[avy]y|x[prs]|w[mp2]|uz|tp|tn|sc|qq|qj|p[mov]|r[deq]|oo|n[4tu]|me|k[23c]|jf|[2ag]t|ed|bq|a1|3r|5g)$|\W|123|^(nc|tr|w0|sa|rj|q[bnqu]|ni|mo|mw|le|kc|ib|hz|g9|f0|cb|b9|8d|7k|6u|5w|3m|1q)|z.g|bo|em|x35|t.d|p.o|p39|mar|ki4|id8|ebk|53x)",s)

I'm having a bit of trouble testing this in Retina, so here's Python for now. Test by giving the lambda a name and running it on the word lists:

>>> len([x for x in common if f(x)])
10000
>>> len([x for x in generated if f(x)])
0

It's a very large regex, so I'm taking a break from golfing it for a bit.


Bash - 5324 bytes

gunzip -c rp.gz|grep $1|wc -l

where rp.gz is located at http://dl.tyzoid.com/rp.gz

This returns 1 if on the random list. This is falsy, as bash evalutes 0 as a truty value.

Tags:

Code Golf