Created
August 24, 2015 11:09
-
-
Save srsbiz/59747774c570c3a8a343 to your computer and use it in GitHub Desktop.
decode HeidiSQL password in php
This file contains 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 | |
// ported from http://sourceforge.net/p/heidisql/code/HEAD/tree/trunk/source/helpers.pas#l462 | |
function heidisql_decrypt($str){ | |
$j = $salt = $nr = 0; | |
$result = ''; | |
if ($str == '') { | |
return ; | |
} | |
$j = 0; | |
$salt = intval($str[strlen($str)-1]); | |
while($j < strlen($str)-1){ | |
$nr = hexdec($str[$j] . $str[$j+1]) - $salt; | |
if ($nr < 0) { | |
$nr += 255; | |
} | |
$result .= chr($nr); | |
$j += 2; | |
} | |
return $result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment