function heidiDecode(hex) { | |
var str = ''; | |
var shift = parseInt(hex.substr(-1)); | |
hex = hex.substr(0, hex.length - 1); | |
for (var i = 0; i < hex.length; i += 2) | |
str += String.fromCharCode(parseInt(hex.substr(i, 2), 16) - shift); | |
return str; | |
} | |
document.write(heidiDecode('755A5A585C3D8141786B3C385E3A393')); |
Thank you so much, it saved my day
PHP Decode:
php -r '$p=$argv[1];$s=substr($p,-1); echo implode(array_map(function($c)use($s){return chr($c - $s);},unpack("C*",hex2bin(substr($p,0,-1)))));' 303132333435363738390
Note that PHP's chr wraps negative numbers properly. Not all languages will do this. You may need ($c+256-$s)%256
. To test for that you should see if whatever you're using for chr produces the same for 0 - s
as 256 - s
.
If you're encoding your own password (generating conf)...
php -r 'echo bin2hex("Sweet as a corn that'\''s not yet born."), 0;'
There's no point to bother shifting it. Shifting and hex encoding is so weak it might as well be plain text.
@wendyliga Do you have everyone's password now :D?
you are a lifesaver
Thank you!
Thanks
THANKS A LOT!!!!
Wow !!
thank you,,
Hi!
Awesome! Thank u! We owe you one.
All the best.
And how encode a password?
I need to generate a settings file for Heidi with php for my all databases connections?
Thank you!
Thank You all :)
Thank you!
Thanks, @jpatters! Here, have a PowerShell version with bonus registry lookup:
Note: You can use the same method to get credentials for SSH tunnel if configured, just choose those registry keys instead.