Valhalla Legends Forums Archive | Battle.net Bot Development | Hashing (Java)

AuthorMessageTime
Prospero
Greetings,

I am currently developing a Binary bot in Java, and I have a question

I have been looking at the source code for a few binary bots in C++ (nbbot and raibot I think), but since my knowledge of C++ is quite limited I have been unable to fully comprehend the way Hashing is achieved for Battle.net, I was wondering if anyone could describe the procedure to me using detailed pseudo-code, or if anyone has Java methods to achieve hashing that they are willing to share?

Thank you for your help,

Prospero
March 18, 2003, 7:30 AM
St0rm.iD
c0ol may have ported it, ask him.
March 18, 2003, 8:03 AM
Zakath
c0ol has written a bot in java...I would assume thus that he ported the algorithms.
March 18, 2003, 1:12 PM
Prospero
Well, I wouldn't specifically need his algorithms (though that would be great), a detailed descriptions about how the algorithms work would also help me enough (isn't there a Hashing and Checkrevision tutorial or something?  ;))
March 18, 2003, 2:27 PM
Kp
You could just use BNLS, which will do the hashing for you.  If you're determined to do your hashing clientside, it's based off SHA-1, though it isn't exactly the same.
March 18, 2003, 6:21 PM
St0rm.iD
No, he doesn't want a quick answer, he wants to do it himself.

I'll try to help you when I get some more free time.
March 18, 2003, 8:26 PM
Prospero
I could use BNLS indeed, but the point of my whole bot-making endeavor was to make a binary bot that is not dependant of 3rd party servers (I currently use UltimateBot with BG3, and even though I admire the work put into it by both their programmers, it forces me to rely on their server), as well as making it to suit my personal preference.
March 19, 2003, 8:01 AM
WinSocks
making a bot in Java can be really tricky especially when the dumbass programming language is insainly Case Sensitive.....

hmmm hashing in java would be completely different than C++ or VB, cause of varialbe and array references and what Java packages you have to use.

I've been currently develeoping a Java Chat program. Using a Chat Client connecting to a server. It does involve some hashing, if you want to check out the src if you want. E-Mail me at warlord_56@hotmail.com.
March 21, 2003, 12:30 PM
Tuberload
[quote]making a bot in Java can be really tricky especially when the dumbass programming language is insainly Case Sensitive.....
[/quote]

How does this have any affect on the difficulty involved in creating a bot with Java? It seems to me if you understood the language, and weren't so dependent, this is just a guess, to VB's insane lack of case sensitivity their would be no problem at all... Just one other thing that confuses me, what makes Java such a *dumb ass* language?

Edit: Terrible grammar mistake :'(
March 21, 2003, 2:00 PM
Skywing
[quote]making a bot in Java can be really tricky especially when the dumbass programming language is insainly Case Sensitive.....

hmmm hashing in java would be completely different than C++ or VB, cause of varialbe and array references and what Java packages you have to use.

