Skip to content

Instantly share code, notes, and snippets.

@joequery
Created October 19, 2016 21:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joequery/5fa61c0ed58aa7c412a1aebc0f9828a9 to your computer and use it in GitHub Desktop.
Save joequery/5fa61c0ed58aa7c412a1aebc0f9828a9 to your computer and use it in GitHub Desktop.
sombra encrypt
<?php
function str_rot($s, $n = 13) {
static $letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$n = (int)$n % 26;
if (!$n) return $s;
if ($n == 13) return str_rot13($s);
for ($i = 0, $l = strlen($s); $i < $l; $i++) {
$c = $s[$i];
if ($c >= 'a' && $c <= 'z') {
$s[$i] = $letters[(ord($c) - 71 + $n) % 26];
} else if ($c >= 'A' && $c <= 'Z') {
$s[$i] = $letters[(ord($c) - 39 + $n) % 26 + 26];
}
}
return $s;
}
function encrypt($password) {
$passArray = str_split($password);
$encrypted = array();
foreach($passArray as $char) {
$salt = count($encrypted);
$char = base64_encode(dechex(ord(str_rot($char,($salt+3)))*3));
if($salt % 2 == 0) $char = strrev($char);
array_push($encrypted, $char);
}
$encrypted = implode(":", $encrypted);
$encrypted = str_replace("=", "?", $encrypted);
return $encrypted;
}
$dudepw = "Xy@4+Bkuqd<53uJ";
$x = encrypt($dudepw);
echo $x;
@joequery
Copy link
Author

Output:

?MzY:MTI5:?AzY:OWM?:?EDO:ZGU?:jVTM:MTJm:2ITM:MTUw:?QjY:OWY?:?kTO:MTQx:?MzY

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment