{"id":217,"date":"2017-05-28T11:54:02","date_gmt":"2017-05-28T15:54:02","guid":{"rendered":"http:\/\/www.unliterate.net\/?p=217"},"modified":"2017-05-28T12:53:46","modified_gmt":"2017-05-28T16:53:46","slug":"wordlock-easy-to-set-never-forget","status":"publish","type":"post","link":"https:\/\/www.unliterate.net\/index.php\/2017\/05\/28\/wordlock-easy-to-set-never-forget\/","title":{"rendered":"WordLock&#8230; Easy to set, never forget."},"content":{"rendered":"<p>So, I have one of these WordLock bicycle locks, and it was cool to learn how to set it up and change the combination.<\/p>\n<p>The only problem is: I forgot what we set the combination to. #sadface<\/p>\n<p>So, without further ado,\u00a0<em>to programming!<\/em><\/p>\n<h2>The Scenario:<\/h2>\n<p>Lets assume for a moment we know two things:<\/p>\n<ol>\n<li>We know there are 10,000 combinations, and that the combination that\u00a0it is set to is a word in the english language.<\/li>\n<li>We have a good understanding of what the word might be if we saw it.<\/li>\n<\/ol>\n<p>So, with those facts, we&#8217;ll need two things:<\/p>\n<ol>\n<li>A list of 4-letter words, which we&#8217;ll steal *cough* borrow from <a href=\"http:\/\/www.litscape.com\/words\/length\/4_letters\/4_letter_words.html\">litscape.com<\/a><\/li>\n<li>Some programming that goes through every combination possible and compares it to the wordlist<\/li>\n<\/ol>\n<p>So, the programming:<\/p>\n<pre>&lt;?php\r\n\r\nfunction make4($number)\r\n{\r\n        $num = intval($number);\r\n        if (($num &lt; 0) || ($num &gt; 9999))\r\n        {\r\n                die(\"out of range\");\r\n        }\r\n        $ret = \"\";\r\n\r\n        if (strlen($num) == 4)\r\n        {\r\n                $ret = $num;\r\n        }\r\n        if (strlen($num) == 3)\r\n        {\r\n                $ret = \"0${num}\";\r\n        }\r\n        if (strlen($num) == 2)\r\n        {\r\n                $ret = \"00${num}\";\r\n        }\r\n        if (strlen($num) == 1)\r\n        {\r\n                $ret = \"000${num}\";\r\n        }\r\n        return $ret;\r\n}\r\n\r\nfunction combination($number)\r\n{\r\n        $letters = array(\r\n                array('B', 'F', 'R', 'M', 'D', 'T', 'S', 'W', 'P', 'L'),\r\n                array('Y', 'R', 'W', 'H', 'E', 'L', 'O', 'I', 'A', 'U'),\r\n                array('S', 'N', 'T', 'M', 'R', 'E', 'L', 'A', 'O', 'K'),\r\n                array('E', 'T', 'S', 'M', 'K', 'G', 'D', 'L', 'Y', 'P'),\r\n        );\r\n        $code = \"\";\r\n        $combo = make4($number);\r\n        for ($x = 0; $x &lt; 4; $x++)\r\n        {\r\n                $digit = substr($combo, $x, 1);\r\n                $letter = $letters[$x][$digit];\r\n                $code .= $letter;\r\n        }\r\n        return $code;\r\n}\r\n\r\n$words = \"\";\r\ninclude('words4.php');\r\n$word = explode(' ', $words);\r\necho \"Loaded \" . count($word) . \" words\\n\";\r\n\r\nforeach ($word as $w)\r\n{\r\n        $possible = strtoupper($w);\r\n        echo \"Trying: $possible\\n\";\r\n        for ($x = 0; $x &lt; 10000; $x++)\r\n        {\r\n                $code = combination($x);\r\n                if ($code == $possible)\r\n                {\r\n                        echo \"Found: $possible\\n\";\r\n                }\r\n        }\r\n}\r\n?&gt;\r\n<\/pre>\n<p>I&#8217;ve take the space-separated wordlist and saved it as an assignment to the $words variable in a separate file. vim doesn&#8217;t do justice with\u00a0multi-lined non-carriage returned stuff, so I&#8217;m cool with that.<\/p>\n<p>After executing the above, from a wordlist of 2404 items, i&#8217;m left with 732 <em>possible<\/em>\u00a0items.<\/p>\n<p>It is going to be a looooooooooooooooong day \ud83d\ude41<\/p>\n<p>BAAS, BAKE, BALD, BALE, BALK, BALL, BALM, BAND, BANE, BANG, BANK, BANS, BARD, BARE, BARK, BARM, BARS, BASE, BASK, BASS, BATS, BEAD, BEAK, BEAM, BEAT, BEEP, BEES, BEET, BELL, BELT, BEND, BENT, BERK, BERM, BEST, BETS, BIAS, BIKE, BILE, BILK, BILL, BIND, BINS, BIOS, BIRD, BITE, BITS, BITT, BLAT, BLED, BLOG, BLOT, BOAS, BOAT, BOLD, BOLL, BOLT, BOND, BONE, BONK, BONY, BOOK, BOOM, BOOS, BOOT, BORE, BOSS, BOTS, BRAD, BRAG, BRAS, BRAT, BRAY, BRED, BULK, BULL, BUMP, BUMS, BUNK, BUNS, BUNT, BUOY, BURL, BURP, BURS, BURY, BUSK, BUST, BUSY, BUTS, BUTT, BYES, BYTE, DAME, DAMP, DAMS, DANK, DARE, DARK, DART, DATE, DEAD, DEAL, DEED, DEEM, DEEP, DEES, DELE, DELL, DEME, DEMY, DENE, DENS, DENT, DENY, DERE, DERM, DESK, DIAL, DIED, DIES, DIET, DILL, DIME, DIMS, DINE, DING, DINS, DIRE, DIRT, DISK, DOES, DOLE, DOLL, DOLT, DOME, DONE, DONS, DOOM, DORK, DORM, DOSE, DOTE, DOTS, DOTY, DRAG, DRAM, DREG, DROP, DUAL, DUEL, DUES, DUET, DUKE, DULL, DULY, DUMP, DUNE, DUNG, DUNK, DUOS, DUSK, DUST, DUTY, DYED, DYES, DYNE, FAKE, FALL, FAME, FANG, FANS, FARE, FARM, FAST, FATE, FATS, FEAT, FEED, FEEL, FEES, FEET, FELL, FELT, FEND, FENS, FILE, FILL, FILM, FIND, FINE, FINK, FINS, FIRE, FIRM, FIRS, FIST, FITS, FLAG, FLAP, FLAT, FLAY, FLED, FLEE, FLOE, FLOG, FLOP, FOAL, FOAM, FOES, FOLD, FOLK, FOND, FONT, FOOD, FOOL, FOOT, FORE, FORK, FORM, FORT, FRAY, FREE, FRET, FROG, FROM, FUEL, FULL, FUME, FUMY, FUND, FUNK, FURS, FURY, FUSE, FUSS, LAKE, LAME, LAMP, LAND, LANE, LANK, LARD, LARK, LASS, LAST, LATE, LEAD, LEAK, LEAP, LEAS, LEEK, LEES, LEKS, LEND, LENS, LENT, LESS, LEST, LETS, LIED, LIES, LIKE, LILY, LIME, LIMP, LIMY, LINE, LINK, LINT, LIRE, LISP, LIST, LITE, LOAD, LOAM, LOLL, LONE, LONG, LOOK, LOOM, LOOP, LOOS, LOOT, LORD, LORE, LOSE, LOSS, LOST, LOTS, LULL, LUMP, LUNG, LURE, LURK, LUST, LUTE, LYRE, MAKE, MALE, MALL, MALT, MANE, MANS, MANY, MARE, MARK, MARL, MARS, MART, MASK, MASS, MAST, MATE, MATS, MATT, MEAD, MEAL, MEAT, MEEK, MEET, MELD, MELT, MEME, MEND, MENS, MERE, MESS, MILD, MILE, MILK, MILL, MILS, MIME, MIND, MINE, MINK, MINT, MIRE, MISS, MIST, MITE, MITT, MOAT, MOLD, MOLE, MOLT, MOMS, MONK, MOOD, MOOS, MOOT, MORE, MOSS, MOST, MULE, MULL, MUMS, MURK, MUSE, MUSK, MUST, MUTE, MUTT, PALE, PALL, PALM, PALS, PANE, PANG, PANS, PANT, PARE, PARK, PARS, PART, PASS, PAST, PATE, PATS, PEAK, PEAL, PEAS, PEAT, PEEK, PEEL, PEEP, PELT, PEND, PENS, PENT, PERK, PERM, PERT, PEST, PETS, PIED, PIES, PIKE, PILE, PILL, PIMP, PINE, PING, PINK, PINS, PINT, PITS, PITY, PLAY, PLED, PLOD, PLOP, PLOT, PLOY, POEM, POET, POKE, POKY, POLE, POLL, POMP, POND, PONY, POOL, POOP, PORE, PORK, PORT, POSE, POST, POSY, POTS, PRAM, PRAY, PREP, PREY, PROD, PROM, PROP, PROS, PUKE, PULL, PULP, PUMP, PUNK, PUNS, PUNT, PUNY, PURE, PUTS, PUTT, PYRE, RAKE, RAMP, RAMS, RAND, RANG, RANK, RANT, RARE, RASP, RATE, RATS, READ, REAK, REAL, REAM, REAP, REED, REEK, REEL, RELY, REND, RENT, REST, RHOS, RIAL, RIEL, RILE, RILL, RILY, RIME, RIMS, RIND, RING, RINK, RIOT, RISE, RISK, RITE, ROAD, ROAM, ROES, ROLE, ROLL, ROMP, ROOD, ROOK, ROOM, ROOT, ROSE, ROSY, ROTE, ROTS, RUED, RUES, RULE, RUMS, RUNE, RUNG, RUNS, RUNT, RUSE, RUST, RUTS, SAKE, SALE, SALT, SAME, SAND, SANE, SANG, SANK, SASS, SATE, SEAL, SEAM, SEAS, SEAT, SEED, SEEK, SEEM, SEEP, SEES, SELL, SEND, SENT, SERE, SETS, SHAM, SHED, SHOE, SHOP, SHOT, SILK, SILL, SILT, SINE, SING, SINK, SINS, SIRE, SIRS, SITE, SITS, SLAM, SLAP, SLAT, SLAY, SLED, SLOE, SLOG, SLOP, SLOT, SOAK, SOAP, SOLD, SOLE, SOME, SOMS, SONG, SONS, SOOT, SORE, SORT, SOTS, SUED, SUES, SUET, SULK, SUMP, SUMS, SUNG, SUNK, SUNS, SURE, SWAG, SWAM, SWAP, SWAT, SWAY, TAKE, TALE, TALK, TALL, TAME, TAMP, TAMS, TANK, TANS, TARE, TARP, TARS, TART, TASK, TEAK, TEAL, TEAM, TEAS, TEED, TEEM, TEES, TELL, TEND, TENS, TENT, TERM, TEST, THAT, THEE, THEM, THEY, TIED, TIES, TIKE, TILE, TILL, TILT, TIME, TINE, TING, TINS, TINT, TINY, TIRE, TOAD, TOED, TOES, TOLD, TOLL, TOME, TONE, TONG, TONS, TOOK, TOOL, TOOT, TORE, TORT, TOSS, TOTE, TOTS, TRAM, TRAP, TRAY, TREE, TREK, TROD, TROT, TROY, TUMS, TUNE, TUSK, TWOS, TYKE, WAKE, WALK, WALL, WAND, WANE, WANT, WARD, WARE, WARM, WARP, WARS, WART, WARY, WASP, WATT, WEAK, WEED, WEEK, WEEP, WELD, WELL, WELT, WEND, WENT, WERE, WEST, WETS, WHAM, WHAT, WHET, WHEY, WHOM, WHOP, WILD, WILE, WILL, WILT, WILY, WIMP, WIND, WINE, WING, WINK, WINS, WIRE, WIRY, WISE, WISP, WIST, WITS, WOAD, WOES, WOKE, WOKS, WONS, WONT, WOOD, WOOL, WOOS, WORD, WORE, WORK, WORM, WORT, WRAP, WYES<\/p>\n<p><strong>Edit:<\/strong><\/p>\n<p>For the sake of justice, none of the above words looked familiar.<\/p>\n<p>I headed over to the <a href=\"http:\/\/wordlock.com\/customer_service\/faq\/\">wordlock FAQ<\/a>\u00a0and did the following:<\/p>\n<blockquote><p><b>I can&#8217;t open my lock. What combination does my lock open to?<\/b><br \/>\nTry of the following factory-set default combinations to open your lock: BOLT, SPELL, PACK, SHED, TREE, GYMS, WORDS.<\/p><\/blockquote>\n<p>Seems the factory default worked, which means <em>I NEVER SET THE DAMN LOCK IN THE FIRST PLACE<\/em> :\/<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So, I have one of these WordLock bicycle locks, and it was cool to learn how to set it up and change the combination. The only problem is: I forgot what we set the combination to. #sadface So, without further ado,\u00a0to programming! The Scenario: Lets assume for a moment we know two things: We know [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20,16],"tags":[],"class_list":["post-217","post","type-post","status-publish","format-standard","hentry","category-geek-instructions","category-pain"],"_links":{"self":[{"href":"https:\/\/www.unliterate.net\/index.php\/wp-json\/wp\/v2\/posts\/217","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.unliterate.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.unliterate.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.unliterate.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.unliterate.net\/index.php\/wp-json\/wp\/v2\/comments?post=217"}],"version-history":[{"count":3,"href":"https:\/\/www.unliterate.net\/index.php\/wp-json\/wp\/v2\/posts\/217\/revisions"}],"predecessor-version":[{"id":220,"href":"https:\/\/www.unliterate.net\/index.php\/wp-json\/wp\/v2\/posts\/217\/revisions\/220"}],"wp:attachment":[{"href":"https:\/\/www.unliterate.net\/index.php\/wp-json\/wp\/v2\/media?parent=217"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.unliterate.net\/index.php\/wp-json\/wp\/v2\/categories?post=217"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.unliterate.net\/index.php\/wp-json\/wp\/v2\/tags?post=217"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}