Posted By

MMDeveloper on 10/01/08


Tagged

javascript password strength


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

Scooter
cjwilburn


Password Strength Meter


 / Published in: JavaScript
 

URL: http://www.mechanicmatt.com/SourceCode/JavaScript/MMPasswordStrengthPreview.html

I did not write this

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5. <title>Password Strength</title>
  6. <style type="text/css">
  7. <!--
  8. .pwdCheckCase0, .pwdCheckCase1, .pwdCheckCase2, .pwdCheckCase3, .pwdCheckCase4 {
  9. text-align: center;
  10. border-right-width: 1px;
  11. border-bottom-width: 1px;
  12. border-right-style: solid;
  13. border-bottom-style: solid;
  14. }
  15. .pwdCheckCase0 {
  16. background-color: #CCCCCC;
  17. border-right-color: #CCCCCC;
  18. border-bottom-color: #CCCCCC;
  19. }
  20. .pwdCheckCase1 {
  21. background-color: #FF0000;
  22. border-right-color: #FF0000;
  23. border-bottom-color: #FF0000;
  24. }
  25. .pwdCheckCase2 {
  26. background-color: #FFCC00;
  27. border-right-color: #FFCC00;
  28. border-bottom-color: #FFCC00;
  29. }
  30. .pwdCheckCase3 {
  31. background-color: #3366FF;
  32. border-right-color: #3333FF;
  33. border-bottom-color: #3333FF;
  34. }
  35. .pwdCheckCase4 {
  36. background-color: #00CC00;
  37. border-right-color: #336600;
  38. border-bottom-color: #336600;
  39. }
  40. .pwdCheckTable {
  41. /*border: 3px outset #CCCCCC;*/
  42. padding: 0px 0px 0px 0px;
  43. width: 100%;
  44. }
  45. .pwdCheckInnerTable {
  46. font-family: Tahoma,sans-serif;
  47. font-weight: bold;
  48. width: 210px;
  49. border: 0px 0px 0px 0px;
  50. height: 19px;
  51. background-color: #FFFFFF;
  52. }
  53. .pwdCheckInnerTable span {
  54. font-size: 70%;
  55. }
  56. .pwdCheckLabelCell {
  57. font-size: 9pt;
  58. color: #000000;
  59. font-weight: bold;
  60. vertical-align: top;
  61. text-align: right;
  62. padding: 5px 20px 13px 5px;
  63. }
  64. .pwdCheckDataCell {
  65. width: 200px;
  66. vertical-align: top;
  67. padding: 0px 0px 13px 0px;
  68. }
  69. #inputPC {
  70. font-size: 70%;
  71. width: 210px;
  72. height: 19px;
  73. border: 1px solid #999999;
  74. }
  75. .buttons {
  76. cursor: pointer;
  77. display: inline;
  78. border: 1px groove #3399CC;
  79. background-color: #3399CC;
  80. padding: 0px 2px 0px 2px;
  81. text-align: center;
  82. vertical-align: middle;
  83. }
  84. -->
  85. </style>
  86. <script type="text/javascript">
  87. <!--
  88. var kNoCanonicalCounterpart = 0;
  89. var kCapitalLetter = 0;
  90. var kSmallLetter = 1;
  91. var kDigit = 2;
  92. var kPunctuation = 3;
  93. var kAlpha = 4;
  94. var kCanonicalizeLettersOnly = true;
  95. var kCananicalizeEverything = false;
  96. var gDebugOutput = null;
  97. var kDebugTraceLevelNone = 0;
  98. var kDebugTraceLevelSuperDetail = 120;
  99. var kDebugTraceLevelRealDetail = 100;
  100. var kDebugTraceLevelAll = 80;
  101. var kDebugTraceLevelMost = 60;
  102. var kDebugTraceLevelFew = 40;
  103. var kDebugTraceLevelRare = 20;
  104. var gDebugTraceLevel = kDebugTraceLevelNone;
  105.  
  106. function DebugPrint (){
  107. var string = "";
  108. if (gDebugTraceLevel && gDebugOutput && DebugPrint.arguments && (DebugPrint.arguments.length > 1) && (DebugPrint.arguments [0] <= gDebugTraceLevel)){
  109. for (var index = 1; index < DebugPrint.arguments.length; index++){
  110. string += DebugPrint.arguments[index] + " ";
  111. }
  112. string += "<br>\n";
  113. gDebugOutput (string);
  114. } else {}
  115. }
  116.  
  117. function CSimilarityMap (){
  118. this.m_elements = "";
  119. this.m_canonicalCounterparts = "";
  120. }
  121.  
  122. function SimilarityMap_Add (element, canonicalCounterpart){
  123. this.m_elements += element;
  124. this.m_canonicalCounterparts += canonicalCounterpart;
  125. }
  126.  
  127. function SimilarityMap_Lookup (element){
  128. var canonicalCounterpart = kNoCanonicalCounterpart;
  129. var index = this.m_elements.indexOf (element);
  130. if (index >= 0){
  131. canonicalCounterpart = this.m_canonicalCounterparts.charAt (index);
  132. } else {}
  133.  
  134. return canonicalCounterpart;
  135. }
  136.  
  137. function SimilarityMap_GetCount (){
  138. return this.m_elements.length;
  139. }
  140.  
  141. CSimilarityMap.prototype.Add = SimilarityMap_Add;
  142. CSimilarityMap.prototype.Lookup = SimilarityMap_Lookup;
  143. CSimilarityMap.prototype.GetCount = SimilarityMap_GetCount;
  144.  
  145. function CDictionaryEntry (length, wordList){
  146. this.m_length = length;
  147. this.m_wordList = wordList;
  148. }
  149.  
  150. function DictionaryEntry_Lookup (strWord){
  151. var fFound = false;
  152. if (strWord.length == this.m_length){
  153. var nFirst = 0;
  154. var nLast = this.m_wordList.length - 1;
  155. while (nFirst <= nLast){
  156. var nCurrent = Math.floor ((nFirst + nLast) / 2);
  157. if (strWord == this.m_wordList [nCurrent]){
  158. fFound = true;
  159. break;
  160. }
  161. else if (strWord > this.m_wordList [nCurrent]){
  162. nLast = nCurrent - 1;
  163. }
  164. else {
  165. nFirst = nCurrent + 1;
  166. }
  167. }
  168. } else {}
  169.  
  170. return fFound;
  171. }
  172.  
  173. CDictionaryEntry.prototype.Lookup = DictionaryEntry_Lookup;
  174.  
  175. function CDictionary (){
  176. this.m_entries = new Array ();
  177. }
  178.  
  179. function Dictionary_Lookup (strWord){
  180. for (var index = 0; index < this.m_entries.length; index++){
  181. if (this.m_entries [index].Lookup (strWord)){
  182. return true;
  183. } else {}
  184. }
  185. }
  186.  
  187. function Dictionary_Add (length, wordList){
  188. var iL = this.m_entries.length;
  189. var cD = new CDictionaryEntry (length, wordList);
  190. this.m_entries [iL] = cD;
  191. }
  192.  
  193. CDictionary.prototype.Lookup = Dictionary_Lookup;
  194. CDictionary.prototype.Add = Dictionary_Add;
  195. var gSimilarityMap = new CSimilarityMap ();
  196. var gDictionary = new CDictionary ();
  197.  
  198. function CharacterSetChecks (type, fResult){
  199. this.type = type;
  200. this.fResult = fResult;
  201. }
  202.  
  203. function isctype (character, type, nDebugLevel){
  204. var fResult = false;
  205. switch (type){
  206. case kCapitalLetter:
  207. if ((character >= 'A') && (character <= 'Z')){
  208. fResult = true;
  209. } else {}
  210. break;
  211.  
  212. case kSmallLetter:
  213. if ((character >= 'a') && (character <= 'z')){
  214. fResult = true;
  215. } else {}
  216. break;
  217.  
  218. case kDigit:
  219. if ((character >= '0') && (character <= '9')){
  220. fResult = true;
  221. } else {}
  222. break;
  223.  
  224. case kPunctuation:
  225. if ("!@#$%^&* ()_+-='\";:[{]}\|.>,</?`~".indexOf (character) >= 0){
  226. fResult = true;
  227. } else {}
  228. break;
  229.  
  230. case kAlpha:
  231. if (isctype (character, kCapitalLetter) || isctype (character, kSmallLetter)){
  232. fResult = true;
  233. } else {}
  234. break;
  235.  
  236. default:
  237. alert ("Unexpected Error!");
  238. break;
  239. }
  240.  
  241. return fResult;
  242. }
  243.  
  244. function CanonicalizeWord (strWord, similarityMap, fLettersOnly){
  245. var canonicalCounterpart = kNoCanonicalCounterpart;
  246. var strCanonicalizedWord = "";
  247. var nStringLength = 0;
  248. if ((strWord != null) && (strWord.length > 0)){
  249. strCanonicalizedWord = strWord;
  250. strCanonicalizedWord = strCanonicalizedWord.toLowerCase ();
  251. if (similarityMap.GetCount () > 0){
  252. nStringLength = strCanonicalizedWord.length;
  253. for (var index = 0; index < nStringLength; index++){
  254. if (fLettersOnly && !isctype (strCanonicalizedWord.charAt (index), kSmallLetter, kDebugTraceLevelSuperDetail)){
  255. continue;
  256. } else {}
  257. canonicalCounterpart = similarityMap.Lookup (strCanonicalizedWord.charAt (index));
  258. if (canonicalCounterpart != kNoCanonicalCounterpart){
  259. strCanonicalizedWord = strCanonicalizedWord.substring (0, index) + canonicalCounterpart + strCanonicalizedWord.substring (index + 1, nStringLength);
  260. } else {}
  261. }
  262. } else {}
  263. } else {}
  264.  
  265. return strCanonicalizedWord;
  266. }
  267.  
  268. function IsLongEnough (strWord, nAtLeastThisLong){
  269. if ((strWord == null) || isNaN (nAtLeastThisLong)){
  270. return false;
  271. }
  272. else if (strWord.length < nAtLeastThisLong){
  273. return false;
  274. }
  275. else {
  276. return true;
  277. }
  278. }
  279.  
  280. function SpansEnoughCharacterSets (strWord, nAtLeastThisMany){
  281. var nCharSets = 0;
  282. var characterSetChecks = new Array (
  283. new CharacterSetChecks (kCapitalLetter, false),
  284. new CharacterSetChecks (kSmallLetter, false),
  285. new CharacterSetChecks (kDigit, false),
  286. new CharacterSetChecks (kPunctuation, false)
  287. );
  288. if ((strWord == null) || isNaN (nAtLeastThisMany)){
  289. return false;
  290. } else {}
  291. for (var index = 0; index < strWord.length; index++){
  292. for (var nCharSet = 0; nCharSet < characterSetChecks.length;nCharSet++){
  293. if (!characterSetChecks [nCharSet].fResult && isctype (strWord.charAt (index), characterSetChecks [nCharSet].type, kDebugTraceLevelAll)){
  294. characterSetChecks [nCharSet].fResult = true;
  295. break;
  296. } else {}
  297. }
  298. }
  299. for (var nCharSet = 0; nCharSet < characterSetChecks.length; nCharSet++){
  300. if (characterSetChecks [nCharSet].fResult){
  301. nCharSets++;
  302. } else {}
  303. }
  304. if (nCharSets < nAtLeastThisMany){
  305. return false;
  306. } else {}
  307.  
  308. return true;
  309. }
  310.  
  311. function FoundInDictionary (strWord, similarityMap, dictionary){
  312. var strCanonicalizedWord = "";
  313. if ((strWord == null) || (similarityMap == null) || (dictionary == null)){
  314. return true;
  315. } else {}
  316. strCanonicalizedWord = CanonicalizeWord (strWord, similarityMap, kCanonicalizeLettersOnly);
  317. if (dictionary.Lookup (strCanonicalizedWord)){
  318. return true;
  319. } else {}
  320.  
  321. return false;
  322. }
  323.  
  324. function IsCloseVariationOfAWordInDictionary (strWord, threshold, similarityMap, dictionary){
  325. var strCanonicalizedWord = "";
  326. var nMinimumMeaningfulMatchLength = 0;
  327. if ((strWord == null) || isNaN (threshold) || (similarityMap == null) || (dictionary == null)){
  328. return true;
  329. } else {}
  330. strCanonicalizedWord = CanonicalizeWord (strWord, similarityMap, kCananicalizeEverything);
  331. nMinimumMeaningfulMatchLength = Math.floor ((threshold) * strCanonicalizedWord.length);
  332. for (var nSubStringLength = strCanonicalizedWord.length; nSubStringLength >= nMinimumMeaningfulMatchLength; nSubStringLength--){
  333. for (var nSubStringStart = 0; (nSubStringStart + nMinimumMeaningfulMatchLength) < strCanonicalizedWord.length; nSubStringStart++){
  334. var strSubWord = strCanonicalizedWord.substr (nSubStringStart, nSubStringLength);
  335. if (dictionary.Lookup (strSubWord)){
  336. return true;
  337. } else {}
  338. }
  339. }
  340.  
  341. return false;
  342. }
  343.  
  344. function Init (){
  345. gSimilarityMap.Add ('3', 'e');
  346. gSimilarityMap.Add ('x', 'k');
  347. gSimilarityMap.Add ('5', 's');
  348. gSimilarityMap.Add ('$', 's');
  349. gSimilarityMap.Add ('6', 'g');
  350. gSimilarityMap.Add ('7', 't');
  351. gSimilarityMap.Add ('8', 'b');
  352. gSimilarityMap.Add ('|', 'l');
  353. gSimilarityMap.Add ('9', 'g');
  354. gSimilarityMap.Add ('+', 't');
  355. gSimilarityMap.Add ('@', 'a');
  356. gSimilarityMap.Add ('0', 'o');
  357. gSimilarityMap.Add ('1', 'l');
  358. gSimilarityMap.Add ('2', 'z');
  359. gSimilarityMap.Add ('!', 'i');
  360.  
  361. gDictionary.Add (3, "oat|not|ken|keg|ham|hal|gas|cpu|cit|bop|bah".split ("|"));
  362.  
  363. gDictionary.Add (4, "zeus|ymca|yang|yaco|work|word|wool|will|viva|vito|vita|visa|vent|vain|uucp|util|utah|unix|trek|town|torn|tina|time|tier|tied|tidy|tide|thud|test|tess|tech|tara|tape|tapa|taos|tami|tall|tale|spit|sole|sold|soil|soft|sofa|soap|slav|slat|slap|slam|shit|sean|saud|sash|sara|sand|sail|said|sago|sage|saga|safe|ruth|russ|rusk|rush|ruse|runt|rung|rune|rove|rose|root|rick|rich|rice|reap|ream|rata|rare|ramp|prod|pork|pete|penn|penh|pend|pass|pang|pane|pale|orca|open|olin|olga|oldy|olav|olaf|okra|okay|ohio|oath|numb|null|nude|note|nosy|nose|nita|next|news|ness|nasa|mike|mets|mess|math|mash|mary|mars|mark|mara|mail|maid|mack|lyre|lyra|lyon|lynx|lynn|lucy|love|lose|lori|lois|lock|lisp|lisa|leah|lass|lash|lara|lank|lane|lana|kink|keri|kemp|kelp|keep|keen|kate|karl|june|judy|judo|judd|jody|jill|jean|jane|isis|iowa|inna|holm|help|hast|half|hale|hack|gust|gush|guru|gosh|gory|golf|glee|gina|germ|gatt|gash|gary|game|fred|fowl|ford|flea|flax|flaw|finn|fink|film|fill|file|erin|emit|elmo|easy|done|disk|disc|diet|dial|dawn|dave|data|derek|damn|dame|crab|cozy|coke|city|cite|chem|chat|cats|burl|bred|bill|bilk|bile|bike|beth|beta|benz|beau|bath|bass|bart|bank|bake|bait|bail|aria|anne|anna|andy|alex|abcd".split ("|"));
  364.  
  365. gDictionary.Add (5, "yacht|xerox|wilma|willy|wendy|wendi|water|warez|vitro|vital|vitae|vista|visor|vicky|venus|venom|value|ultra|u.s.a|tubas|tress|tramp|trait|tracy|traci|toxic|tiger|tidal|thumb|texas|test2|test1|terse|terry|tardy|tappa|tapis|tapir|taper|tanya|tansy|tammy|tamie|taint|sybil|suzie|susie|susan|super|steph|stacy|staci|spark|sonya|sonia|solar|soggy|sofia|smile|slave|slate|slash|slant|slang|simon|shiva|shell|shark|sharc|shack|scrim|screw|scott|scorn|score|scoot|scoop|scold|scoff|saxon|saucy|satan|sasha|sarah|sandy|sable|rural|rupee|runty|runny|runic|runge|rules|ruben|royal|route|rouse|roses|rolex|robyn|robot|robin|ridge|rhode|revel|renee|ranch|rally|radio|quark|quake|quail|power|polly|polis|polio|pluto|plane|pizza|photo|phone|peter|perry|penna|penis|paula|patty|parse|paris|parch|paper|panic|panel|olive|olden|okapi|oasis|oaken|nurse|notre|notch|nancy|nagel|mouse|moose|mogul|modem|merry|megan|mckee|mckay|mcgee|mccoy|marty|marni|mario|maria|marcy|marci|maint|maine|magog|magic|lyric|lyons|lynne|lynch|louis|lorry|loris|lorin|loren|linda|light|lewis|leroy|laura|later|lasso|laser|larry|ladle|kinky|keyes|kerry|kerri|kelly|keith|kazoo|kayla|kathy|karie|karen|julie|julia|joyce|jenny|jenni|japan|janie|janet|james|irene|inane|impel|idaho|horus|horse|honey|honda|holly|hello|heidi|hasty|haste|hamal|halve|haley|hague|hager|hagen|hades|guest|guess|gucci|group|grahm|gouge|gorse|gorky|glean|gleam|glaze|ghoul|ghost|gauss|gauge|gaudy|gator|gases|games|freer|fovea|float|fiona|finny|filly|field|erika|erica|enter|enemy|empty|emily|email|elmer|ellis|ellen|eight|eerie|edwin|edges|eatme|earth|eager|dulce|donor|donna|diane|diana|delay|defoe|david|danny|daisy|cuzco|cubit|cozen|coypu|coyly|cowry|condo|class|cindy|cigar|chess|cathy|carry|carol|carla|caret|caren|candy|candi|burma|burly|burke|brian|breed|borax|booze|booty|bloom|blood|bitch|bilge|bilbo|betty|beryl|becky|beach|bathe|batch|basic|bantu|banks|banjo|baird|baggy|azure|arrow|array|april|anita|angie|amber|amaze|alpha|alisa|alike|align|alice|alias|album|alamo|aires|admin|adept|adele|addle|addis|added|acura|abyss|abcde|1701d|123go|!@#$%".split ("|"));
  366.  
  367. gDictionary.Add (6, "yankee|yamaha|yakima|y7u8i9|xyzxyz|wombat|wizard|wilson|willie|weenie|warren|visual|virgin|viking|venous|venice|venial|vasant|vagina|ursula|urchin|uranus|uphill|umpire|u.s.a.|tuttle|trisha|trails|tracie|toyota|tomato|toggle|tidbit|thorny|thomas|terror|tennis|taylor|target|tardis|tappet|taoist|tannin|tanner|tanker|tamara|system|surfer|summer|subway|stacie|stacey|spring|sondra|solemn|soleil|solder|solace|soiree|soften|soffit|sodium|sodden|snoopy|snatch|smooch|smiles|slavic|slater|single|singer|simple|sherri|sharon|sharks|sesame|sensor|secret|second|season|search|scroll|scribe|scotty|scooby|schulz|school|scheme|saturn|sandra|sandal|saliva|saigon|sahara|safety|safari|sadism|saddle|sacral|russel|runyon|runway|runoff|runner|ronald|romano|rodent|ripple|riddle|ridden|reveal|return|remote|recess|recent|realty|really|reagan|raster|rascal|random|radish|radial|racoon|racket|racial|rachel|rabbit|qwerty|qawsed|puppet|puneet|public|prince|presto|praise|poster|polite|polish|policy|police|plover|pierre|phrase|photon|philip|persia|peoria|penmen|penman|pencil|peanut|parrot|parent|pardon|papers|pander|pamela|pallet|palace|oxford|outlaw|osiris|orwell|oregon|oracle|olivia|oliver|olefin|office|notion|notify|notice|notate|notary|noreen|nobody|nicole|newton|nevada|mutant|mozart|morley|monica|moguls|minsky|mickey|merlin|memory|mellon|meagan|mcneil|mcleod|mclean|mckeon|mchugh|mcgraw|mcgill|mccann|mccall|mccabe|mayfly|maxine|master|massif|maseru|marvin|markus|malcom|mailer|maiden|magpie|magnum|magnet|maggot|lorenz|lisbon|limpid|leslie|leland|latest|latera|latent|lascar|larkin|langur|landis|landau|lambda|kristy|kristi|krista|knight|kitten|kinney|kerrie|kernel|kermit|kennan|kelvin|kelsey|kelley|keller|keenan|katina|karina|kansas|juggle|judith|jsbach|joshua|joseph|johnny|joanne|joanna|jixian|jimmie|jimbob|jester|jeanne|jasmin|janice|jaguar|jackie|island|invest|instar|ingrid|ingres|impute|holmes|holman|hockey|hidden|hawaii|hasten|harvey|harold|hamlin|hamlet|halite|halide|haggle|haggis|hadron|hadley|hacker|gustav|gusset|gurkha|gurgle|guntis|guitar|gamlyn|gospel|gorton|gorham|gorges|golfer|glassy|ginger|gibson|ghetto|german|george|gauche|gasify|gambol|gamble|gambit|friend|freest|fourth|format|flower|flaxen|flaunt|flakes|finley|finite|fillip|fillet|filler|filled|fermat|fender|fatten|fatima|fathom|father|evelyn|euclid|estate|enzyme|engine|employ|emboss|elanor|elaine|eileen|eighty|eighth|effect|efface|eeyore|eerily|edwina|easier|durkin|durkee|during|durham|duress|duncan|donner|donkey|donate|donald|domino|disney|dieter|device|denise|deluge|delete|debbie|deaden|ddurer|dapper|daniel|dancer|damask|dakota|daemon|cuvier|cuddly|cuddle|cuckoo|cretin|create|cozier|coyote|cowpox|cooper|cookie|connie|coneck|condom|coffee|citrus|citron|citric|circus|charon|change|censor|cement|celtic|cecily|cayuga|catnip|catkin|cation|castle|carson|carrot|carrie|carole|carmen|caress|cantor|burley|burlap|buried|burial|brenda|bremen|breezy|breeze|breech|brandy|brandi|border|borden|borate|bloody|bishop|bilbao|bikini|bigred|betsie|berman|berlin|bedbug|became|beavis|beaver|beauty|beater|batman|bathos|barony|barber|baobab|bantus|banter|bantam|banish|bangui|bangor|bangle|bandit|banana|bakery|bailey|bahama|bagley|badass|aztecs|azsxdc|athena|asylum|arthur|arrest|arrear|arrack|arlene|anvils|answer|angela|andrea|anchor|analog|amazon|amanda|alison|alight|alicia|albino|albert|albeit|albany|alaska|adrian|adelia|adduce|addict|addend|accrue|access|abcdef|abcabc|abc123|a1b2c3|a12345|@#$%^&|7y8u9i|1qw23e|1q2w3e|1p2o3i|1a2b3c|123abc|10sne1|0p9o8i|!@#$%^".split ("|"));
  368.  
  369. gDictionary.Add (7, "yolanda|wyoming|winston|william|whitney|whiting|whatnot|vitriol|vitrify|vitiate|vitamin|visitor|village|vertigo|vermont|venturi|venture|ventral|venison|valerie|utility|upgrade|unknown|unicorn|unhappy|trivial|torrent|tinfoil|tiffany|tidings|thunder|thistle|theresa|test123|terrify|teleost|tarbell|taproot|tapping|tapioca|tantrum|tantric|tanning|takeoff|swearer|suzanne|susanne|support|success|student|squires|sossina|soldier|sojourn|soignee|sodding|smother|slavish|slavery|slander|shuttle|shivers|shirley|sheldon|shannon|service|seattle|scooter|scissor|science|scholar|scamper|satisfy|sarcasm|salerno|sailing|saguaro|saginaw|sagging|saffron|sabrina|russell|rupture|running|runneth|rosebud|receipt|rebecca|realtor|raleigh|rainbow|quarrel|quality|qualify|pumpkin|protect|program|profile|profess|profane|private|prelude|porsche|politic|playboy|phoenix|persona|persian|perseus|perseid|perplex|penguin|pendant|parapet|panoply|panning|panicle|panicky|pangaea|pandora|palette|pacific|olivier|olduvai|oldster|okinawa|oakwood|nyquist|nursery|numeric|number1|nullify|nucleus|nuclear|notused|nothing|newyork|network|neptune|montana|minimum|michele|michael|merriam|mercury|melissa|mcnulty|mcnally|mcmahon|mckenna|mcguire|mcgrath|mcgowan|mcelroy|mcclure|mcclain|mccarty|mcbride|mcadams|mbabane|mayoral|maurice|marimba|manhole|manager|mammoth|malcolm|malaria|mailbox|magnify|magneto|losable|lorinda|loretta|lorelei|lockout|lioness|limpkin|library|lazarus|lathrop|lateran|lateral|kristin|kristie|kristen|kinsman|kingdom|kennedy|kendall|kellogg|keelson|katrina|jupiter|judaism|judaica|jessica|janeiro|inspire|inspect|insofar|ingress|indiana|include|impetus|imperil|holmium|holmdel|herbert|heather|headmen|headman|harmony|handily|hamburg|halifax|halibut|halfway|haggard|hafnium|hadrian|gustave|gunther|gunshot|gryphon|gosling|goshawk|gorilla|gleason|glacier|ghostly|germane|georgia|geology|gaseous|gascony|gardner|gabriel|freeway|fourier|flowers|florida|fishers|finnish|finland|ferrari|felicia|feather|fatigue|fairway|express|expound|emulate|empress|empower|emitted|emerald|embrace|embower|ellwood|ellison|egghead|durward|durrell|drought|donning|donahue|digital|develop|desiree|default|deborah|damming|cynthia|cyanate|cutworm|cutting|cuddles|cubicle|crystal|coxcomb|cowslip|cowpony|cowpoke|console|conquer|connect|comrade|compton|collins|cluster|claudia|classic|citroen|citrate|citizen|citadel|cistern|christy|chester|charles|charity|celtics|celsius|catlike|cathode|carroll|carrion|careful|carbine|carbide|caraway|caravan|camille|burmese|burgess|bridget|breccia|bradley|bopping|blondie|bilayer|beverly|bernard|bermuda|berlitz|berlioz|beowulf|beloved|because|beatnik|beatles|beatify|bassoon|bartman|baroque|barbara|baptism|banshee|banquet|bannock|banning|bananas|bainite|bailiff|bahrein|bagpipe|baghdad|bagging|bacchus|asshole|arrange|arraign|arragon|arizona|ariadne|annette|animals|anatomy|anatole|amatory|amateur|amadeus|allison|alimony|aliases|algebra|albumin|alberto|alberta|albania|alameda|aladdin|alabama|airport|airpark|airfoil|airflow|airfare|airdrop|adenoma|adenine|address|addison|accrual|acclaim|academy|abcdefg|!@#$%^&".split ("|"));
  370.  
  371. gDictionary.Add (8, "yosemite|y7u8i9o0|wormwood|woodwind|whistler|whatever|warcraft|vitreous|virginia|veronica|venomous|trombone|transfer|tortoise|tientsin|tideland|ticklish|thailand|testtest|tertiary|terrific|terminal|telegram|tarragon|tapeworm|tapestry|tanzania|tantalus|tantalum|sysadmin|symmetry|sunshine|strangle|startrek|springer|sparrows|somebody|solecism|soldiery|softwood|software|softball|socrates|slatting|slapping|slapdash|slamming|simpsons|serenity|security|schwartz|sanctity|sanctify|samantha|salesman|sailfish|sailboat|sagittal|sagacity|sabotage|rushmore|rosemary|rochelle|robotics|reverend|regional|raindrop|rachelle|qwertyui|qwerasdf|qawsedrf|q1w2e3r4|protozoa|prodding|princess|precious|politics|politico|plymouth|pershing|penitent|penelope|pendulum|patricia|password|passport|paranoia|panorama|panicked|pandemic|pandanus|pakistan|painless|operator|olivetti|oleander|oklahoma|notocord|notebook|notarize|nebraska|napoleon|missouri|michigan|michelle|mesmeric|mercedes|mcmullen|mcmillan|mcknight|mckinney|mckinley|mckesson|mckenzie|mcintyre|mcintosh|mcgregor|mcgovern|mcginnis|mcfadden|mcdowell|mcdonald|mcdaniel|mcconnel|mccauley|mccarthy|mccallum|mayapple|masonite|maryland|marjoram|marinate|marietta|maneuver|mandamus|maledict|maladapt|magnuson|magnolia|magnetic|lyrebird|lymphoma|lorraine|lionking|linoleum|limitate|limerick|laterite|landmass|landmark|landlord|landlady|landhold|landfill|kristine|kirkland|kingston|kimberly|khartoum|keystone|kentucky|keeshond|kathrine|kathleen|jubilant|joystick|jennifer|jacobsen|irishman|interpol|internet|insulate|instinct|instable|insomnia|insolent|insolate|inactive|imperial|iloveyou|illinois|hydrogen|hutchins|homework|hologram|holocene|hibernia|hiawatha|heinlein|hebrides|headlong|headline|headland|hastings|hamilton|halftone|halfback|hagstrom|gunsling|gunpoint|gumption|gorgeous|glaucous|glaucoma|glassine|ginnegan|ghoulish|gertrude|geometry|geometer|garfield|gamesman|gamecock|fungible|function|frighten|freetown|foxglove|fourteen|foursome|forsythe|football|flaxseed|flautist|flatworm|flatware|fidelity|exposure|eternity|enthrone|enthrall|enthalpy|entendre|entangle|engineer|emulsion|emulsify|emporium|employer|employee|employed|emmanuel|elliptic|elephant|einstein|eighteen|duration|donnelly|dominion|dlmhurst|delegate|delaware|december|deadwood|deadlock|deadline|deadhead|danielle|cyanamid|cucumber|cristina|criminal|creosote|creation|cowpunch|couscous|conquest|comrades|computer|comprise|compress|colorado|clusters|citation|charming|cerulean|cenozoic|cemetery|cellular|catskill|cationic|catholic|cathodic|catheter|cascades|carriage|caroline|carolina|carefree|cardinal|burgundy|burglary|bumbling|broadway|breeches|bordello|bordeaux|bilinear|bilabial|bernardo|berliner|berkeley|bedazzle|beaumont|beatrice|beatific|bathrobe|baronial|baritone|bankrupt|banister|bakelite|azsxdcfv|asdfqwer|arkansas|appraise|apposite|anything|angerine|ancestry|ancestor|anatomic|anathema|ambiance|alphabet|albright|albrecht|alberich|albacore|alastair|alacrity|airspace|airplane|airfield|airedale|aircraft|airbrush|airborne|aerobics|adrianna|adelaide|additive|addition|addendum|accouter|academic|academia|abcdefgh|abcd1234|a1b2c3d4|7y8u9i0o|7890yuio|1234qwer|0p9o8i7u|0987poiu|!@#$%^&*".split ("|"));
  372.  
  373. gDictionary.Add (9, "zimmerman|worldwide|wisconsin|wholesale|vitriolic|ventricle|ventilate|valentine|tidewater|testament|territory|tennessee|telephone|telepathy|teleology|telemetry|telemeter|telegraph|tarantula|tarantara|tangerine|supported|superuser|stuttgart|stratford|stephanie|solemnity|softcover|slaughter|slapstick|signature|sheffield|sarcastic|sanctuary|sagebrush|sagacious|runnymede|rochester|receptive|reception|racketeer|professor|princeton|pondering|politburo|policemen|policeman|persimmon|persevere|persecute|percolate|peninsula|penetrate|pendulous|paralytic|panoramic|panicking|panhandle|oligopoly|oligocene|oligarchy|olfactory|oldenburg|nutrition|nurturant|notorious|notoriety|minnesota|microsoft|mcpherson|mcfarland|mcdougall|mcdonnell|mcdermott|mccracken|mccormick|mcconnell|mccluskey|mcclellan|marijuana|malicious|magnitude|magnetron|magnetite|macintosh|lynchburg|louisiana|lissajous|limousine|limnology|landscape|landowner|kinshasha|kingsbury|kibbutzim|kennecott|jamestown|ironstone|invisible|invention|intuitive|intervene|intersect|inspector|insomniac|insolvent|insoluble|impetuous|imperious|imperfect|holocaust|hollywood|hollyhock|headphone|headlight|headdress|headcount|headboard|happening|hamburger|halverson|gustafson|gunpowder|glasswort|glassware|ghostlike|geometric|gaucherie|freewheel|freethink|freestone|foresight|foolproof|extension|expositor|establish|entertain|employing|emittance|ellsworth|elizabeth|eightieth|eightfold|eiderdown|dusenbury|dusenberg|donaldson|dominique|discovery|desperate|delegable|delectate|decompose|decompile|damnation|cutthroat|crabapple|cornelius|conqueror|connubial|commrades|citizenry|christine|christina|chemistry|cellulose|celluloid|catherine|carryover|burlesque|bloodshot|bloodshed|bloodroot|bloodline|bloodbath|bilingual|bilateral|bijective|bijection|bernadine|berkshire|beethoven|beatitude|bakhtiari|asymptote|asymmetry|apprehend|appraisal|apportion|ancestral|anatomist|alexander|albatross|alabaster|alabamian|adenosine|abcabcabc".split ("|"));
  374.  
  375. gDictionary.Add (10, "washington|volkswagen|topography|tessellate|temptation|telephonic|telepathic|telemetric|telegraphy|tantamount|superstage|slanderous|salamander|qwertyuiop|polynomial|politician|phrasemake|photometry|photolytic|photolysis|photogenic|phosphorus|phosphoric|persiflage|persephone|perquisite|peninsular|penicillin|penetrable|panjandrum|oligoclase|oligarchic|oldsmobile|nottingham|noticeable|noteworthy|mcnaughton|mclaughlin|mccullough|mcallister|malconduct|maidenhair|limitation|lascivious|landowning|landlubber|landlocked|lamination|khrushchev|juggernaut|irrational|invariable|insouciant|insolvable|incomplete|impervious|impersonal|headmaster|glaswegian|geopolitic|geophysics|fourteenth|foursquare|expressive|expression|expository|exposition|enterprise|eightyfold|eighteenth|effaceable|donnybrook|delectable|decolonize|cuttlefish|cuttlebone|compromise|compressor|comprehend|cellophane|carruthers|california|burlington|burgundian|borderline|borderland|bloodstone|bloodstain|bloodhound|bijouterie|biharmonic|bernardino|beaujolais|basketball|bankruptcy|bangladesh|atmosphere|asymptotic|asymmetric|appreciate|apposition|ambassador|amateurish|alimentary|additional|accomplish|1q2w3e4r5t".split ("|"));
  376.  
  377. gDictionary.Add (11, "yellowstone|venturesome|territorial|telekinesis|sagittarius|safekeeping|politicking|policewoman|photometric|photography|phosphorous|perseverant|persecutory|persecution|penitential|pandemonium|mississippi|marketplace|magnificent|irremovable|interrogate|institution|inspiration|incompetent|impertinent|impersonate|impermeable|headquarter|hamiltonian|halfhearted|hagiography|geophysical|expressible|emptyhanded|eigenvector|deleterious|decollimate|decolletage|connecticut|comptroller|compressive|compression|catholicism|bloodstream|bakersfield|arrangeable|appreciable|anastomotic|albuquerque".split ("|"));
  378.  
  379. gDictionary.Add (12, "williamsburg|testamentary|qwerasdfzxcv|q1w2e3r4t5y6|perseverance|pennsylvania|penitentiary|malformation|liquefaction|interstitial|inconclusive|incomputable|incompletion|incompatible|incomparable|imperishable|impenetrable|headquarters|geometrician|ellipsometry|decomposable|decommission|compressible|burglarproof|bloodletting|bilharziasis|asynchronous|asymptomatic|ambidextrous|1q2w3e4r5t6y".split ("|"));
  380.  
  381. gDictionary.Add (13, "ventriloquist|ventriloquism|poliomyelitis|phosphorylate|oleomargarine|massachusetts|jitterbugging|interpolatory|inconceivable|imperturbable|impermissible|decomposition|comprehensive|comprehension".split ("|"));
  382.  
  383. gDictionary.Add (14, "slaughterhouse|irreproducible|incompressible|comprehensible|bremsstrahlung".split ("|"));
  384.  
  385. gDictionary.Add (15, "irreconciliable|instrumentation|incomprehension".split ("|"));
  386.  
  387. gDictionary.Add (16, "incomprehensible".split ("|"));
  388. }
  389.  
  390. function ClientSideStrongPassword (){
  391. return (IsLongEnough (ClientSideStrongPassword.arguments [0], "8") && SpansEnoughCharacterSets (ClientSideStrongPassword.arguments [0], "3") && (! (IsCloseVariationOfAWordInDictionary (ClientSideStrongPassword.arguments [0], "0.6", ClientSideStrongPassword.arguments [1], ClientSideStrongPassword.arguments [2]))));
  392. }
  393.  
  394. function ClientSideBestPassword (){
  395. return (IsLongEnough (ClientSideBestPassword.arguments [0], "14") && SpansEnoughCharacterSets (ClientSideBestPassword.arguments [0], "3") && (! (IsCloseVariationOfAWordInDictionary (ClientSideBestPassword.arguments [0], "0.6", ClientSideBestPassword.arguments [1], ClientSideBestPassword.arguments [2]))));
  396. }
  397.  
  398. function ClientSideMediumPassword (){
  399. return (IsLongEnough (ClientSideMediumPassword.arguments [0], "8") && SpansEnoughCharacterSets (ClientSideMediumPassword.arguments [0], "2") && (! (FoundInDictionary (ClientSideMediumPassword.arguments [0], ClientSideMediumPassword.arguments [1], ClientSideMediumPassword.arguments [2]))));
  400. }
  401.  
  402. function ClientSideWeakPassword (){
  403. return (IsLongEnough (ClientSideWeakPassword.arguments [0], "1") || (! (IsLongEnough (ClientSideWeakPassword.arguments [0], "0"))));
  404. }
  405.  
  406. function GEId (sID){
  407. return document.getElementById (sID);
  408. }
  409.  
  410. function EvalPwdStrength (sP){
  411. if (ClientSideBestPassword (sP,gSimilarityMap,gDictionary)){
  412. DispPwdStrength (4,'pwdCheckCase4');
  413. }
  414. else if (ClientSideStrongPassword (sP,gSimilarityMap,gDictionary)){
  415. DispPwdStrength (3,'pwdCheckCase3');
  416. }
  417. else if (ClientSideMediumPassword (sP,gSimilarityMap,gDictionary)){
  418. DispPwdStrength (2,'pwdCheckCase2');
  419. }
  420. else if (ClientSideWeakPassword (sP,gSimilarityMap,gDictionary)){
  421. DispPwdStrength (1,'pwdCheckCase1');
  422. }
  423. else{
  424. DispPwdStrength (0,'pwdCheckCase0');
  425. }
  426. }
  427.  
  428. function DispPwdStrength (iN,sHL){
  429. if (iN > 4){
  430. iN = 4;
  431. } else {}
  432. for (var i = 0; i < 5; i++){
  433. var sHCR = "pwdCheckCase0";
  434. if (i <= iN){
  435. sHCR = sHL;
  436. } else {}
  437. if (i > 0){
  438. GEId ("idSM" + i).className = sHCR;
  439. } else {}
  440. GEId ("pdw_check_msg" + i).style.display = ((i == iN) ? "inline" : "none");
  441. }
  442. }
  443.  
  444. function ToggleObject (object, mode){
  445. for (var ol = 0; ol < object.length; ++ol){
  446. theObject = document.getElementById (object [ol]);
  447. theObject.style.visibility = mode;
  448. }
  449. }
  450. -->
  451. </script>
  452. </head>
  453. <body>
  454. <table style=" width: 100%; height: 100%">
  455. <tr>
  456. <td style=" width: 100%; height: 100%; text-align: center; vertical-align: middle; font-weight: bold"><table style=" width: 350px; border: 2px outset #CCCCCC;" cellspacing="0" align="center" id="pwdcheckTableOuter">
  457. <tr>
  458. <td style=" color: #FFFFFF; height: 21px; background: #336699; text-align: right;"><div class="buttons" onclick="ToggleObject (new Array ('pwdcheckTableInner'), 'hidden')">[_]</div>
  459. <div class="buttons" onclick="ToggleObject (new Array ('pwdcheckTableInner'), 'visible')">[o]</div>
  460. <div class="buttons" onclick="ToggleObject (new Array ('pwdcheckTableOuter', 'pwdcheckTableInner'), 'hidden')">[X]</div>
  461. </td>
  462. </tr>
  463. </table>
  464. <table style=" width: 350px; border: 2px outset #CCCCCC;" cellspacing="0" align="center" id="pwdcheckTableInner">
  465. <tr>
  466. <td style="background: #EEEEEE"><table border="0" cellpadding="0" cellspacing="0" class="pwdCheckTable">
  467. <tr>
  468. <td align="right" nowrap="nowrap" class="pwdCheckLabelCell">Password:</td>
  469. <td valign="top" nowrap="nowrap" class="pwdCheckDataCell"><input name="pdwCheck_pw" type="password" id="inputPC" autocomplete="off" value="" onkeyup="EvalPwdStrength(this.value);" />
  470. <br /></td>
  471. </tr>
  472. <tr>
  473. <td align="right" nowrap="nowrap" class="pwdCheckLabelCell">Strength:</td>
  474. <td valign="top" nowrap="nowrap" class="pwdCheckDataCell"><table cellpadding="0" cellspacing="0" class="pwdCheckInnerTable">
  475. <tr>
  476. <td id="idSM1" width="25%" class="pwdCheckCase0" align="center"><span id="pdw_check_msg1" style="display:none;">Weak</span></td>
  477. <td id="idSM2" width="25%" class="pwdCheckCase0" align="center" style="border-left:solid 1px #FFFFFF"><span id="pdw_check_msg0" style="display:inline;font-weight:normal;color:#666">No rating</span><span id="pdw_check_msg2" style="display:none;">Medium</span></td>
  478. <td id="idSM3" width="25%" class="pwdCheckCase0" align="center" style="border-left:solid 1px #FFFFFF"><span id="pdw_check_msg3" style="display:none;">Strong</span></td>
  479. <td id="idSM4" width="25%" class="pwdCheckCase0" align="center" style="border-left:solid 1px #FFFFFF"><span id="pdw_check_msg4" style="display:none;">BEST</span></td>
  480. </tr>
  481. </table></td>
  482. </tr>
  483. </table></td>
  484. </tr>
  485. </table></td>
  486. </tr>
  487. </table>
  488. </body>
  489. </html>

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: hlongmore on August 17, 2011

See http://snipplr.com/view/57898/password-strength-checker/ for a Python implementation/modification of the JavaScript.

You need to login to post a comment.