• Welcome to Valhalla Legends Archive.
 
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - l)ragon

#1
Battle.net Bot Development / BotNet.
July 07, 2011, 02:54 PM
If anyone's interested in supporting this still leave me a line, I'm currently builing up a direct copy from the 4.1 document.

Updated 7-23-2003.

BotNet Protocol Specification
---------------------------------------

This documentation covers BotNet revisions 0x01 through 0x04.

The current protocol version is 0x01.  The maximum packet length is 511
bytes.  The current server revision is 0x04 (Kp_Version_1).  Strings are
limited to a length which is usually far less than the size of the
packet.  Except where otherwise specified, exceeding the string length
is a protocol violation.  String maximums are specified as: "(STRING:20)
Unique bncs name".  Such a string has a maximum length of 20 characters,
including the null.  Features added by server revisions are indicated by
a parenthesized number.  For instance "(4) (DWORD) ID" indicates that
revision 0x04 introduced a new DWORD related to identification.  If a second
number is provided after a decimal point, the field is present only when the
client has asserted awareness of at least that level.  Use packet 0xa to
assert an awareness level.  The default is zero if none is specified.

Additions in revision 0x04:
* Introduced message notifying client of protocol violation.  This is
the last message sent to a connection before the connection is closed.
See packet 8 for the format of this message.

Additions in revision 0x03:
* Database is now visible in stat update message.


Additions in revision 0x02:
* Unique account names.  By default, everyone has an account name of "No
Account".  You can log on as an account through message 0x0d.  Accounts
are guaranteed to be unique (only one instance can be logged on at any
given time) and are password protected.  Valid characters in account
names are: Any alphanumeric characters, and [] brackets.  Hence "No
Account" cannot be "spoofed" or faked.  Account names are given through
a new field at the end of the stats change (0x06) message.  Note that
creating an account does NOT log you on as that account.  When you log
on as an account, all users on the BotNet will receive a stats change
message (0x06) reflecting your new unique account name.

* Administrative support.  The BotNet server now provides
some basic administrative functionality to the server admin.  Admin
functions are accessed through message 0x0c.

You can use the following constants to refer to the new messages and
functionality: ("SEND" indicates that the BotNet server sends this
message, and "RECV" indicates that the client sends this message).

#define ADMIN_MSG_KICK_USER (0x00000000) /* SEND,RECV */
#define ADMIN_MSG_BAN_USER (0x00000001) /* SEND,RECV */
#define ADMIN_MSG_QUERY_USER (0x00000002) /* SEND,RECV */
#define ADMIN_MSG_QUERY_BANS (0x00000003) /* SEND,RECV */
#define ADMIN_MSG_UNBAN (0x00000004) /* SEND,RECV */
#define ADMIN_MSG_NOTIFY_ADMIN_PRIVILEGES (0x00000005) /* SEND   */

#define MSG_ID_ADMIN (0x0000000c) /* SEND,RECV */

#define ACCOUNT_MSG_LOGIN (0x00000000) /* SEND,RECV */
#define ACCOUNT_MSG_CHANGE_PASSWORD (0x00000001) /* SEND,RECV */
#define ACCOUNT_MSG_CREATE_ACCOUNT (0x00000002) /* SEND,RECV */

#define MSG_ID_ACCOUNT (0x0000000d) /* SEND,RECV */



Packet headers are formed as follows:
(BYTE) protocol version
(BYTE) packetid
(SHORT) packetlen
(...) DATA

Current packets:
(send to server) id 0x00: keepalive
Contents: None.
Response: None.  You should send this once every 2-3 minutes to enable
the TCP layer to detect connection failures and report them to your
application.

(send to client) id 0x00: keepalive
Contents: None.
Response: None.  The server sends this message to detect connectivity
failure; clients may safely ignore this message.  This message is sent
only in the absence of recent activity upon the connection, so do not
rely on it as a timing mechanism.

(send to server) id 0x01: log on to botnet
Contents:
(STRING:32) bot id
(STRING:64) hub password
Response: For server versions 2 and newer, the server sends back a
server version advisory (packet 0xa) after accepting a hub logon but
before confirming such acceptance.  In version 4, if the hub logon is
rejected, the client is disconnected and no messages are sent.  Prior to
version 4, the client would receive a notification that the logon was
unsuccessful.  See packet id 0x01 sent to client.

(send to client) id 0x01: log on status
Contents:
(BOOL) status : 0=FAIL, 1=OK.  In version 4, this message always
indicates success.
(4) (DWORD) client's IP address : clients inside a NAT device
may find this useful for learning their external address.
Response: On success, the client should proceed to logon and acquire its
database, as appropriate.

(send to server) id 0x02: update bot stats
Contents:
(STRING:20) unique username on battle.net : This string provides room
to specify a name mangle ("Someone#2"), but not to specify
gateway.
(STRING:36) current channel on battle.net : By convention,
"<Not logged on>" is used to indicate clients which are not
presently connected.
(DWORD) battle.net server ip
(STRING:96) database id (which database to use) : includes database
password.  Use the following format: "name password\0".
(DWORD) cycle status : 0=NotCycling, 1=Cycling
Response: client receives packet id 0x02.  Client is also assigned a unique
botnet identification number.  Prior to receiving this number, clients
are prohibited from performing actions which cause interaction with
other users.

(send to client) id 0x02: update bot status
(DWORD) status : 0=FAIL, 1=OK.  In version 4, this message is always success.
(DWORD) Optional dword which specifies administrative access, if it has
changed from its previous value.  If this dword is not present,
the client should assume that the access has not changed; the
default access is 0.  As noted in the documentation to message 6,
administrative access is expressed as a 32-bit mask of features
available.  Flags C and L enable insertion of client IP address
in message 6, if the client has also negotiated to use revision
1 packets (that is, fields marked 4.1 are in use).

--

(send to server) id 0x03: database modification
Contents:
(DWORD) command
command 1: request user database
(4) (DWORD) Optional dword which specifies maximum age of entries to
transfer.  If specified, the server performs an incremental download
of the database by transferring all entries modified within the
specified window.  For instance, to retrieve changes that occured
within the past 5 minutes, use 300 for this value.  Under some
conditions, the server may decline to perform an incremental transfer
and instead perform a full transfer.  A full transfer is the default
if this parameter is omitted.
Response: The server responds with id 0x3 and a subcmd specifying the type
of transfer, then transfers all relevant database entries as user
modifications, then sends a database completion notify in id 0x3.
Note that the database transfer start/stop advisories were added in
version 4.  Earlier versions provide no inherent way to detect the
completion of the transfer.
command 2: add a database entry/modify a database entry
(STRING) usermask    : this entry may be any length.
However, usermasks longer than 40 characters will be
rejected in the same manner as if the client did not
have permission to modify the database.  The uncapped
nature of this string is done to accomodate clients
which modify the database on behalf of users who have
not read this specification.  The client may thus relay
modification requests on excessively long names without
suffering a protocol violation.
(STRING:28) flags : must be uppercase letters only
(4) (STRING:64) optional comment : If this field
is omitted, it is presumed to be the null string.  this
field may contain any printable characters.  It is
distributed to other clients when the change is
successful, but is not saved for transmission during
subsequent database downloads.
Response: Dependent upon client's database notification mode and success
of the change.  If the client makes ACL changes immediately (the
default), a response is generated only if the modification was
rejected.  If the client awaits server confirmation of changes,
a response is generated only if the modification was accepted.
See packet id 0xa for information on how to specify notification mode.
command 3: remove a database entry
(STRING:40) usermask
(STRING:64) comment : same as comment in command 2
Response: Same behavior as for database modify.

