Hi!
I'm giving a look to the code of OpenSSL as I'm very interested in RSA encryptation / decryp. specially for a subject called Discrete Math. My problem is that I have to work on an algorithm by myself and, of course, I'm trying to implement and understand some things that OSSL uses like the Arbitrary Precision Numbers (BIGNUM).
What I can't understand is how the function BN_bin2bn works (or at least, I know what it does but I think doesn't do it correctly). For example, imagine that I have to transform the string "1234" to the BIGNUM->d (that it's a pointer to a long):
Initial params:
s = "1234" m = 3 n = 4 i = 1
The initial long l is a 32 bit full of zeros. So then when you do: l=(l<<8L)| *(s++);
This then write to the long the char value of '1', '2', '3', and at last '4' moving the bits to the left. For example for the '1' it writes 110001. When it writes the '2' the chain of bits is something like: 110001 00110010, and so on... At the end I have this:
00110001001100100011001100110100 - 32 bit long
And that, of course, it's not the number 1234 in binary, is the number 825373492. What is what I'm not understanding? (I think anything at all). Please help me! Thank You!!
_________________________________________________________________
Protege tu correo contra los virus con MSN Premium. Pruébalo gratis dos meses. http://join.msn.com/?pgmarket=es-es&page=features/firewall&XAPID=1684&DI=1055&HL=TAG2OPENINGTEXT_MSNPREMIUM_VIRUS
______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]