Ok, so I was looking at iago's SRP.java (http://www.javaop.com/javaop2/src/BNetLogin/src/password/SRP.java) and saw the use of several classes that are come with Java.
java.util.Random;
java.math.BigInteger;
java.security.MessageDigest;
Now, converting code between languages is something totally new to me. I've never really done something like this before. I thought it would be fairly easy to convert Java code to C++, however the use of these classes that come with Java really make the job harder than I thought. I must now somehow find a way to do what these classes are doing in iago's code using C++.
What I need to know is, does C++ have libraries that do what these Java classes do so that converting this code will be not as hard as I think?
The MessageDigest class looks like it will prove to be a huge problem.
You need to find your own BigInteger library.
Check out the gmp library:
http://www.swox.com/gmp/
GMP library is GNU, though, so if you use it then your code is automatically also GNU.
Random is just a normal random library. Just use rand()/srand() or whatever your libraries provide.
BigInteger is an implementation of arbitrary precision integers. In other words, integers that can expand to any length. There are several implementations out there, I can't say what's better or worse.
The MessageDigest I use is just for a simple implementation of SHA1. Find any SHA1 library or class, and you're set.
Quote from: iago on November 02, 2005, 10:53 PM
GMP library is GNU, though, so if you use it then your code is automatically also GNU.
Well I was about to suggest thumbing through BNCSUtil's source, but of course I believe that's GPL'd too. Actually, it's LGPL'd. *shrug* http://bncsutil.ionws.com/
Consider using OpenSSL (http://www.openssl.org/) if you require a non-GPL/non-LGPL library. In order to support SSL transactions, OpenSSL (http://www.openssl.org/) requires a variety of message digest algorithms, as well as support for very large numbers. You can get what you need from libcrypto.a, and leave the SSL stuff alone.