I've been currently develeoping a Java Chat program. Using a Chat Client connecting to a server. It does involve some hashing, if you want to check out the src if you want. E-Mail me at warlord_56@hotmail.com.
[/quote]
Actually, most programming languages are case-sensitive.  BASIC-based languages are more the exception than the rule - C, C++, C#, Java (as you've just pointed out) and many other things are all case-sensitive.
March 21, 2003, 2:11 PM
Zakath
I'm confused as to why having the language be case insensitive would be a good thing
March 21, 2003, 7:32 PM
St0rm.iD
The only good weak-typed language is Python. But it's still case-sensitive!
March 21, 2003, 7:40 PM
Skywing
[quote author=St0rm.iD link=board=17;threadid=504;start=0#msg3511 date=1048275600]
The only good weak-typed language is Python. But it's still case-sensitive!
[/quote]Each language has it's own usage. You could certainly say assembly is weakly-typed, and it's still used for extremely-time-critical loops.
March 22, 2003, 6:38 PM
TyC-Pros
(This is the original poster - decided to register an account)

I see this thread has taken a different turn from the original topic, so I might as well add my opinion:

There are only 2 languages I have adequate experience with to make a bot in it - Delphi and Java, and at the moment my preference goes to Java since I've been making assignments in it for the past 20 weeks, while the last time I did something in Delphi was 2 years ago.
March 24, 2003, 9:08 PM
Nova1313
Just some fyi thanks to a couple donations by some dedicated users

bg3 now has a dedicated key server thats used mostly for that and webhosting for the site. It's a duron 512 megs ram on a 10 meg connection to the net. It's has 30 day or so uptime since we got it the server switch was last weekend and I've had a bot connected to europe for over a week on it. If you have problems let me know..

As for the java bot part. I've started work on porting bg3 to java for a few mac/unix users that we have. Storm had mentioned something to a libary that will let you run c code right from it or something I wasn't really paying attention when he told me as I've been writing my own bnls type thing specifically for bg3 but alot less secure.. You could go with bnls like kp recommended. it's a really great alternative to having your own full set of login code. I'd personally move bg3 to it but we have 16000+ users so I wouldn't want it to interfere with their server for it with the load (not sure of it's theoretical limit/ load capcity)

If however you get stuck while converting the code contact me (nova1313@novaslp.net) I should be able to help you through it. I can make my way around java pretty well.
April 3, 2003, 4:46 AM
Grok
16000 simultaneous connected useRs?
16000 unique useRs?
16000 totalled uses?
16000 uses per day?
April 3, 2003, 9:50 AM
Yoni
16000 uses per second?
April 3, 2003, 1:59 PM
St0rm.iD
16000 active users, I believe. They probably auth with the server maybe twice a day. It's an HTTP GET afaik.
April 5, 2003, 4:00 AM
MesiaH
ewww, not to mention eww@inaccuracy
April 5, 2003, 5:22 AM
Nova1313
700-1000 on at any given time. 300 new signups on average per week.

17000 users as of now approved for use. 21000 requests total 4000 some denied for spamming/warring purposes.

Unique logins per day depends. On saturday it peaks around 2000-3000
weekdays if you break 1000 thats lucky...

Alot of the users are 24/7 which has been extremely possible since the last patch I put out and a the new key auth dedicated server I purchased.
April 7, 2003, 5:21 PM
Grok
700-1000 "on at any given time"?

If it's an auth server, how are they "on" more than a second or two?

If there are 3000 logins max per day, you're saying each user remains connected to your auth server an average of 8 hours.

Says Barbie: Math is HARD!
April 7, 2003, 6:36 PM
n00blar
BG3 isn't an auth server (i assume you are referring to something like BNLS?) it is a chat gateway. They connect chatbots through BG3 to battle.net (like a proxy almost) i'm sure nova can explain in further detail
April 7, 2003, 9:25 PM
Skywing
[quote author=n00blar link=board=17;threadid=504;start=15#msg7269 date=1049750725]
BG3 isn't an auth server (i assume you are referring to something like BNLS?) it is a chat gateway. They connect chatbots through BG3 to battle.net (like a proxy almost) i'm sure nova can explain in further detail
[/quote]I believe he's referring to BG3's checkin ("BGKey") server.
April 7, 2003, 10:01 PM
c0ol
I messed with this for a day or so, and i fould that making the version check IN java would be a hack at best. If you do want to attempt it go for it, heres how it works:
Battle.net sends you an equation like so A=345 B=566 C=123 A=A+B B=B-C C=C^S
what you want to do is read in the file one dword at a time (actually read it in 8k chunks and use it 1 byte at a time, but w/e) and set S as the current dword that you are processing. Then loop through the equations and execute each one, where again S is the current dword. do this for all of the files in the correct order, once you are done C will be the checksum dword. You can do this in a number of ways, the easiest and slowest way to process this would be to have a series of if statements that you execute for every byte. The other way, and prolly the best is to precompile the equations as machine code, and then run it like a function for each byte. I hope this helps with your java porting.
April 10, 2003, 4:49 AM
St0rm.iD
Ah, thank you for explaining that.
April 10, 2003, 7:28 PM
smoke
[quote author=c0ol link=board=17;threadid=504;start=15#msg7437 date=1049950180]
what you want to do is read in the file one dword at a time (actually read it in 8k chunks and use it 1 byte at a time, but w/e) and set S as the current dword that you are processing.
[/quote]

There is a chance that you might need to account for byte order issues (little/big endian) when reading the dwords into memory from the file, I'm not sure what byte ordering Java uses by default when reading/writing to files. It may be that the java virtual machine automatically rearranges bytes based on the underlying hardware. Then it is a matter of determining which byte order Java uses.

x86 uses little-endian (low order bytes come first)
PPC uses big-endian (high order bytes come first)

-smoke
April 10, 2003, 9:17 PM
c0ol
well the operations arent byte order sincitive, + - ^ so i dont think it would matter.

EDIT:
actually you are right, because if u read 00 00 00 02 backwards it would be a totally diffrent number. In java you would prolly start a byte buffer, and set the byte order to big edian then read all the files into it, and pop the dwords off the top.
April 10, 2003, 9:33 PM
TyC-Pros
This is getting more confusing every time I read this. I've been thinking about this and I'm starting to think I might as well reinstall Delphi and start working on a Delphi-Bot...

Is there any documentation available on CD-Key decoding, CD-Key Hashing (and the other hashing things) and CheckRevision?
April 14, 2003, 1:32 PM

Search