Re: [twsocket] One Time Passwords

2007-11-14 Thread Francois PIETTE
> However I wonder how you translate the stuff below?
>
> /*
>  * copy the resulting 64 bits to the result buffer in little endian
>  * fashion (analogous to the way MD4Final() and MD5Final() do).
>  */
> for (i = 0, j = 0; j < 8; i++, j += 4)
> {
> result[j]   = (unsigned char)(sha.digest[i] & 0xff);
> result[j+1] = (unsigned char)((sha.digest[i] >> 8) & 0xff);
> result[j+2] = (unsigned char)((sha.digest[i] >> 16) & 0xff);
> result[j+3] = (unsigned char)((sha.digest[i] >> 24) & 0xff);
> }

This code just move the digest bytes to the result, low byte first. You can 
write almost same code in Delphi. Declarations are missing, but at first 
glance, digest array in an array of 32 bit integers while result is an array 
of char.

--
[EMAIL PROTECTED]
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] One Time Passwords

2007-11-14 Thread Angus Robertson - Magenta Systems Ltd
I've emailed you the OTP test program, maybe you can see something I've
missed. 

> However I wonder how you translate the stuff below?
> 
> copy the resulting 64 bits to the result buffer in little 
> endian fashion 

I think some of this stuff is Unix specific.  

Angus
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] One Time Passwords

2007-11-14 Thread Arno Garrels
Angus Robertson - Magenta Systems Ltd wrote:
 
> I've got opt-md5 working in the ICS FTP client (and shortly the FTP
> server), but opt-md4 and opt-sha1 are not generating the expected
> results. 

Just a little test with MD4, Count 0 gave me the expected result:  

MD4Init(Md4Ctx);
Md4Update(Md4Ctx, 'testThis is a test.', 19);
Md4Final(Md4Ctx, MD4Digest);

//* Fold the 128 bit result to 64 bits */
for I := 0 to  7 do
   MD4Digest[I] :=  MD4Digest[I] xor MD4Digest[I + 8];

for I := 0 to 7 do
   S := S + IntToHex(MD4Digest[I], 2) + ' '; 


However I wonder how you translate the stuff below?

 /*
  * copy the resulting 64 bits to the result buffer in little endian
  * fashion (analogous to the way MD4Final() and MD5Final() do).
  */
 for (i = 0, j = 0; j < 8; i++, j += 4)
 {
 result[j]   = (unsigned char)(sha.digest[i] & 0xff);
 result[j+1] = (unsigned char)((sha.digest[i] >> 8) & 0xff);
 result[j+2] = (unsigned char)((sha.digest[i] >> 16) & 0xff);
 result[j+3] = (unsigned char)((sha.digest[i] >> 24) & 0xff);
 }



-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be