(send to client) id 0x03: database change
Contents:
(DWORD) command
(4) command 1: database download control
(DWORD) subtype : this value is zero to indicate a full database
transfer is starting, 1 to indicate an incremental transfer is
starting, and 2 to indicate that a database transfer (of either type)
has finished.  Clients should clear their local ACL if subtype is 0.
Clients which display database modification notices to their users
are encouraged to disable such display during a database download,
as failure to do so would likely fill the screen with database changes.
Response: None.
command 2: new access list user/modify existing access list user.  During
a database download, user creations/modifications are sent in
this message.  Additionally, this message is used to confirm
successful database changes, to distribute changes made by other
clients, and to countermand changes which modified an existing entry.
(4.1) (DWORD) sending client's ID : this is 0 when the message
originates from the server
(4.1) (DWORD) timestamp of last modification to database entry
(STRING) usermask
(STRING) flags
(4.1) (STRING) comment : this is picked by the sending entity and
is not parsed by the server.  Clients are encouraged to use this to
identify the user who requested the change.
Response: None.
command 3: remove a database entry
(4.1) (DWORD) sending client's ID : this is 0 when the message
originates from the server
(4.1) (DWORD) timestamp of last modification to database entry
(STRING) usermask
(4.1) (STRING) comment : same as in command 2
Response: None.

--

(send to server) id 0x04: command to bots on same database
Contents:
(STRING:32) sending user
(STRING:384) command
Response: all clients on the same database as the sending client receive
packet id 0x04.  If the sending client does not have permission
to relay commands to other clients, only the sending client
receives command id 0x04 from the server.  The sending client
must have write access to the database, or have restricted
access and the command match a pre-defined list of acceptable
restricted user commands.  If the client does not meet the access
requirement, no response is generated to any user (including the sender
itself).

(send to client) id 0x04: command over botnet
Contents:
(4.1) (DWORD) sending client's ID
(4.1) (DWORD) distribution status
0 = broadcast to all users
1 = sent to database
2 = directed to this client specifically
(STRING) sender
(STRING) command
Response: None.

(send to server) id 0x05: cycle request
(DWORD) count
(STRING LIST) usernames of bots to cycle

(send to client) id 0x05: cycle request notification
(STRING) channel to cycle

(send to server) id 0x06: request information about bots on botnet
Contents: None documented.
Response: The server sends a series of id 0x6 to the client, one per online
user.

(send to client) id 0x06: botnet bot information
Contents:
(DWORD) bot id
(4.1) (DWORD) database access flags
1 = read
2 = write
4 = restricted access
(4.1) (DWORD) administrative capabilities
Specified in Zerobot Traditional Flags Format (ZTFF):
A = superuser, can perform any administrative action
B = broadcast, may use talk-to-all
C = connection, may administer botnet connectivity
D = database, may create and maintain databases
I = ID control, may create and modify hub IDs
S = botnet service
(4.1) (Admin only) (DWORD) IP address of the bot being described
(STRING:20) bot name
(STRING:*) bot channel
(DWORD) bot server
(2) (STRING:16) unique account name
(3) (STRING:*) database

(send to server) id 0x07: command over botnet to all botnet bots (send 0x04 to client)
Contents: same as command id 0x4 to server.  The only difference between
these messages is the distribution status of the resulting message.
Response: same as command id 0x4.

(send to client) id 0x07: bot disconnecting from botnet
(DWORD) bot id

(send to server) id 0x08: command to specific botnet bot
Contents:
(DWORD) target bot id
(STRING:32) sending user
(STRING:384) command
Response: the server forwards the message to the specified bot in the
form of a msg 0x4, providing that:
1) The target is online
2) The sender has permission to forward commands.  Permission here
refers to both relaying and write access, as referenced in command
id 0x4.
3) The target is on the same database as the sending user

(send to client) id 0x08: protocol violation
Contents:
(DWORD) Error code.  This is message specific.
(BYTE) ID of the offending command
(WORD) Length of the offending packet
(WORD) Length of unprocessed data (length of packets which arrived after the offending packets)
Response: None.  The server closes the botnet socket immediately after
sending this message.
Error codes:
1 = unrecognized command ID.  Any other code is command specific
Command 1:
2 = bad state, client is attempting to authenticate a second time
3 = bad size for hub ID
4 = bad size for hub password
5 = empty hub ID
6 = empty hub password
Command 2:
2 = bad state, client has not authenticated with command 1
3 = packet too small
4 = bad size for BNCSName
5 = channel
6 = missing server IP
7 = bad size for database string
8 = missing cycle status
9 = empty BNCSName
10 = empty channel
11 = bad server IP
12 = badly formed BNCSName
13 = badly formed database string
Command 3:
2 = missing subcommand
3 = bad state, client tried to perform a database
modification while invisible
4 = invalid subcommand
Subcommand 1:
No subcommand 1 specific errors.
Subcommand 2:
5 = missing entry name
6 = missing entry flags
7 = empty name
8 = empty flags
9 = malformed entry
10 = malformed flags
Subcommand 3:
5 = packet too small
6 = missing entry name
7 = empty entry name
8 = malformed entry name
Command 5:
2 = bad state, client tried to perform cycle while not visible
3 = missing count
4 = count is zero
5 = not enough data in packet to satisfy count
6 = specified more clients than exist on botnet
Command 6:
2 = bad state, client tried to query list while
invisible; this is illegal since the client is always
returned as the first entry in response to this command,
and the client must be visible to be returned
Command 7:
2 = bad state, client tried to issue command while invisible
3 = missing sender string
4 = missing command
5 = empty sender
6 = empty command
7 = malformed sender name
Command 8:
2 = bad state, client must be visible
3 = no target ID
4 = no sender string
5 = no command string
6 = bad target ID
7 = empty sender
8 = empty command
9 = malformed sender name
Command 9:
2 = bad state, client must be visible
3 = missing selector dword
4 = missing new password
5 = malformed password
Command 10:
2 = missing first dword
3 = missing second dword
4 = unexpected flags in second dword
Command 11:
2 = bad state, client must be visible
3 = missing distribution level
4 = missing emote
5 = missing target id
6 = missing text
7 = bad distribution level
8 = bad target (only if attempting to whisper a user)
Command 12:
2 = bad state, client must be visible
3 = missing subcommand
Other errors are subcommand specific.
Command 13:
1 = missing subcommand
2 = bad subcommand
3 = missing username
4 = empty username
5 = missing password
6 = empty password
There are no subcommand 0 specific errors.
Subcommand 1:
7 = missing new password
8 = empty new password
There are no subcommand 2 specific errors.

(send to server) id 0x09: change database password * Requires 'full' access
(DWORD) password to change (0: readonly, 1: full, 2: restricted)
(STRING) new password

(send to client) id 0x09: acknowledge communication version
Contents:
(DWORD) communication version.  This message is sent to confirm
acceptance of msg 0x0a.  All subsequent messages will be formed in
this style.  That is, clients should not change parsing methods until
the server confirms the new style.
Response: None

