[PHP - CLIENT] Session Encrypt

10/25/2013 20:14 Sm•ke#1
Hi community, today i release the encrypt of session packet written by me ^^

Code:
<?php
	function sessionEncrypt($identifier, $session)
	{
		$table = array(  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,
						 99, 100, 101, 102, 103, 104, 105, 106, 107, 108,
						115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
						131, 132, 133, 134, 135, 136, 137, 138, 139, 140,
						147, 148, 149, 150, 151, 152, 153, 154, 155, 156,
						163, 164, 165, 166, 167, 168, 169, 170, 171, 172,
						179, 180, 181, 182, 183, 184, 185, 186, 187, 188,
						195, 196, 197, 198, 199, 200, 201, 202, 203, 204,
						211, 212, 213, 214, 215, 216, 217, 218, 219, 220,
						227, 228, 229, 230, 231, 232, 233, 234, 235, 236 );
		
		$str_enc = chr(154); // 0x9A
		
		$temp = $identifier[0].$identifier[1];
		$str_enc .= chr($table[(int)$temp]); // example --> 0xA6
		$temp = $identifier[2].$identifier[3];
		$str_enc .= chr($table[(int)$temp]); // example --> 0x84
		
		switch((int)$identifier[4])
		{
			case 0:
				$str_enc .=  chr(80); // 0x50
				break;
			case 1:
				$str_enc .=  chr(96); // 0x60 <-- example
				break;
			case 2:
				$str_enc .= chr(112); // 0x70
				break;
			case 3:
				$str_enc .= chr(128); // 0x80
				break;
			case 4:
				$str_enc .= chr(144); // 0x90
				break;
			case 5:
				$str_enc .= chr(160); // 0xA0
				break;
			case 6:
				$str_enc .= chr(176); // 0xB0
				break;
			case 7:
				$str_enc .= chr(192); // 0xC0
				break;
			case 8:
				$str_enc .= chr(208); // 0xD0
				break;
			case 9:
				$str_enc .= chr(224); // 0xE0
				break;
		}
		
		$temp = $session[0].$session[1];
		$str_enc .= chr($table[(int)$temp]); // example --> 0x64
		$temp = $session[2].$session[3];
		$str_enc .= chr($table[(int)$temp]); // example --> 0x86
		
		switch((int)$session[4])
		{
			case 0:
				$str_enc .=  chr(79); // 0x4F
				break;
			case 1:
				$str_enc .=  chr(95); // 0x5F
				break;
			case 2:
				$str_enc .= chr(111); // 0x6F
				break;
			case 3:
				$str_enc .= chr(127); // 0x7F
				break;
			case 4:
				$str_enc .= chr(143); // 0x8F
				break;
			case 5:
				$str_enc .= chr(159); // 0x9F <-- example
				break;
			case 6:
				$str_enc .= chr(175); // 0xAF
				break;
			case 7:
				$str_enc .= chr(191); // 0xBF
				break;
			case 8:
				$str_enc .= chr(207); // 0xCF
				break;
			case 9:
				$str_enc .= chr(223); // 0xDF
				break;
		}
		
		return $str_enc .= chr(14);
	}
	
	// 54321 = identifier
	// 12345 = session
	$encryptedSession = sessionEncrypt("54321", "12345");
?>
WORK WITH AN IDENTIFIER AND A SESSION OF 5 CHARS..
TESTED ON OFFICIAL SERVER..

GOOD LUCK,
:pimp: SMOKE.
10/25/2013 21:18 ernilos#2
¿Why always post 1 function for thread? You don't know what's update a thread?
10/25/2013 21:35 Sm•ke#3
Quote:
Originally Posted by ernilos View Post
¿Why always post 1 function for thread? You don't know what's update a thread?
When you say me 'Why ernilos say always bullshit or useless words in threads of Nostale', i say you the solution of your question..