Authentication Issues
Posted: 05 May 2011, 05:28
I'm writing an ADC bot in Delphi and I'm having a few issues with authenticated logins.
I'm generating the Tiger hash with the Delphi Encryption Compendium (a well-respected cryptographic suit for Delphi) so I'm reasonably confident that the hashing algorithm isn't the problem.
I've written BinToBase32 and Base32ToBin functions which convert between UTF-8 and Base32 string encodings. They also add 0's to the end of the binary representation of the string if the length of it is not divisible by 5 (for BinToBase32) or 8 (for Base32ToBin) to make it encode properly . Once again, I'm reasonably sure the 2 functions work properly as I can convert a string back and forth with no difference to the original (except letters on the end due to the padding). I can provide the source for them if needed.
When hashing the password and random data I use the following function:
Where 'THash_Tiger.CalcBinary' is the hashing function and 'TFormat_Copy' is the output format (meaning copy the binary data with no formatting).
As far as I understand the ADC spec, this is the proper way of computing the hash to send back to the hubsoft.
However, with another client I recorded this with a password of 'none':
When I replicate this scenario (using the data the other client was given) with my program I get a final hash of
which is obviously wrong.
I'm probably doing something really small wrong, but I've been stewing over it for a few days now and getting nowhere so I figured I'd ask for help.
PS: I'm not sure if this is the right place for this, feel free to move it if it isn't.
I'm generating the Tiger hash with the Delphi Encryption Compendium (a well-respected cryptographic suit for Delphi) so I'm reasonably confident that the hashing algorithm isn't the problem.
I've written BinToBase32 and Base32ToBin functions which convert between UTF-8 and Base32 string encodings. They also add 0's to the end of the binary representation of the string if the length of it is not divisible by 5 (for BinToBase32) or 8 (for Base32ToBin) to make it encode properly . Once again, I'm reasonably sure the 2 functions work properly as I can convert a string back and forth with no difference to the original (except letters on the end due to the padding). I can provide the source for them if needed.
When hashing the password and random data I use the following function:
Code: Select all
function HashADCPassword(key : string; pass : UTF8String): string;
begin
Result := BinToBase32(THash_Tiger.CalcBinary(pass + Base32ToBin(key), TFormat_Copy));
end;
As far as I understand the ADC spec, this is the proper way of computing the hash to send back to the hubsoft.
However, with another client I recorded this with a password of 'none':
Code: Select all
[Incoming] IGPA PDCQPYQG75AQFJBA4BD5QIYY2FTTQRVBAFG5BOTURPZ3Z4JNRIAA
[Outgoing] HPAS 4EJM7GAJGMSKQZVUSHPGYAQ53HNNZGLVJN5SDNQ
Code: Select all
CP4POWXTLRIKQYFCXWG2FY56ECS3COSPCZNDGVI
I'm probably doing something really small wrong, but I've been stewing over it for a few days now and getting nowhere so I figured I'd ask for help.
PS: I'm not sure if this is the right place for this, feel free to move it if it isn't.