Valhalla Legends Forums Archive | Visual Basic Programming | CDKey and Password Hashing

AuthorMessageTime
RealityRipple
I'm trying to wean my bot off of external DLLs a bit more, and in doing so, I would like to hash CDKeys and Passwords locally in VB. Right now I'm using BNCSutil (which does a wonderful job, btw), but I'd really like to be able to do it internally. Can someone point me towards what I need to have? I know I need a Broken SHA-1 function, and some outline on how to hash and double-hash. Any help would be much appreciated.
September 16, 2006, 8:55 AM
Topaz
[quote author=RealityRipple link=topic=15718.msg158183#msg158183 date=1158396900]
I'm trying to wean my bot off of external DLLs a bit more, and in doing so, I would like to hash CDKeys and Passwords locally in VB. Right now I'm using BNCSutil (which does a wonderful job, btw), but I'd really like to be able to do it internally. Can someone point me towards what I need to have? I know I need a Broken SHA-1 function, and some outline on how to hash and double-hash. Any help would be much appreciated.
[/quote]

Unless there's a Bignum library for VB, I don't think you can.
September 16, 2006, 9:06 AM
RealityRipple
http://www.vbcode.com/Asp/showzip.asp?ZipFile=http%3A%2F%2Fwww%2Evbcode%2Ecom%2Fcode%2FBigNum3002042002%2Ezip&theID=6141

Would that be of use?
September 16, 2006, 9:46 AM
Spilled[DW]
[quote author=RealityRipple link=topic=15718.msg158185#msg158185 date=1158400016]
http://www.vbcode.com/Asp/showzip.asp?ZipFile=http%3A%2F%2Fwww%2Evbcode%2Ecom%2Fcode%2FBigNum3002042002%2Ezip&theID=6141

Would that be of use?
[/quote]

Hrmm I believe that would work but you may want to get a second opinion, but when it comes to vb6 doing your hashing from the dll would be quicker then actually doing the hashing  yourself....
September 16, 2006, 11:17 AM
RealityRipple
I understand that. I just don't want to be so dependant on other files (seems like an oxymoron for a vb programmer). How do the games do it? is it a function built into the program, or is there a dll you can use like storm's MPQ functions?
September 16, 2006, 1:42 PM
Yegg
[quote author=RealityRipple link=topic=15718.msg158190#msg158190 date=1158414166]
I understand that. I just don't want to be so dependant on other files (seems like an oxymoron for a vb programmer). How do the games do it? is it a function built into the program, or is there a dll you can use like storm's MPQ functions?
[/quote]

Check out the source code of bnetauth.dll. It has the functions you are looking for. You should have atleast a basic knowledge of C/++ before trying to understand it.
September 16, 2006, 2:42 PM
l2k-Shadow
well i highly doubt you'll be able to do the NLS functions in VB, but if you do manage that, and everything else, there is still the problem of CheckRevision() taking ~5 seconds in VB (and ~20 seconds for war3)
September 16, 2006, 2:49 PM
RealityRipple
hmm... so in short it's really not worth it. I guess I'll stick to bncsutil for decoding and NLS. Thanks anyway, guys.
September 16, 2006, 11:05 PM
l2k-Shadow
imho you should use all functions BNCSUtil has to offer, considering the fact that C++ code will execute faster than VB code no matter what.
September 16, 2006, 11:10 PM
MyStiCaL
unless it was really really poorly coded c++ code. ;\
September 17, 2006, 2:10 AM
RealityRipple
I'm using Lord[nK]'s BNLib.dll to use the actual MPQ files to run checkrevision. Everything else is BNCSUtil based.
September 17, 2006, 2:27 AM
HeRo
[quote author=RealityRipple link=topic=15718.msg158238#msg158238 date=1158460039]
I'm using Lord[nK]'s BNLib.dll to use the actual MPQ files to run checkrevision. Everything else is BNCSUtil based.
[/quote]
Where is BNLib.dll located? Upload it  ::)?
September 17, 2006, 2:37 AM
l2k-Shadow
[quote author=heRo link=topic=15718.msg158240#msg158240 date=1158460651]
[quote author=RealityRipple link=topic=15718.msg158238#msg158238 date=1158460039]
I'm using Lord[nK]'s BNLib.dll to use the actual MPQ files to run checkrevision. Everything else is BNCSUtil based.
[/quote]
Where is BNLib.dll located? Upload it  ::)?
[/quote]

the lib is awesome.
[quote]
[7:56:10 PM] [BNET] Connecting...
[7:56:15 PM] [BNET] Connected!
[7:56:16 PM] [BNFTP] Connecting...
[7:56:20 PM] [BNFTP] Connected!
[7:56:20 PM] [BNFTP] Requesting ver-IX86-1.mpq...
[7:56:21 PM] [BNFTP] ver-IX86-1.mpq received!
[7:56:21 PM] Extracting CheckRevision library...
[7:56:21 PM] Library extracted!
[7:56:21 PM] [BNLib] Calling CheckRevision...
[7:56:21 PM] [BNLib] CheckRevision call succeeded!
[7:56:21 PM] [BNET] Sending version and CD-key check...
[/quote]

https://davnit.net/bnet/vL/index.php?topic=15671.msg158208#msg158208
September 17, 2006, 2:57 AM
HeRo
Thanks for the link, I kinda over looked that, I guess. Can't wait to try it.
September 17, 2006, 3:02 AM
RealityRipple
If you want just the dll, it's in HDX's downloads folder on his site. I also made a nice icon for the dll if you want to put it somewhere on your programs. http://realityripple.com/Uploads/BNLib.ico
September 17, 2006, 3:07 AM
JoeTheOdd
Someone's written a CheckRevision function in Visual Basic and got it to work. It CheckRevisioned StarCraft in 20 seconds. WarCraft III takes notably longer, I believe around three times as long, using C code. So, it'd be impractical to do it in VB in a bot you actually use (bragging rights, of course, are worth going for).
September 18, 2006, 12:52 PM
RealityRipple
O.O... that's insanely long. What kind of processor was that recorded on?
September 18, 2006, 10:25 PM
JoeTheOdd
Ah, come to think of it, I can't say I know. My computer is personally a 2.8GHz single-core P4 and I notice slowdowns with VB math-intensive things. Nothing near 20 seconds with the CheckRevision work I did, but it never even neared completion, so whatever.

Your best bet if you are hell-bent on being non-dependant on a library would be to download and extract ver-IX86-X.dll and run it, but be prepared for memory leaks (apparently around 24MB each run, ow) and some hard work. BNFTP is pretty easy -- I implemented automatic download and display of PCX ads in JBBE (lost the code, unfortunately), but MPQ seems to be quite complicated, perhaps moreso than running the DLL itself.
September 18, 2006, 10:59 PM
RealityRipple
I already do that to run CheckRevision. But I was looking for how to do cdkey and password hashing in vb. If it's really that bad, though, I'll keep using BNCSutil instead (with the checkrevision through BNLib).
September 18, 2006, 11:16 PM
HeRo
[quote author=Joe[x86] link=topic=15718.msg158371#msg158371 date=1158583973]
Someone's written a CheckRevision function in Visual Basic and got it to work.
[/quote]
Who?
September 19, 2006, 3:35 AM
JoeTheOdd
I don't know. Hdx, maybe, l2k-Shadow. Both are pretty good programmers and I'm sure they'd have optimised it reasonably.

RealityRipple, how well can you read Java? For XSHA1 you should port this (dependant on this and this, and expanded for double-hashing by this), and for CDKey hashing use this, which is also expanded for 16-char alpha keys and WarCraft III keys. Also, iago's implementation of CheckRevision, but with the new version string formats it always reverts to it's slower checking (at least, when they don't by chance send the formula in A B C order, about a one of nine chance). Also, it's not updated for the new file padding.

EDIT -
I forgot to mention that CheckRevision's slowness was from VB's poor handling of I/O, apparently, and not math, so CD-Keys and hashing should be much faster (note, faster, not fast :P).
September 19, 2006, 11:21 PM
HdxBmx27
[quote author=Joe[x86] link=topic=15718.msg158477#msg158477 date=1158708096]
I don't know. Hdx, maybe, l2k-Shadow. Both are pretty good programmers and I'm sure they'd have optimised it reasonably.
[/quote]
[me=HdxBmx27]raises hand.[/me]
It sucked horrably, I deleted it after i finished it.
also http://jbls.org/CheckRevision.java
Supports the new format, w/o reverting to the Slower CRev.

Andy, what you COULD do is stop useing VB. And learn a better language.
~-~(HDX)~-~
September 20, 2006, 3:36 AM
l2k-Shadow
I wrote a CheckRevision class in VB 6 about a year ago but it worked rougly 50% of the time due to the lovely limitation of no unsigned variables in VB, it was also very very slow, I ended up trashing it with much enthusiasm.
September 20, 2006, 3:42 AM
JoeTheOdd
[quote author=l2k-Shadow link=topic=15718.msg158487#msg158487 date=1158723749]
I wrote a CheckRevision class in VB 6 about a year ago but it worked rougly 50% of the time due to the lovely limitation of no unsigned variables in VB, it was also very very slow, I ended up trashing it with much enthusiasm.
[/quote]

A mess of strings, copymemory, and an array of longs should solve all your problems. :)
September 20, 2006, 11:52 AM
RealityRipple
:( stop insulting vb so much. I've learned or tried many other languages, and te BASIC series is just the one I'm comfortable with. It feels like it's my native language. I'm not switching (though I may move to REALbasic some day). I'll continue to use BNCSutil because it's good, fast, and easy.
September 20, 2006, 12:43 PM
l2k-Shadow
[quote author=Joe[x86] link=topic=15718.msg158502#msg158502 date=1158753164]
[quote author=l2k-Shadow link=topic=15718.msg158487#msg158487 date=1158723749]
I wrote a CheckRevision class in VB 6 about a year ago but it worked rougly 50% of the time due to the lovely limitation of no unsigned variables in VB, it was also very very slow, I ended up trashing it with much enthusiasm.
[/quote]

A mess of strings, copymemory, and an array of longs should solve all your problems. :)
[/quote]
ya and have fun doing all that work especially for the fact that the values are now 64bit.

[quote author=RealityRipple link=topic=15718.msg158507#msg158507 date=1158756197]
:( stop insulting vb so much. I've learned or tried many other languages, and te BASIC series is just the one I'm comfortable with. It feels like it's my native language. I'm not switching (though I may move to REALbasic some day). I'll continue to use BNCSutil because it's good, fast, and easy.
[/quote]

VB is an amazing language, the problem with it is that the limitations just aren't worth it that much.. there are certain things that you just sometimes need in your projects that are extremely difficult in VB or just not at all possible, BUT if you can manage to write .dlls in other languages to surpass those limitations than yeah, you get rid of the limitation problem... Now all you have to deal with is slowness, and unless you're coding like an engine or something intensive as such, yay for VB :D
September 20, 2006, 7:33 PM

Search