(send to server) id 0x0a: specify communication version and client
capabilities
Contents:
(DWORD) communication version.  Valid values are 0 (the default), or 1.
Messages which have conditionally added fields (as identified by the
4.X syntax) will contain fields for which X is not above this value.
(DWORD) client capabilities.  Currently only bit 0 is defined.  If set,
the client awaits server confirmation of database changes.  If clear,
the client updates the local ACL immediately and expects the server to
countermand prohibited changes.
Response: The server updates the communication version and sends 0x9 to the
client.  Message 0xa may be sent at any time, and may be resent if the
client desires to change the negotiation version.

(send to client) id 0x0a: botnet server version
Contents:
(DWORD) version
Version information:
Version 1 supports all packets 0x00 through 0x0b.
Version 2 supports messages 0x0c and 0x0d.
Version 4 supports message 0xa to server.

(send to server) id 0x0b: botnet chat
Contents:
(DWORD) command
0 : message to all bots
1 : message to bots on the same database
2 : message to bot specified by id.
(DWORD) action : 0x00=talk, 0x01=emote, any other is dropped
(DWORD) id : for command 0x02, id of bot to send to, otherwise ignored.
(STRING:496) message: blank messages are dropped
Response: the server generates 0xb to the specified other clients.  No
response is sent to the sending client.

(send to client) id 0x0b: botnet chat
Contents:
(DWORD) command : same as 0xb to server
(DWORD) action : same as 0xb to server
(DWORD) id : id of source bot (for all commands)
(STRING) message : chat message text
Response: None.

(send to server) id 0x0d: account management
Contents:
(DWORD) subcommand
(STRING:16) account name : name to acquire
* Subcommand 0x00: Login:
(STRING:96) account password
* Subcommand 0x01: Change password:
(STRING:96) old password
(STRING:96) new password
* Subcommand 0x02: Account create:
(STRING:96) account password
Response: The server returns the result code in 0xd.
Other subcommand values are reserved for future use.
The server ensures that there is never more than one user online using a
given account name.  Account names are restricted to alphanumeric
characters, brackets, underscores, and dashes.  Invalid characters
result in failure to create/logon the account.

(send to client) id 0x0d: account management reply
Contents:
(DWORD) subcommand --- This is the same subcommand as the message being replied to.
(BOOL) : Success/Failure for subcommand
Response: None.

(send to server) id 0x0e: database change mode.
This message marks a client as using certain older versions of
BotNetClient.DLL; it is due to be reclaimed in the future and
should not be used.

(send to client) id 0x0e: response to c->s 0x0e.
This may be safely ignored in preference of specifying database
negation behavior as the second parameter of 0x0a.

(send to server) id 0x10: set chat options
Contents:
(BYTE) Subcommand.  Presently only subcommand 0 is defined.
* Subcommand 0: chat drop options; the client may omit the
four bytes of data, in which case the command will not affect
current chat options but will still generate a notification of
resulting options.
(BYTE) setting for broadcast
(BYTE) setting for database
(BYTE) setting for whisper
(BYTE) refuse whispers from other databases
For each of the first three bytes, 0 (the default for
clients which do not send this message) allows all chat
to be received.  1 refuses chat from users who are not
on an account.  2 refuses all chat.  Note that messages
from administrators ignore these settings.  This command
is provided in recognition that some clients drop all
chat received from certain sources.  Such clients may
use this command to advise the server of their intent to
discard chat.
Response:
The server sends back a message with the same subcommand.  See below for contents.

(send to client) id 0x10: inform chat options
Contents:
(BYTE) Subcommand.  Presently only subcommand 0 is defined.
* Subcommand 0: chat drop options.  Same contents as 0x10 to server.

Current hub ids that are active:
[public:anypass], [rivalbot:anypass], [hukchat:anypass]
#2
.NET Platform / TimeZone
May 13, 2010, 08:01 AM
What is the equiv. to GetTimezineInformation in .Net.
When last I checked, I believe it was in "System.Time" which I guess was changed since 2002?
edit: For getting the Bias
#3
'Credits: MyndFyre, iago, Adron, yobguls, l)ragon
'Extended Credits: Maddox, RealityRipple, Yegg
'06-01-10, ---------------, Added latest edit of the 26 decode.
'05-25-10,    [BrokenSHA1], I guess VB still fails at math, problem (not) fixed random overflowing, tempfix remove integer overflow checking.
'05-19-10,           [NLS], Conversion of MSBNCSUTIL SRP class ">Not Tested<" (See second post)
'05-16-10, ---------------, Minor adjustments to the entire namespace.
'05-16-10, ---------------, Added RealityRipple/Yegg re-written Decoders.
'05-15-10, [ver-ix86-#-CV], Checkrevision in next code section working however need to clean it a little still.
'05-07-10,    [BrokenSHA1], Complete.
'05-06-10,      [Decode16], squashed some of the upper portion of the code, as well as the final loop.
'05-05-10,      [Decode26], CDKey Decode complete.
'05-04-10,      [Decode26], Thank warz, i got lazy and stripped my poor conversion from a few years ago.
'-------------------------- http://forum.valhallalegends.com/index.php?topic=12538.0
'05-03-10,      [Decode26], No its not complete yet.
'05-03-10,      [Decode16], CDKey Decode
'05-02-10,      [Decode13], CDKey Decode
Imports System
Imports System.IO
Imports System.Security.Cryptography
Imports System.Globalization
Imports System.Numerics 'Note you need to add referance to the Numerics dll

Namespace HashData

   Public Class CDKeys
#Region "Fields"
       Public key, decoded_key As String
       Private key2() As Char
       Public product, val1, val2 As UInt32
       Private w3Val2(9) As Byte
       Private hash() As Byte
       Private valid As Boolean
       Private isKey_26 As Boolean
#End Region

#Region "Class Propertys."
       Public ReadOnly Property ProductKey As Byte()
           Get
               Return BitConverter.GetBytes(product)
           End Get
       End Property
       Public ReadOnly Property Value1 As Byte()
           Get
               Return BitConverter.GetBytes(val1)
           End Get
       End Property
       Public ReadOnly Property Value2 As Byte()
           Get
               If isKey_26 Then
                   Return w3Val2
               Else
                   Return BitConverter.GetBytes(val2)
               End If
           End Get
       End Property
#End Region

#Region "Constants"
#Region "Starcraft"
       Private SC_KEYLEN As Integer = 13
#End Region
#Region "Warcraft II, Diablo II, Diablo II:Lords of Destruction"
       Private WC2_KEYLEN As Integer = 16
       Private D2_KEYLEN As Integer = 16
       Private LOD_KEYLEN As Integer = 16
#End Region
#Region "Warcraft III, Warcraft III:Frozen Throne, (NEW)Starcraft [Classic]"
       Private W3_KEYLEN As Integer = 26
       Private W3_BUFLEN As UInteger = (W3_KEYLEN * 2)
#End Region
#End Region

