On Github, there is a list of the 10,000 most common passwords. I've also generated my own list of random passwords.

Your job is to identify the difference between the two lists (with 100% accuracy).

Therefore, your program needs to accept a string, and return:

1. A truthy value if the password is on the common passwords list
2. A falsy value if the password is on the random passwords list
3. Anything you'd like if the password isn't on either

For those that are interested, my program generates passwords between 5-10 characters in length, and each character is either a lowercase letter or a digit.

Note: You should not use these passwords in anything secure. My generation algorithm is not secure at all, and the results are posted online for all to see

• You've put the tag regular-expression but this doesn't seem to be necessary for the challenge? Did you intend for it to be? Feb 17 '16 at 21:45
• @FryAmTheEggman I'm assuming most answers are going to be regex, so I added it for those that are interested in such challenges. Feb 17 '16 at 21:48
• I'm slightly confused ... what's to prevent a short PowerShell like $args[0]-in(gc .\10k-passwords.txt)? Are we to come up with some sort of pattern that recognizes the one but not the other? Feb 17 '16 at 21:49 • @TimmyD if you use other files, then the byte count of those files are included in your score. Feb 17 '16 at 21:50 ## 4 Answers # CJam, 2262908620512 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.....
0000180: deff8759ed48c97a32b5eeed5ef23be112773a0e0454e6a5  ...Y.H.z2...^.;..w:..T..
00001b0: b7545841c7b3152d13ab3e83857530313cb737c799837a4b  .TXA...-..>..u01<.7...zK
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..
0000180: e44363deff8759ed48c97a32b5eeed5ef23be112773a0e04  .Cc...Y.H.z2...^.;..w:..
00001b0: 0e39e0b7545841c7b3152d13ab3e83857530313cb737c799  .9..TXA...-..>..u01<.7..
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]] • Whatever it is, I like it. +1 Feb 18 '16 at 11:56 • Would you mind explaining roughly what the thinking is behind this? Feb 18 '16 at 14:50 • @ASimmons After filtering non-alphanumeric passwords, I'm counting the number of groups of letters or digits. If there are two or less, it's probably common; if there are three or more, it's probably random. That misclassifies over 300 passwords, which are hardcoded in the unprintable strings. I'll provide a detailed explanation once I'm satisfied with my score. Feb 18 '16 at 14:55 ## 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.

• Compressing this might actually be better than switching to Retina, but I'm having trouble getting the compression working. Feb 18 '16 at 8:43

# 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. • Rename rp.gz to a 1-byte filename to save 4 bytes... – Doorknob Feb 18 '16 at 1:51 • @Doorknob: And save, what? .08%? Seems like a micro-optimization where the solution itself is clunky at best. Feb 18 '16 at 3:21 • xz seems better for this use case. Smaller command and higher compression ratio afaik. – Sebb Feb 18 '16 at 7:22 • No need for separate gunzip and grep, also no need for wc: zgrep -c$1 rp.gz. Also micro-optimiztion, but xz compresses insignificantly better. By the way, wouldn't be better to use -x (--line-regexp) or -w (--word-regexp) to not match word fragments? Feb 18 '16 at 9:50
• Something like sort rpass.txt | 7z -si -mx=9 a r.gz should give you a shave off of about 480 bytes ... Feb 19 '16 at 1:19