Valhalla Legends Forums Archive | Battle.net Bot Development | [SRP] Converting Java code to C++

AuthorMessageTime
bethra
Ok, so I was looking at iago's 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.
November 3, 2005, 4:04 AM
Quarantine
You need to find your own BigInteger library.
November 3, 2005, 4:08 AM
K
Check out the gmp library:
http://www.swox.com/gmp/
November 3, 2005, 4:45 AM
iago
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. 

November 3, 2005, 4:53 AM
Myndfyr
[quote author=iago link=topic=13139.msg132738#msg132738 date=1130993591]
GMP library is GNU, though, so if you use it then your code is automatically also GNU. 
[/quote]
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/
November 3, 2005, 4:58 AM
Kp
Consider using OpenSSL if you require a non-GPL/non-LGPL library.  In order to support SSL transactions, OpenSSL 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.
November 3, 2005, 5:22 AM

Search