Created
January 14, 2018 21:44
-
-
Save Wruczek/3becc94ce602df70467813dbb8e907ef to your computer and use it in GitHub Desktop.
Simple PHP script to decrypt WHMCS hashed strings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$encoded_string = "JATa2iUqVdzCkBP5RiyitlQlUiACl8UrpJOeGUJO"; | |
$cc_encryption_hash = "SOmECRAZYLONGHASHROFLCOPTERBBQKTHX"; | |
echo decrypt_whmcs($encoded_string, $cc_encryption_hash); | |
function decrypt_whmcs($encoded_string, $cc_encryption_hash) { | |
$key = md5(md5($cc_encryption_hash)) . md5($cc_encryption_hash); | |
$hash_key = _hash($key); | |
$hash_length = strlen($hash_key); | |
$string = base64_decode($encoded_string); | |
$tmp_iv = substr($string, 0, $hash_length); | |
$string = substr($string, $hash_length); | |
$iv = $out = ""; | |
for($c = 0; $c < $hash_length; $c++) { | |
$iv .= chr(ord($tmp_iv[$c]) ^ ord($hash_key[$c])); | |
} | |
$key = $iv; | |
for($c = 0; $c < strlen($string); $c++) { | |
if ($c != 0 && $c % $hash_length == 0) { | |
$key = _hash($key . substr($out, $c - $hash_length, $hash_length)); | |
} | |
$out .= chr(ord($key[$c % $hash_length]) ^ ord($string[$c])); | |
} | |
return $out; | |
} | |
function _hash($string) { | |
if (function_exists("sha1")) { | |
$hash = sha1($string); | |
} else { | |
$hash = md5($string); | |
} | |
$out = ""; | |
for($c = 0; $c < strlen($hash); $c += 2) { | |
$out .= chr(hexdec($hash[$c] . $hash[$c + 1])); | |
} | |
return $out; | |
} |
suggestion lang use input box for
$encoded_string = "JATa2iUqVdzCkBP5RiyitlQlUiACl8UrpJOeGUJO";
$cc_encryption_hash = "SOmECRAZYLONGHASHROFLCOPTERBBQKTHX";
How to encrypt?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sinungaling pakyo