#Region "Char Maps"
#Region "Warcraft III, Warcraft III:Frozen Throne, (NEW)Starcraft [Classic]"
       Private ReadOnly TRANSLATEMAP()() As Byte = { _
           New Byte() {&H9, &H4, &H7, &HF, &HD, &HA, &H3, &HB, &H1, &H2, &HC, &H8, &H6, &HE, &H5, &H0},
           New Byte() {&H9, &HB, &H5, &H4, &H8, &HF, &H1, &HE, &H7, &H0, &H3, &H2, &HA, &H6, &HD, &HC},
           New Byte() {&HC, &HE, &H1, &H4, &H9, &HF, &HA, &HB, &HD, &H6, &H0, &H8, &H7, &H2, &H5, &H3},
           New Byte() {&HB, &H2, &H5, &HE, &HD, &H3, &H9, &H0, &H1, &HF, &H7, &HC, &HA, &H6, &H4, &H8},
           New Byte() {&H6, &H2, &H4, &H5, &HB, &H8, &HC, &HE, &HD, &HF, &H7, &H1, &HA, &H0, &H3, &H9},
           New Byte() {&H5, &H4, &HE, &HC, &H7, &H6, &HD, &HA, &HF, &H2, &H9, &H1, &H0, &HB, &H8, &H3},
           New Byte() {&HC, &H7, &H8, &HF, &HB, &H0, &H5, &H9, &HD, &HA, &H6, &HE, &H2, &H4, &H3, &H1},
           New Byte() {&H3, &HA, &HE, &H8, &H1, &HB, &H5, &H4, &H2, &HF, &HD, &HC, &H6, &H7, &H9, &H0},
           New Byte() {&HC, &HD, &H1, &HF, &H8, &HE, &H5, &HB, &H3, &HA, &H9, &H0, &H7, &H2, &H4, &H6},
           New Byte() {&HD, &HA, &H7, &HE, &H1, &H6, &HB, &H8, &HF, &HC, &H5, &H2, &H3, &H0, &H4, &H9},
           New Byte() {&H3, &HE, &H7, &H5, &HB, &HF, &H8, &HC, &H1, &HA, &H4, &HD, &H0, &H6, &H9, &H2},
           New Byte() {&HB, &H6, &H9, &H4, &H1, &H8, &HA, &HD, &H7, &HE, &H0, &HC, &HF, &H2, &H3, &H5},
           New Byte() {&HC, &H7, &H8, &HD, &H3, &HB, &H0, &HE, &H6, &HF, &H9, &H4, &HA, &H1, &H5, &H2},
           New Byte() {&HC, &H6, &HD, &H9, &HB, &H0, &H1, &H2, &HF, &H7, &H3, &H4, &HA, &HE, &H8, &H5},
           New Byte() {&H3, &H6, &H1, &H5, &HB, &HC, &H8, &H0, &HF, &HE, &H9, &H4, &H7, &HA, &HD, &H2},
           New Byte() {&HA, &H7, &HB, &HF, &H2, &H8, &H0, &HD, &HE, &HC, &H1, &H6, &H9, &H3, &H5, &H4},
           New Byte() {&HA, &HB, &HD, &H4, &H3, &H8, &H5, &H9, &H1, &H0, &HF, &HC, &H7, &HE, &H2, &H6},
           New Byte() {&HB, &H4, &HD, &HF, &H1, &H6, &H3, &HE, &H7, &HA, &HC, &H8, &H9, &H2, &H5, &H0},
           New Byte() {&H9, &H6, &H7, &H0, &H1, &HA, &HD, &H2, &H3, &HE, &HF, &HC, &H5, &HB, &H4, &H8},
           New Byte() {&HD, &HE, &H5, &H6, &H1, &H9, &H8, &HC, &H2, &HF, &H3, &H7, &HB, &H4, &H0, &HA},
           New Byte() {&H9, &HF, &H4, &H0, &H1, &H6, &HA, &HE, &H2, &H3, &H7, &HD, &H5, &HB, &H8, &HC},
           New Byte() {&H3, &HE, &H1, &HA, &H2, &HC, &H8, &H4, &HB, &H7, &HD, &H0, &HF, &H6, &H9, &H5},
           New Byte() {&H7, &H2, &HC, &H6, &HA, &H8, &HB, &H0, &HF, &H4, &H3, &HE, &H9, &H1, &HD, &H5},
           New Byte() {&HC, &H4, &H5, &H9, &HA, &H2, &H8, &HD, &H3, &HF, &H1, &HE, &H6, &H7, &HB, &H0},
           New Byte() {&HA, &H8, &HE, &HD, &H9, &HF, &H3, &H0, &H4, &H6, &H1, &HC, &H7, &HB, &H2, &H5},
           New Byte() {&H3, &HC, &H4, &HA, &H2, &HF, &HD, &HE, &H7, &H0, &H5, &H8, &H1, &H6, &HB, &H9},
           New Byte() {&HA, &HC, &H1, &H0, &H9, &HE, &HD, &HB, &H3, &H7, &HF, &H8, &H5, &H2, &H4, &H6},
           New Byte() {&HE, &HA, &H1, &H8, &H7, &H6, &H5, &HC, &H2, &HF, &H0, &HD, &H3, &HB, &H4, &H9},
           New Byte() {&H3, &H8, &HE, &H0, &H7, &H9, &HF, &HC, &H1, &H6, &HD, &H2, &H5, &HA, &HB, &H4},
           New Byte() {&H3, &HA, &HC, &H4, &HD, &HB, &H9, &HE, &HF, &H6, &H1, &H7, &H2, &H0, &H5, &H8}}
#End Region
#End Region

       Public Sub New(ByVal cdKey As String)
           InitalizePrivate(cdKey)
       End Sub

       Private Sub InitalizePrivate(ByVal cdKey As String)
           If IsNothing(cdKey) AndAlso (cdKey = "") Then
               '"CDKey is Missing."
               Exit Sub
           End If

           cdKey = cdKey.Replace("-", "")
           Me.key = cdKey
           isKey_26 = (cdKey.Length = W3_KEYLEN)
           Dim i As Integer

           Select Case cdKey.Length
               Case SC_KEYLEN
                   While (i < SC_KEYLEN)
                       If (Not Char.IsDigit(cdKey, i)) Then
                           '"You fail at SC"
                       End If
                       i += 1
                   End While
                   'decoded_key = Decode13(cdKey)
                   Call Decode13DigitKey(cdKey, product, val1, val2)
                   Exit Select
               Case WC2_KEYLEN ', D2_KEYLEN, LOD_KEYLEN
                   While (i < WC2_KEYLEN)
                       If Not (Char.IsLetterOrDigit(cdKey, i)) Then
                           '"You fail at WC2 or D2 or LOD"
                       End If
                       i += 1
                   End While
                   'decoded_key = Decode16(cdKey)
                   Call Decode16DigitKey(cdKey, product, val1, val2)
                   Exit Select
               Case W3_KEYLEN
                   While (i < W3_KEYLEN)
                       If Not (Char.IsLetterOrDigit(cdKey, i)) Then
                           '"You fail at WC3, WC3:TFT, NEWSCKEY"
                       End If
                       i += 1
                   End While
                   'DecodeWar3CDkey(cdKey)
                   Call Decode26DigitKey(cdKey, product, val1, w3Val2)
                   Exit Select
               Case Else
           End Select
       End Sub


