256 Kilobytes

Answers in Server-Side | By Some Guy

Published 1 month agoTue, 19 Mar 2019 19:19:24 -0700

51 views, 0 RAMs, and 1 comment

Tags: PHP, Random Number Generation, Passwords, Correct Horse Battery Staple

Profile Photo - Some Guy Some Guy
🗎 3223 🗨 41 🐏 31
Subscriber

Ex:

  • word1-word2-word3-word4-12345
Download more RAM. 🐏 ⨉ 0 Posted by Some Guy 1 month ago 🕓 Posted at 19 March, 2019 19:19 PM PDT

This is a patsy account used by the 256 Kilobytes staff to seed content. 

Profile Photo - August R. Garcia August R. Garcia LARPing as a Sysadmi... Portland, OR
🗎 104 🗨 620 🐏 116
Site Owner
function correct_horse_battery_staple() {

        // The file that contains the words you want to use
        $f_contents = file(public_path() . "/storage/text/words"); 

        // Choose a Random Separator
        $separators = ["-", "_", "~", ".", "+"];
        $separator = $separators[array_rand($separators)];

        $pw = "";

        // Replace "5" with the number of words desired
        for ($iii = 0; $iii < 5; ++$iii) {
                // Get a random line from the file (assuming your file's words are split by line) 
                $t = trim($f_contents[rand(0, count($f_contents) - 1)]) . $separator;
                
                // Randomly apply capitalization to the selected words 
                $r= rand(0,2); 
                if     ($r == 0) { $t = strtoupper($t); }
                elseif ($r == 1) { $t = strtoupper($t); }
                elseif ($r == 2) { /**/          }       

                $pw .= $t;
        }       

        // Add a random number to the end of the password (with leading zeroes) 
        $pw .= str_pad( rand(1,100000), 6, "0", STR_PAD_LEFT);

        return $pw
}

Example output:

  • Tran's-PILAWS-chorale's-DISHPAN-INVARIANT-011771
  • SILENT_EXISTENTIALIST_GYRATED_demean_COOLEY_008305
  • expelled+HOOKWORM+MISHMASH+FLIPPERS+human+091237
Download more RAM. 🐏 ⨉ 0 Posted by August R. Garcia 1 month ago

Edit History

• [2019-03-19 19:23 PDT] August R. Garcia (1 month ago)
• [2019-03-19 19:23 PDT] August R. Garcia (1 month ago)
🕓 Posted at 19 March, 2019 19:23 PM PDT

The CIA wants all code in the cloud under their lock and key. They want to ban compilers and make people think HTML is computer programming. - Terry A. Davis

Post a New Comment

To leave a comment, login to your account or create an account.

Do you like having a good time?

Read Quality Articles

Read some quality articles. If you can manage to not get banned for like five minutes, you can even post your own articles.

View Articles →

Argue with People on the Internet

Use your account to explain why people are wrong on the Internet forum.

View Forum →

Vandalize the Wiki

Or don't. I'm not your dad.

View Wiki →

Ask and/or Answer Questions

If someone asks a terrible question, post a LMGTFY link.

View Answers →

Make Some Money

Hire freelancers and/or advertise your goods and/or services. Hire people directly. We're not a middleman or your dad. Manage your own business transactions.

Register an Account
You can also login to an existing account or recover your password. All use of this site is subject to terms outlined in the terms of service and privacy policy.