• Welcome to Valhalla Legends Archive.
 

[SRP] Converting Java code to C++

Started by Sorc.Polgara, November 02, 2005, 10:04 PM

Previous topic - Next topic

Sorc.Polgara

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.

Warrior

You need to find your own BigInteger library.
Quote from: effect on March 09, 2006, 11:52 PM
Islam is a steaming pile of fucking dog shit. Everything about it is flawed, anybody who believes in it is a terrorist, if you disagree with me, then im sorry your wrong.

Quote from: Rule on May 07, 2006, 01:30 PM
Why don't you stop being American and start acting like a decent human?


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. 

This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


MyndFyre

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/
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

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.
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!