Skip to content

Instantly share code, notes, and snippets.

@baileylo
Created March 21, 2012 00:43
Show Gist options
  • Save baileylo/2143103 to your computer and use it in GitHub Desktop.
Save baileylo/2143103 to your computer and use it in GitHub Desktop.
How I encrypt passwords!
<?php
function bestEncryptionEver($plain_text) {
$hash = array(
'q' => 'w',
'w' => 'e',
'e' => 'r',
'r' => 't',
't' => 'y',
'a' => 's',
's' => 'd',
'f' => 'g',
'z' => 'x',
'x' => 'c',
'c' => 'v',
'v' => 'b'
);
return join(array_map(function($input) use ($hash) {
return (isset($hash[$input])) ? $hash[$input] : $input;
}, str_split($plain_text)));
}
$password = 'my-password';
print '"encrypted" password: ' . bestEncryptionEver($password) . PHP_EOL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment