Working on building a Java version of a Putty .ppk reader.
I found a PHP version, but I’m stuck on converting some functionality into Java:
$password = 'blah';
$symkey = '';
$sequence = 0;
while (strlen($symkey) < 32) {
$temp = pack('Na*', $sequence++, $password);
$symkey.= pack('H*', sha1($temp));
}
$symkey = substr($symkey, 0, 32);
I understand that $symkey.= pack('H*', sha1($temp));
is calling a sha1 hashing function, and I can do that in java, so that can remain a black-box for this. I’m assuming the pack('H*')
is just converting the results of the sha1 hash to hex? It’s the pack('Na*'
that I can’t grock (or find help with on Google)
Can someone help me, or point me in the right direction?
Thanks so much!
2
Answers
Will this do what I think it will?
Assumin that pack is hashing function :