#Region "Starcraft CDKey Decoder."
       Friend Sub Decode13DigitKey(ByVal Key As String, ByRef Product As UInt32, ByRef PublicVal As UInt32, ByRef PrivateVal As UInt32)
           Dim salt As Int32 = &H13AC9741, SEQ() As Byte = {6, 0, 2, 9, 3, 11, 1, 7, 5, 4, 10, 8}, Decoded(12) As Char
           For I As Int32 = 11 To 0 Step -1
               Dim C As Byte = Asc(Key.Substring(SEQ(I), 1))
               If C <= 55 Then Decoded(I) = Chr(C Xor (salt And 7)) : salt >>= 3 Else Decoded(I) = Chr(C Xor I And 1)
           Next
           If Key.EndsWith(GetLastVal(Key)) Then
               Dim sDone As String = Decoded
               Product = UInt32.Parse(sDone.Substring(0, 2), Globalization.NumberStyles.AllowHexSpecifier)
               PublicVal = sDone.Substring(2, 7)
               PrivateVal = sDone.Substring(9, 3)
           Else
               Product = 0 : PublicVal = 0 : PrivateVal = 0
           End If
       End Sub
       Private Function GetLastVal(ByVal sKey As String) As Char
           Dim lLenVal As UInt32 = 3, Key() As Char = sKey.ToCharArray
           For I As Int32 = 0 To 11
               lLenVal = lLenVal + (CStr(Key(I)) Xor (lLenVal * 2))
           Next I
           Return CStr(lLenVal Mod 10)
       End Function

       Private Function Decode13_Old(ByVal cdkey As String) As String
           Dim i, pos, accum As Int32
           Dim temp As Byte
           Dim HashKey As Int32 = &H13AC9741
           Dim KeyAr(&HC) As Byte
           key2 = cdkey.ToCharArray
           For i = &H0 To &HC
               KeyAr(i) = Asc(cdkey.Substring(i, &H1))
               'Debug.Print(Chr(KeyAr(i)))
           Next
           accum = &H3
           For i = &H0 To &HB
               accum += ((KeyAr(i) - &H30) Xor (accum * &H2))
           Next
           If Not ((accum Mod &HA) = (KeyAr(&HC) - &H30)) Then
               valid = False
               Erase KeyAr
               Return "your cdkey is shit"
           End If
           valid = True
           pos = &HB
           i = &HC2
           While i >= &H7
               temp = KeyAr(pos)
               KeyAr(pos) = KeyAr(i Mod &HC)
               KeyAr(i Mod &HC) = temp
               pos -= &H1
               i -= &H11
           End While
           i = cdkey.Length - &H2
           While i >= &H0
               temp = UCase(KeyAr(i))
               KeyAr(i) = temp
               If temp <= &H37 Then
                   KeyAr(i) = KeyAr(i) Xor (HashKey And &H7)
                   HashKey >>= &H3
               ElseIf temp < &H41 Then
                   KeyAr(i) = KeyAr(i) Xor (i And &H1)
               End If
               i -= &H1
           End While
           Dim tempKey As String = ""
           For i = &H0 To &HC
               tempKey &= Chr(KeyAr(i))
           Next
           'sscanf((const char *)arrayKey, "%2ld%7ld%3ld", &product, &value1, &value2);
           product = Integer.Parse(tempKey.Substring(&H0, &H2))
           val1 = Integer.Parse(tempKey.Substring(&H2, &H7))
           val2 = Integer.Parse(tempKey.Substring(&H9, &H3))
           Erase KeyAr
           Return tempKey
       End Function
#End Region
#Region "Warcraft II, Diablo II, Diablo II:Lords of destruction"
       Friend Sub Decode16DigitKey(ByVal Key As String, ByRef Product As UInt32, ByRef PublicVal As UInt32, ByRef PrivateVal As UInt32)
           Dim salt As Int32 = &H13AC9741, SEQ() As Byte = {5, 6, 0, 1, 2, 3, 4, 9, 10, 11, 12, 13, 14, 15, 7, 8}
           Const CodeValues As String = "246789BCDEFGHJKMNPRTVWXZ"
           Dim aryKey() As Char = Key.ToCharArray
           For I As Integer = 0 To 14 Step 2
               If Not CodeValues.Contains(aryKey(I + 1)) OrElse Not CodeValues.Contains(aryKey(I)) Then Exit Sub
               Dim N As Int32 = (CodeValues.IndexOf(aryKey(I + 1))) + (CodeValues.IndexOf(aryKey(I)) * 24) And &HFF
               aryKey(I) = Chr(IIf(((N >> 4) And &HF) < 10, ((N >> 4) And &HF) + &H30, ((N >> 4) And &HF) + &H37))
               aryKey(I + 1) = Chr(IIf((N And &HF) < 10, (N And &HF) + &H30, (N And &HF) + &H37))
           Next I
           Dim Decoded(15) As Char
           For I As Int32 = 15 To 0 Step -1
               Dim C As Byte = Asc(Char.ToUpper(aryKey(SEQ(I))))
               If C <= 55 Then
                   Decoded(I) = Chr(C Xor (salt And 7))
                   salt >>= 3
               ElseIf C < 65 Then
                   Decoded(I) = Chr(C Xor I And 1)
               Else
                   Decoded(I) = Chr(C)
               End If
           Next
           Dim sDone As String = Decoded
           Product = UInt32.Parse(sDone.Substring(0, 2), Globalization.NumberStyles.AllowHexSpecifier)
           PublicVal = UInt32.Parse(sDone.Substring(2, 6), Globalization.NumberStyles.AllowHexSpecifier)
           PrivateVal = UInt32.Parse(sDone.Substring(8), Globalization.NumberStyles.AllowHexSpecifier)
       End Sub

       Private Function getHexVal(ByVal val As Integer) As Char
           val = val And &HF
           Return Chr(IIf((val < &HA), (val + &H30), (val + &H37)))
       End Function
       Private Function getNumVal(ByVal c As Char) As Integer
           c = Char.ToUpper(c, CultureInfo.InvariantCulture)
           Return IIf((Char.IsDigit(c)), (Asc(c) - &H30), (Asc(c) - &H37))
       End Function
#End Region
#Region "Warcraft III, Warcraft III:Frozen Throne, (NEW)Starcraft Keys"
 Friend Sub Decode26DigitKey(ByVal Key As String, ByRef Product As UInt32, ByRef PublicVal As UInt32, ByRef PrivateVal() As Byte)
   Const CodeValues As String = "246789BCDEFGHJKMNPRTVWXYZ"
   Dim cKey() As Char = Key.ToCharArray
   Dim aOrd() As Byte = {30, 27, 24, 21, 18, 15, 12, 9, 6, 3, 0, 49,
                           46, 43, 40, 37, 34, 31, 28, 25,
                           22, 19, 16, 13, 10, 7, 4, 1, 50, 47, 44, 41,
                           38, 35, 32, 29, 26, 23, 20, 17,
                           14, 11, 8, 5, 2, 51, 48, 45, 42, 39, 36, 33}
   Dim n_digitsBase5(0 To 51) As Byte
   For I As Integer = 0 To 26 - 1
     If Not CodeValues.Contains(cKey(I)) Then Exit Sub
     Dim c As Byte = CodeValues.IndexOf(cKey(I))
     n_digitsBase5(aOrd(I * 2)) = CByte(c \ 5)
     n_digitsBase5(aOrd(I * 2 + 1)) = CByte(c Mod 5)
   Next I
   Dim n As System.Numerics.BigInteger = 0
   For I As Integer = 51 To 0 Step -1 : n = n * 5 + n_digitsBase5(I) : Next I
   Dim nbytes() As Byte = n.ToByteArray
   Dim nibbles(0 To 29) As Byte
   For I As Integer = 0 To 14
     For J As Integer = 0 To 1
       nibbles((I << 1) + J) = CByte((nbytes(I) >> (J << 2)) And CUInt(&HF))
     Next J
   Next I
   For R As Integer = 29 To 0 Step -1
     Dim perm() As Byte = TRANSLATEMAP(R)
     Dim c As Byte = nibbles(R)
     For r2 As Integer = 29 To 0 Step -1
       If R = r2 Then Continue For
       c = perm(nibbles(r2) Xor perm(c))
     Next r2
     nibbles(R) = perm(c)
   Next R
   Dim bits As New BitArray(128)
   For I As Integer = 0 To 29
     For J As Integer = 0 To 3
       Dim b As Boolean = CBool(((nibbles(I) >> J) And &H1) <> 0)
       bits.Set((I * 4 + J), b)
     Next J
   Next I
   For I As Integer = 0 To 119
     Dim J As Integer = (I * 11) Mod 120
     If J <= I Then Continue For
     Dim b As Boolean = bits.Get(I)
     bits(I) = bits(J)
     bits.Set(J, b)
   Next I
   Dim bb(0 To 14) As Byte
   For I As Integer = 0 To 14
     For J As Integer = 0 To 7
       If bits.Get((I << 3) + J) Then bb(I) = bb(I) Or CByte(&H1 << J)
     Next J
   Next I
   If bb(14) = &H0 Then
     Product = bb(&HD) >> &HA
     PublicVal = System.BitConverter.ToUInt32(bb, &HA) And &HFFFFFF
     Dim bOrder() As Byte = {8, 9, 4, 5, 6, 7, 0, 1, 2, 3}
     ReDim PrivateVal(9)
     For I As Integer = 0 To 9 : PrivateVal(I) = bb(bOrder(I)) : Next
   Else
     Product = 0
     PublicVal = 0
     Erase PrivateVal
   End If
 End Sub
