Skip to content

Instantly share code, notes, and snippets.

@srsbiz
Created August 24, 2015 11:09
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 srsbiz/59747774c570c3a8a343 to your computer and use it in GitHub Desktop.
Save srsbiz/59747774c570c3a8a343 to your computer and use it in GitHub Desktop.
decode HeidiSQL password in php
<?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