Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Programming
You last visited: Today at 01:34

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Porting AuthProtocolCryptographer to VB.NET

Discussion on Porting AuthProtocolCryptographer to VB.NET within the CO2 Programming forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Feb 2005
Posts: 156
Received Thanks: 9
Porting AuthProtocolCryptographer to VB.NET

Sup guys, as I like to program on VB.NET i'm trying to convert this class to VB but when i start a new instance of it:
Dim crypto as New AuthProtocolCryptographer im getting a b0f right here:

i_key1 = CByte((&HF + CByte(i_key1 * &HFA)) * i_key1 + &H13)

Heres the full source, corrections are appreciated:

Code:
Public Class AuthProtocolCryptographer
    Friend Class CryptCounter
        Private m_Counter As UInt16 = 0

        Public ReadOnly Property Key2() As Byte
            Get
                Return CByte(m_Counter >> 8)
            End Get
        End Property

        Public ReadOnly Property Key1() As Byte
            Get
                Return CByte(m_Counter And &HFF)
            End Get
        End Property

        Public Sub Increment()
            m_Counter += 1
        End Sub
    End Class

    Private _decryptCounter As CryptCounter
    Private _encryptCounter As CryptCounter
    Private _cryptKey1 As Byte()
    Private _cryptKey2 As Byte()

    Public Sub New()
        _decryptCounter = New CryptCounter()
        _encryptCounter = New CryptCounter()
        _cryptKey1 = New Byte(255) {}
        _cryptKey2 = New Byte(255) {}
        Dim i_key1 As Byte = &H9D
        Dim i_key2 As Byte = &H62
        For i As Integer = 0 To 255
            _cryptKey1(i) = i_key1
            _cryptKey2(i) = i_key2
            i_key1 = CByte((&HF + CByte(i_key1 * &HFA)) * i_key1 + &H13)
            i_key2 = CByte((&H79 - CByte(i_key2 * &H5C)) * i_key2 + &H6D)
        Next
    End Sub

    Public Sub Encrypt(ByRef buffer As Byte())
        For i As Integer = 0 To buffer.Length - 1
            buffer(i) = buffer(i) Xor CByte(_cryptKey1(_encryptCounter.Key1) Xor _cryptKey2(_encryptCounter.Key2))
            buffer(i) = CByte(buffer(i) >> 4 Or buffer(i) << 4)
            buffer(i) = buffer(i) Xor CByte(&HAB)
            _encryptCounter.Increment()
        Next
    End Sub

    Public Sub Decrypt(ByRef buffer As Byte())
        For i As Integer = 0 To buffer.Length - 1
            buffer(i) = buffer(i) Xor CByte(&HAB)
            buffer(i) = CByte(buffer(i) >> 4 Or buffer(i) << 4)
            buffer(i) = buffer(i) Xor CByte(_cryptKey2(_decryptCounter.Key2) Xor _cryptKey1(_decryptCounter.Key1))
            _decryptCounter.Increment()
        Next
    End Sub
End Class
vDrag0n is offline  
Old 11/14/2010, 19:54   #2
 
elite*gold: 20
Join Date: Aug 2007
Posts: 1,749
Received Thanks: 2,198
Project -> Project Properties -> Compile -> Advanced Compile Options -> Remove integer overflow checks



Either that or change all your bytes to SBytes (Dim *** As Byte -> Dim *** As SByte)
IAmHawtness is offline  
Thanks
1 User
Old 11/14/2010, 19:57   #3
 
elite*gold: 0
Join Date: Feb 2005
Posts: 156
Received Thanks: 9
I guess the second option is better? but still thanks for the answer i'll try it.
vDrag0n is offline  
Old 11/14/2010, 20:01   #4
 
elite*gold: 20
Join Date: Aug 2007
Posts: 1,749
Received Thanks: 2,198
Quote:
Originally Posted by vDrag0n View Post
I guess the second option is better? but still thanks for the answer i'll try it.
Doesn't matter what you use really. Second option is more programatically correct, but both methods do the same so who cares
IAmHawtness is offline  
Reply


Similar Threads Similar Threads
[Guide] Animation Porting
03/30/2010 - World of Warcraft - 0 Replies
Tools needed: *ModIt: http://www.file-upload.net/download-2214279/ModIt. 7z.html *ChangeAnimations.py: http://code.google.com/p/pym2/source/browse/trunk/ examples/ChangeAnimations.py *PyM2: http://code.google.com/p/pym2/source/browse/trunk/ *A Python Interpreter *Notepad++ or any other texteditor Step 1: Find the correct Bones Open ModIt, navigate to the correct model, then click View->Show model control, enable Bones, disable Render.
Porting Code Help
04/03/2009 - General Coding - 2 Replies
Hey, I have been trying to port some code into any language, and not having any luck at all. A user on here (Atheuz) gave me some old source to an old bot he used to use, but my knowledge is not far enough to fill in the blanks. I tried porting in C++, but had too much trouble. I was wondering if anyone could try this for me, I would greatly appreciate it. Basically it's a bot for Phoenix Dynasty Online, that simply right clicks monsters. The memory addresses will have to be adjusted...
Porting from the North Dock to Roc Mountain. I TYPED THE CORRECT CODE!
03/09/2009 - Silkroad Online - 1 Replies
Hey guys, This is the code i pasted in the script. Itīs only the "portpart": "-2625","379","1" "cmd","","" "Inject","745A","6802000 0" "Inject","7495","6802000 00216000000"
.:AgBot:. bot isn't porting to roc
08/22/2008 - Silkroad Online - 4 Replies
hey i want to bot with agbot at roc but somehow it doesn't wanna port from hotan north dock to roc north dock this is my script; "cmd","","" "cmd","","" "cmd","","" "cmd","","" "ConditionScript","114;10;100" ;,"1" "98","53","1"



All times are GMT +2. The time now is 01:34.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.