#End Region

   End Class
End Namespace

Imports System.IO

Namespace HashData
   Module CheckRevision
       Private ReadOnly HashCodes() As Int32 = {&HE7F4CB62, &HF6A14FFC, &HAA5504AF, &H871FCDC2, _
                                                &H11BF6A18, &HC57292E6, &H7927D27E, &H2FEC8733}

       Public Function DoCheckrevision(ByVal exe As String, _
                                       ByVal dll As String, _
                                       ByVal snp As String, _
                                       ByVal hashcommand As String, _
                                       ByVal mpqname As String) As Boolean
           If InStr(mpqname.ToLower, "lockdown") > 0 Then
               Return False
           Else
               CheckRevisionVB(exe, dll, snp, hashcommand, CheckSumHash, ExeInfoStr, mpqname, VersionVal)
           End If
           Return True
       End Function

       Public Function CheckRevisionVB(ByVal exe As String, ByVal dll As String, ByVal snp As String, _
                                       ByVal HashCommand As String, _
                                       ByRef Checksum As Long, _
                                       ByRef exeInfo As String, _
                                       ByVal mpqName As String, _
                                       ByRef Ver As Long) As Boolean
           Dim Operations(3) As String
           Dim Values(3) As Long
           Dim opDest(3) As Integer
           Dim opSrc1(3) As Integer
           Dim opSrc2(3) As Integer
           Dim mpqNum As Integer = CInt(Val(Replace(Replace(Replace(Replace(LCase(mpqName), ".mpq", ""), "ix86", ""), "ver", ""), "-", "")))
           If mpqNum < 0 OrElse mpqNum > 7 Then
               Return False
           End If
           Dim i As Integer, j As Integer, k As Integer
           Dim FileNames(2) As String
           If exe = "" Then
               Return False
           End If
           FileNames(0) = exe
           If dll = "" Then
               Return False
           End If
           FileNames(1) = dll
           If snp = "" Then
               Return False
           End If
           FileNames(2) = snp

           InitVars(HashCommand, Values, opDest, opSrc1, Operations, opSrc2)

           Values(0) = (Values(0) Xor HashCodes(mpqNum)) And &HFFFFFFFFUI

           Dim currentOperandBuffer(1023) As Byte
           For i = 0 To 2 '# of files = 3
               Using currentfile As New FileStream(FileNames(i), FileMode.Open, FileAccess.Read, FileShare.Read)
                   While currentfile.Position < currentfile.Length
                       Dim currentFilePosition As Long = 0
                       Dim amountToRead As Long = Math.Min(currentfile.Length - currentfile.Position, 1024)
                       currentfile.Read(currentOperandBuffer, 0, amountToRead)

                       If (amountToRead < 1024) Then
                           Dim currentPaddingByte As Byte = Byte.Parse(&HFF)
                           For j = amountToRead To 1023
                               currentOperandBuffer(j) = currentPaddingByte
                               If currentPaddingByte = 0 Then
                                   currentPaddingByte = Byte.Parse(&HFF)
                               Else
                                   currentPaddingByte -= 1
                               End If
                           Next
                       End If

                       For j = 0 To 1023 Step 4
                           Values(3) = BitConverter.ToUInt32(currentOperandBuffer, j)

                           For k = 0 To 3 '# of operations = 4
                               Select Case (Operations(k))
                                   Case "+"
                                       Values(opDest(k)) = ((Values(opSrc1(k)) + Values(opSrc2(k)))) And UInt32.MaxValue
                                       Exit Select
                                   Case "-"
                                       Values(opDest(k)) = ((Values(opSrc1(k)) - Values(opSrc2(k)))) And UInt32.MaxValue
                                       Exit Select
                                   Case "^"
                                       Values(opDest(k)) = ((Values(opSrc1(k)) Xor Values(opSrc2(k)))) And UInt32.MaxValue
                                       Exit Select
                                   Case "*"
                                       Values(opDest(k)) = ((Values(opSrc1(k)) * Values(opSrc2(k)))) And UInt32.MaxValue
                                       Exit Select
                                   Case "/"
                                       Values(opDest(k)) = ((Values(opSrc1(k)) / Values(opSrc2(k)))) And UInt32.MaxValue
                                       Exit Select
                                   Case Else
                                       Exit Select
                               End Select
                           Next
                       Next
                   End While
               End Using
           Next
           exeInfo = FileNames(0)
           GetExeinfoAndVersion(exeInfo, Ver)

           Checksum = Values(2)
           Return True
       End Function

       Private Sub GetExeinfoAndVersion(ByRef exeInf As String, ByRef ver As Long)
           Dim eInfo As New FileInfo(exeInf)
           Dim fVer As FileVersionInfo = FileVersionInfo.GetVersionInfo(exeInf)
           Dim eLength As Long = eInfo.Length
           Dim eDate As String = " " & _
                                 lngStr(eInfo.LastWriteTimeUtc.Month) & "/" & _
                                 lngStr(eInfo.LastWriteTimeUtc.Day) & "/" & _
                                 lngStr(eInfo.LastWriteTimeUtc.Year) & _
                                 " " & _
                                 lngStr(eInfo.LastWriteTimeUtc.Hour) & ":" & _
                                 lngStr(eInfo.LastWriteTimeUtc.Minute) & ":" & _
                                 lngStr(eInfo.LastWriteTimeUtc.Second) & _
                                 " "

           exeInf = eInfo.Name & eDate & eLength.ToString
           Dim b(3) As Byte
           b(3) = fVer.ProductMajorPart And &HFFI
           b(2) = fVer.ProductMinorPart And &HFFI
           b(1) = fVer.ProductBuildPart And &HFFI
           b(0) = fVer.ProductPrivatePart And &HFFI
           ver = BitConverter.ToInt32(b, 0)
       End Sub

       Private Function lngStr(ByVal inVal As String) As String
           If inVal.Length = 1 Then
               Return "0" + inVal
           ElseIf inVal.Length = 4 Then
               Return Right(inVal, 2)
           Else
               Return inVal
           End If
       End Function

       Private Function getNum(ByVal c As String) As Integer
           Select Case UCase(c)
               Case "A"
                   Return 0
               Case "B"
                   Return 1
               Case "C"
                   Return 2
               Case "S"
                   Return 3
               Case Else
                   Return -1
           End Select
       End Function

       Public Sub InitVars(ByVal HashCommand As String, _
                           ByRef dwVars() As Long, _
                           ByRef varDest() As Integer, _
                           ByRef Val1() As Integer, _
                           ByRef Oper() As String, _
                           ByRef Val2() As Integer)
           Dim s() As String = Split(HashCommand, " ")
           Dim dwVariables(3) As Long
           Dim opValueDest(3) As Integer, opValueSrc1(3) As Integer, opValueSrc2(3) As Integer
           Dim operation(3) As String
           Dim NumberOfOperations As Integer

           Dim i As Integer
           For i = 0 To 2
               dwVariables(getNum(Mid(s(i), 1, 1))) = (Long.Parse(Mid(s(i), 3, s(i).Length)))
           Next
           dwVars = dwVariables

           NumberOfOperations = CInt(Val(s(3)))

           For i = 0 To (NumberOfOperations - 1)
               opValueDest(i) = getNum(Mid(s(i + 4), 1, 1))
               opValueSrc1(i) = getNum(Mid(s(i + 4), 3, 1))
               operation(i) = Mid(s(i + 4), 4, 1)
               opValueSrc2(i) = getNum(Mid(s(i + 4), 5, 1))
           Next
           varDest = opValueDest
           Val1 = opValueSrc1
           Oper = operation
           Val2 = opValueSrc2
       End Sub


   End Module
