Register for your free account! | Forgot your password?

Go Back   elitepvpers > Conquer Online 2 > CO2 PServer - Discussions / Questions
You last visited: Today at 08:01

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


Auth Crypto - stackoverflow exception? C_C

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Dec 2012
Posts: 1,609
Received Thanks: 829
Auth Crypto - overflow exception? C_C

Ripped the auth crypto from albetros and when it's creating the keys then I get a overflow exception.

Code:
			CryptKey1 = new byte[0x100];
			CryptKey2 = new byte[0x100];
			byte i_key1 = 0x9D;
			byte i_key2 = 0x62;
			for (int i = 0; i < 0x100; i++)
			{
				CryptKey1[i] = i_key1;
				CryptKey2[i] = i_key2;
				i_key1 = (byte)((0x0F + (byte)(i_key1 * 0xFA)) * i_key1 + 0x13);
				i_key2 = (byte)((0x79 - (byte)(i_key2 * 0x5C)) * i_key2 + 0x6D);
			}
Perhaps anyone here that can spot the error?

To be specific it throws it already from the start at:
Code:
i_key1 = (byte)((0x0F + (byte)(i_key1 * 0xFA)) * i_key1 + 0x13);
When i is 0.



Super Aids is offline  
Old 02/01/2013, 19:05   #2
 
elite*gold: 0
Join Date: May 2005
Posts: 1,892
Received Thanks: 913
There's nothing in the method that would cause that. Perhaps you're causing a stack overflow on another thread?


Lateralus is offline  
Old 02/01/2013, 19:08   #3
 
elite*gold: 0
Join Date: Dec 2012
Posts: 1,609
Received Thanks: 829
I tried to do this as the first thing in main and it still caused it. And exactly my though... It's really mind bugging me.

And my bad, not stack overflow, just overflow... xD
Super Aids is offline  
Old 02/01/2013, 19:19   #4
 
elite*gold: 0
Join Date: May 2005
Posts: 1,892
Received Thanks: 913
It really shouldn't be overflowing based on the arithmetic, but you can try using the unchecked statement/operator. I'm sure there's some option in the compiler to default to truncate if overflow, but I don't know it, because I've never needed to find it.

Code:
unchecked
{
    i_key1 = (byte)((0x0F + (byte)(i_key1 * 0xFA)) * i_key1 + 0x13);
    i_key2 = (byte)((0x79 - (byte)(i_key2 * 0x5C)) * i_key2 + 0x6D);
}
or

Code:
i_key1 = unchecked((byte)((0x0F + (byte)(i_key1 * 0xFA)) * i_key1 + 0x13));
i_key2 = unchecked((byte)((0x79 - (byte)(i_key2 * 0x5C)) * i_key2 + 0x6D));

Edit: "Note that Visual Studio does not turn on overflow checking by default in either release or debug builds. You need to turn on the Check for Arithmetic Overflow setting in the Build Properties for the project - but make sure you have the Debug configuration selected when you do this."


Lateralus is offline  
Old 02/01/2013, 19:58   #5
 
elite*gold: 0
Join Date: Dec 2012
Posts: 1,609
Received Thanks: 829
I'm not using Visual Studio though. I'm using Sharpdevelop, but will try that thanks.

#Edit got it working by turning that off and it caused problems with all my cryptos XD

This can be closed now... Finally!! XD
Super Aids is offline  
Old 02/01/2013, 21:36   #6
 
elite*gold: 0
Join Date: Jul 2006
Posts: 1,931
Received Thanks: 662
Try using Int32 and Byte.
KraHen is offline  
Old 02/01/2013, 21:57   #7
 
elite*gold: 0
Join Date: Dec 2012
Posts: 1,609
Received Thanks: 829
Already got it fixed bro.
Super Aids is offline  
Old 02/01/2013, 22:05   #8

 
elite*gold: 0
Join Date: Jan 2008
Posts: 1,394
Received Thanks: 1,054
Quote:
Originally Posted by KraHen View Post
Try using Int32 and Byte.
What's the difference ? byte and int are aliases of Byte and Int32. They result in the same IL code.


CptSky is offline  
Thanks
1 User
Reply



« Subclass SpawnPacket | Couple of Questions »

Similar Threads
the exception unknown software exception
02/04/2012 - Archlord - 4 Replies
Hello all!When i start the game i select europe and after says the exception unknown software exception click ok to terminate the program.PLease help me guys to solve this problem1Have a nice day
Selling Runescape Both Auth Codes Only 5$ each for ANY auth regular price is 10$-30$
02/19/2011 - Runescape Trading - 5 Replies
Any auth code is 5$ send me a Pm or leave a post to tell me which ones you would like http://img260.imageshack.us/img260/2675/runescapeauths.png
hab in auth ordner usr/rain/auth den kompletten inhalt gelöscht
04/09/2010 - Metin2 PServer - Discussions / Questions - 2 Replies
hi ich hab in auth ordner also usr/rain/auth den kompletten inhalt gelöscht und eine datei erstellt mit #!/bin/sh ./auth sleep 60*5 ./auth.sh nochmal ne kurzfassung: ich hab versucht den login bug zu fixxen bin in /usr/rain/auth und hab...



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


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Abuse
Copyright ©2018 elitepvpers All Rights Reserved.