End Namespace

Namespace HashData
   Public Module BrokenSHA1 'Legacy hashing

       Public Function BuildCDKeyData(ByVal sKey As UInt32, ByVal cKey As UInt32, _
                                      ByVal ProdKey As UInt32, _
                                      ByVal val1 As UInt32, _
                                      ByVal val2 As UInt32, _
                                      ByVal KeyLength As UInt32) As Byte()
           Dim OutBuf(35) As Byte
           Array.Copy(BitConverter.GetBytes(KeyLength), 0, OutBuf, 0, 4)
           Array.Copy(BitConverter.GetBytes(UInt32.Parse(ProdKey)), 0, OutBuf, 4, 4)
           Array.Copy(BitConverter.GetBytes(val1), 0, OutBuf, 8, 4)
           Array.Copy(BitConverter.GetBytes(UInt32.Parse(&H0UI)), 0, OutBuf, 12, 4)
           Array.Copy(HashCDKey(sKey, cKey, ProdKey, val1, val2), 0, OutBuf, 16, 20)
           Return OutBuf
       End Function

       Public Function HashCDKey(ByVal ServerKey As UInt32, ByVal ClientKey As UInt32, _
                                 ByVal prodid As UInt32, ByVal val1 As UInt32, _
                                 ByVal val2 As UInt32) As Byte()
           Dim dwHashBuff(19) As Byte
           Dim tHashBuf(23) As Byte

           Array.Copy(BitConverter.GetBytes(ClientKey), 0, tHashBuf, 0, 4)
           Array.Copy(BitConverter.GetBytes(ServerKey), 0, tHashBuf, 4, 4)
           Array.Copy(BitConverter.GetBytes(prodid), 0, tHashBuf, 8, 4)
           Array.Copy(BitConverter.GetBytes(val1), 0, tHashBuf, 12, 4)
           Array.Copy(BitConverter.GetBytes(UInt32.Parse(0)), 0, tHashBuf, 16, 4)
           Array.Copy(BitConverter.GetBytes(val2), 0, tHashBuf, 20, 4)

           dwHashBuff = SafeHash(tHashBuf)
           Erase tHashBuf
           Return dwHashBuff
       End Function

       Public Function HashPass(ByVal password As String, ByVal val1 As Int32, ByVal val2 As Int32) As Byte()
           Dim passwordhash() As Byte = CreateAccount(password)
           Dim tmpBuf(19) As Byte
           Dim p1(7) As Byte
           Dim p1ph(27) As Byte
           Array.Copy(BitConverter.GetBytes(val1), 0, p1, 0, 4)
           Array.Copy(BitConverter.GetBytes(val2), 0, p1, 4, 4)

           Array.Copy(p1, 0, p1ph, 0, 8)
           Array.Copy(passwordhash, 0, p1ph, 8, 20)

           passwordhash = SafeHash(p1ph)

           Array.Copy(p1, 0, p1ph, 0, 8)
           Array.Copy(passwordhash, 0, p1ph, 8, 20)

           Erase p1
           Erase passwordhash
           Erase tmpBuf
           Return p1ph
       End Function
       Public Function CreateAccount(ByVal password As String) As Byte()
           Dim dwHashBuffer(19) As Byte
           dwHashBuffer = SafeHash(System.Text.Encoding.ASCII.GetBytes(password))
           Return dwHashBuffer
       End Function


       Private Function ROL(ByVal val As UInteger, ByVal shift As Integer) As UInteger
           shift = shift And &H1F
           val = (val >> (32 - shift)) Or (val << shift)
           Return val
       End Function

       Private Function ForceUint(ByVal inVal As Double) As UInteger
           While inVal > UInteger.MaxValue
               inVal -= 4294967296
           End While
           While inVal < UInteger.MinValue
               inVal += 4294967296
           End While
           Return inVal
       End Function
       Private Function Add(ByVal number1 As Double, ByVal number2 As Double) As UInteger
           Return ForceUint(CDbl(number1) + CDbl(number2))
       End Function

       Public Function SafeHash(ByVal InBuf() As Byte) As Byte()
           If (InBuf.Length > 1024) Then Throw New ArgumentOutOfRangeException("<InBuf()> Error data exceeded 1024 bytes")
           Dim data(1023) As Byte
           Array.Copy(InBuf, 0, data, 0, InBuf.Length)
           Dim i As Int32
           Dim mdata As MemoryStream = New MemoryStream(data, True)
           Dim br As BinaryReader = New BinaryReader(mdata)
           Dim bw As BinaryWriter = New BinaryWriter(mdata)
           Dim a, b, c, d, e, g As UInteger
           Dim expr_ldata_i, expr_ldata_i_2, expr_ldata_i_8, expr_ldata_i_13 As UInteger
           Dim shiftVal As Int32
           For i = 0 To 63
               mdata.Seek((i * 4), SeekOrigin.Begin)
               '// mdata now at ldata[i]
               expr_ldata_i = br.ReadUInt32()
               '// mdata now at ldata[i+1]
               mdata.Seek(1 * 4, SeekOrigin.Current)
               '// mdata now at ldata[i+2]
               expr_ldata_i_2 = br.ReadUInt32()
               '// mdata now at ldata[i+3]
               mdata.Seek(5 * 4, SeekOrigin.Current)
               '// mdata now at ldata[i+8]
               expr_ldata_i_8 = br.ReadUInt32()
               '// mdata now at ldata[i+9]
               mdata.Seek(4 * 4, SeekOrigin.Current)
               '// mdata now at ldata[i+13]
               expr_ldata_i_13 = br.ReadUInt32()
               '// mdata now at ldata[i+14]
               shiftVal = ((expr_ldata_i Xor expr_ldata_i_8 Xor expr_ldata_i_2 Xor expr_ldata_i_13) And &H1F) And Int32.MaxValue
               mdata.Seek(2 * 4, SeekOrigin.Current)
               '// mdata now at ldata[i+16]
               bw.Write(ROL(1, shiftVal))
           Next
           a = &H67452301L
           b = &HEFCDAB89L
           c = &H98BADCFEL
           d = &H10325476L
           e = &HC3D2E1F0L
           g = 0

           mdata.Seek(0, SeekOrigin.Begin)

           For i = 0 To 79
               g = br.ReadUInt32()
               g = Add(g, e)
               g = Add(g, ROL(a, 5))
               Select Case i
                   Case Is < 20
                       g = Add(g, ((b And c) Or ((Not b) And d)))
                       g = Add(g, &H5A827999L)
                   Case Is < 40
                       g = Add(g, (d Xor c Xor b))
                       g = Add(g, &H6ED9EBA1L)
                   Case Is < 60
                       g = Add(g, (c And b) Or (d And c) Or (d And b))
                       g = Add(g, &H8F1BBCDCL)
                   Case Is < 80
                       g = Add(g, (d Xor c Xor b))
                       g = Add(g, &HCA62C1D6L)
               End Select
               e = d
               d = c
               c = ROL(b, 30)
               b = a
               a = g
           Next
           br.Close()
           bw.Close()
           mdata.Close()

           Dim result As Byte() = New Byte(19) {}
           mdata = New MemoryStream(result, 0, 20, True, True)
           bw = New BinaryWriter(mdata)
           bw.Write(Add(&H67452301UI, a))
           bw.Write(Add(&HEFCDAB89UI, b))
           bw.Write(Add(&H98BADCFEUI, c))
           bw.Write(Add(&H10325476UI, d))
           bw.Write(Add(&HC3D2E1F0UI, e))

           mdata.Close()
           bw.Close()

           Return result
       End Function

   End Module
End Namespace


Obvious rehash, this way I wont lose my shit this time around.
Not a final, I will be adding to this as I get time to.

If you improve upon what ever's here be sure to leave a note about it, goes for what ever
#4
General Programming / Intellesence not in C++
May 01, 2010, 08:21 PM
Anyone else thinking they're not adding it on purpos?
#5
Gaming Discussion / ut3
July 09, 2009, 02:01 AM
who has it lol, pm me user names so i can add you.
#6
just wondering how many of you are actually in school, or are looking into going for web development.
#7
General Programming / blackberry
September 18, 2008, 09:14 AM
I haven't looked yet but does anyone know offhand if there's an SDK for these devices?
#8
Warcraft / what server you all on
September 13, 2008, 07:59 PM
maybe we should all band together and form 1 guild somewhere would have to be a PvP server though :P

Alliance: 70 Warrior, 70 Priest, 70 Warlock
Horde: 43 Paly(and leveling)

edited: class's that i have
#10
.NET Platform / CodeDom
March 08, 2007, 12:31 PM
Just wondering, when working with this building the base classes and such how can I go about exposeing a said control to my scripts?
#11
I have been working with a company now for I guess almost 2 years now, when they hired me they knew I never had a drivers license and it was okayed with one of our VP's at the time.

Well today I got fired and their reason was because I'm not licensed to drive I'm no longer fit to work with the company, I have a witness which was also there to hear this reason.

I have never signed anything telling me I should get one nor has anyone told me to get one, so I kind of have a little bit of a problem comprehending how he can do this and how much damage I can do to this company with the reason given to me.

Thanks.
#12
Fun Forum™ / Yup it happend allright.
January 26, 2007, 06:30 PM
Leaked Bl!zzard lockdown sourcecode: Click
#13
http://www.youtube.com/watch?v=jM9c1AUxyjo
Kinda cartoony heh, think they'll ruin the old game or what?
#14
Warcraft / Patch 2.0.1
December 06, 2006, 06:48 PM
What do you guys think of it so far.
#15
I've noticed a few times now the the function isn't allways sending the current version byte is it soposed to be like this?
#16
Supported list, mostly untested aswell.

#define BNLS_NULL                       (0x00) //supported
#define BNLS_CDKEY                      (0x01) //supported
#define BNLS_LOGONCHALLENGE             (0x02) //supported
#define BNLS_LOGONPROOF                 (0x03) //supported
#define BNLS_CREATEACCOUNT              (0x04) //supported
#define BNLS_CHANGECHALLENGE            (0x05) //supported
#define BNLS_CHANGEPROOF                (0x06) //supported
#define BNLS_UPGRADECHALLENGE           (0x07) //supported
#define BNLS_UPGRADEPROOF               (0x08) //supported
#define BNLS_CONFIRMLOGON               (0x0a) //supported
#define BNLS_HASHDATA                   (0x0b) //supported
#define BNLS_CDKEY_EX                   (0x0c) //supported, not fully
#define BNLS_CHOOSENLSREVISION          (0x0d) //supported
#define BNLS_AUTHORIZE                  (0x0e) //supported
#define BNLS_AUTHORIZEPROOF             (0x0f) //supported
#define BNLS_REQUESTVERSIONBYTE         (0x10) //supported
#define BNLS_VERIFYSERVER               (0x11) //supported
#define BNLS_VERSIONCHECKEX2            (0x1a) //supported


Link: is in my profile go there and click files.

Link above is to the BNLS dll I have been building, it also includes a sample app.
Sample app includes a Function name DebugOutPut, you can thank Grok for that function.
Its primary use is for Checkrevision ATM, read the readme.
#17
Battle.net Bot Development / Botnet
November 12, 2006, 07:06 PM
Does a public database not have rights to speak on botnet anymore?
#18
BigInt modules for basic.
http://www.home.zonnet.nl/vspickelen/Largefiles/LargeInt.htm

Looks pretty well done heh.
#19
General Programming / Moveing from MySQL to MSSQL.
September 30, 2006, 06:35 PM
Whats the best way to go around this without haveing to make mass edits to all the query strings EG:.
        'MySQL
        'sqlCRQuery = "INSERT INTO " & db_item_Header & "(" & db_item_PageID & ", " & db_item_PageText & ", " & db_item_NextPage & ", " & db_item_WDBVersion & ", " & db_item_Checksum & ") VALUES (""" & PageID & """, """ & TestFixString(PageText) & """, """ & NextPageID & """, """ & WDBVersion & """, """ & CLng(CheckSum) & """)"
        'MS-SQL
        sqlCRQuery = "INSERT INTO " & db_item_Header & "(" & db_item_PageID & ", " & db_item_PageText & ", " & db_item_NextPage & ", " & db_item_WDBVersion & ", " & db_item_Checksum & ") VALUES (" & PageID & ", '""" & TestFixString(PageText) & """', " & NextPageID & ", " & WDBVersion & ", " & CLng(CheckSum) & ")"
#20
Computer Support Issues / Popup of missing files.
September 10, 2006, 04:58 AM
Keep in mind this is a fresh install of Windows 2000.


I am getting a popup of the folowing.

Title: aim.exe - no disk
Message: There is no disk in the drive. Please insert a disk into drive A:.

This is not the only popup I've had got a cupple others from befor I even installed anything, and the 'message' of the popup hasen't changed.

From what I have seen around the net its people are saying its from malware etc, and recomending to run hijackthis etc. well ran that and it cant find any problems, I doubt it's a malware problem anyhow seeing as it started right after I installed Windows 2000.

What you guys think bad install or what heh.