Bypass test cookie slowAES protection with .Net C# [full code]

 Bypassing test cookie anti webscraping protection with c#

Hello friends, when I try to get the content of a web site, I've noticed that the content of page got from HttpWebRequest is not the same seen on the browser. The response of request was like :

<html>

<body>
    <script type="text/javascript" src="/aes.js"></script>
    <script>
        function toNumbers(d) {
            var e = [];
            d.replace(/(..)/g, function(d) {
                e.push(parseInt(d, 16))
            });
            return e
        }

        function toHex() {
            for (var d = [], d = 1 == arguments.length &&
            arguments[0].constructor == Array ? arguments[0] :
            arguments, e = "", f = 0; f < d.length; f++) e +=
            (16 > d[f] ? "0" : "") + d[f].toString(16);
            return e.toLowerCase()
        }
        var a = toNumbers("f655ba9d09a112d4968c63579db590b4"),
            b = toNumbers("98344c2eee86c3994890592585b49f80"),
            c = toNumbers("a76ce883a42eb6e9fff3e05d9cc6c7e5");
        document.cookie = "__test=" + toHex(slowAES.decrypt(c, 2, a, b)) +
        "; expires=Thu, 31-Dec-37 23:55:55 GMT; path=/";
        location.href = "http://www.namazvakitleri.site/i=1";
    </script>
    <noscript>
        This site requires Javascript to work, please enable
Javascript in your browser or use a browser with Javascript support
</noscript>

</body>

</html>


This Javascript generates a unique cookie (based on client's IP address) and set it to client's cookies like 
: __test : e0b2e8876a97dbb86398701b67e3dc83 

and redirect client to the same adress with an extra argument (querystring) called i, for my situation, I see some other qs's like attemp etc.

on the second sequence, server checks the cookie exists, then redirect page you actually wanted.
this value is a MD5 generated value based client ip + somesecrettext;
MD5("192.168.0.1" + "keepmesecret") if you can get the same value from different browsers. Sometimes, some server admins can add the useragent info of browser.

There is a way to bypass it, by trying MD5 encryption with Hashcat, but it's hard way to go for me, another way is run this script like a javascript and get final cookie value.

First we have to obtain a,b,c vars in response :

           HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(
               "http://www.namazvakitleri.site/");
           myRequest.Method = "GET";
           HttpWebResponse myResponse;
           StreamReader sr;
           string result;
           myResponse = (HttpWebResponse)myRequest.GetResponse();
           sr = new StreamReader(myResponse.GetResponseStream(),
               System.Text.Encoding.UTF8);
           result = sr.ReadToEnd();
           string abc;
           int loc = result.IndexOf("var a=toNumbers(");
           string temp = result.Substring(loc, result.Length-loc);
           temp = temp.Replace("var a=toNumbers(\"""");
           loc = temp.IndexOf('"');
           a = temp.Substring(0,loc);
           temp = temp.Replace(a + "\"),b=toNumbers(\"""");
           loc = temp.IndexOf('"');
           b = temp.Substring(0, loc);
           temp = temp.Replace(b + "\"),c=toNumbers(\"""");
           loc = temp.IndexOf('"');
           c = temp.Substring(0, loc);
           textBox1.AppendText("a : " + a + "\r\n");
           textBox1.AppendText("b : " + b + "\r\n");
           textBox1.AppendText("c : " + c + "\r\n");
and we have a,b,c vars in string. In the script string hex variables converted into byte arrays, this function help us with it :

Conversion of string hex to byte array (c#)

byte[] toNumbers(string hex)
{
      return Enumerable.Range(0, hex.Length)
               .Where(x => x % 2 == 0)
               .Select(x => Convert.ToByte(hex.Substring(x, 2), 16))
               .ToArray();
}

convert all of them to byte arrays :

    byte[] anumbers = toNumbers(a);
    byte[] bnumbers = toNumbers(b);
    byte[] cnumbers = toNumbers(c);
ok, hex string values are in byte arrays now. 
Then we have to obtain slowAES.decrypt(c, 2, a, b) on C#, this returns byte array and we need to convert it into hex string back with this function :

Conversion of byte array to hex string (c#)

string toHex(byte[] inp)
        {
            string temp = BitConverter.ToString(inp);
            temp = temp.Replace("-""");
            return temp;
        }

Obtaining slowAES.decrypt(c,2,a,b) on C#

I try to get aes.js from page I tested by browsing : http://www.namazvakitleri.site/aes.js, you can also try to get yours, if yours is the same with mine, you are lucky, just copy class and use it. 

The content I seen is :

aes.js

/*
 * aes.js: implements AES - Advanced Encryption Standard
 * from the SlowAES project, http://code.google.com/p/slowaes/
 * 
 * Copyright (c) 2008 	Josh Davis ( http://www.josh-davis.org ),
 *						Mark Percival ( http://mpercival.com ),
 *
 * Ported from C code written by Laurent Haan ( http://www.progressive-coding.com )
 * 
 * Licensed under the Apache License, Version 2.0
 * http://www.apache.org/licenses/
 */

var slowAES = {
	/*
	 * START AES SECTION
	 */
	aes:{
		// structure of valid key sizes
		keySize:{
			SIZE_128:16,
			SIZE_192:24,
			SIZE_256:32
		},
		
		// Rijndael S-box
		sbox:[
		0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
		0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0,
		0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15,
		0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75,
		0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84,
		0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf,
		0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8,
		0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2,
		0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73,
		0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb,
		0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79,
		0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08,
		0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a,
		0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e,
		0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf,
		0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 ],
		
		// Rijndael Inverted S-box
		rsbox:
		[ 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb
		, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb
		, 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e
		, 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25
		, 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92
		, 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84
		, 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06
		, 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b
		, 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73
		, 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e
		, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b
		, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4
		, 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f
		, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef
		, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61
		, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d ],
		
		/* rotate the word eight bits to the left */
		rotate:function(word)
		{
			var c = word[0];
			for (var i = 0; i < 3; i++)
				word[i] = word[i+1];
			word[3] = c;
			
			return word;
		},
		
		// Rijndael Rcon
		Rcon:[
		0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8,
		0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3,
		0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f,
		0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d,
		0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab,
		0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d,
		0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25,
		0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01,
		0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d,
		0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa,
		0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a,
		0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02,
		0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a,
		0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef,
		0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94,
		0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04,
		0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f,
		0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5,
		0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33,
		0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb ],

		G2X: [
		0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e, 0x10, 0x12, 0x14, 0x16,
		0x18, 0x1a, 0x1c, 0x1e, 0x20, 0x22, 0x24, 0x26, 0x28, 0x2a, 0x2c, 0x2e,
		0x30, 0x32, 0x34, 0x36, 0x38, 0x3a, 0x3c, 0x3e, 0x40, 0x42, 0x44, 0x46,
		0x48, 0x4a, 0x4c, 0x4e, 0x50, 0x52, 0x54, 0x56, 0x58, 0x5a, 0x5c, 0x5e,
		0x60, 0x62, 0x64, 0x66, 0x68, 0x6a, 0x6c, 0x6e, 0x70, 0x72, 0x74, 0x76,
		0x78, 0x7a, 0x7c, 0x7e, 0x80, 0x82, 0x84, 0x86, 0x88, 0x8a, 0x8c, 0x8e,
		0x90, 0x92, 0x94, 0x96, 0x98, 0x9a, 0x9c, 0x9e, 0xa0, 0xa2, 0xa4, 0xa6,
		0xa8, 0xaa, 0xac, 0xae, 0xb0, 0xb2, 0xb4, 0xb6, 0xb8, 0xba, 0xbc, 0xbe,
		0xc0, 0xc2, 0xc4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40, 0x45, 0x46,
		0x4f, 0x4c, 0x49, 0x4a, 0x6b, 0x68, 0x6d, 0x6e, 0x67, 0x64, 0x61, 0x62,
		0x73, 0x70, 0x75, 0x76, 0x7f, 0x7c, 0x79, 0x7a, 0x3b, 0x38, 0x3d, 0x3e,
		0x37, 0x34, 0x31, 0x32, 0x23, 0x20, 0x25, 0x26, 0x2f, 0x2c, 0x29, 0x2a,
		0x0b, 0x08, 0x0d, 0x0e, 0x07, 0x04, 0x01, 0x02, 0x13, 0x10, 0x15, 0x16,
		0x1f, 0x1c, 0x19, 0x1a
		],

		G9X: [
		0x00, 0x09, 0x12, 0x1b, 0x24, 0x2d, 0x36, 0x3f, 0x48, 0x41, 0x5a, 0x53,
		0x6c, 0x65, 0x7e, 0x77, 0x90, 0x99, 0x82, 0x8b, 0xb4, 0xbd, 0xa6, 0xaf,
		0xd8, 0xd1, 0xca, 0xc3, 0xfc, 0xf5, 0xee, 0xe7, 0x3b, 0x32, 0x29, 0x20,
		0x1f, 0x16, 0x0d, 0x04, 0x73, 0x7a, 0x61, 0x68, 0x57, 0x5e, 0x45, 0x4c,
		0xab, 0xa2, 0xb9, 0xb0, 0x8f, 0x86, 0x9d, 0x94, 0xe3, 0xea, 0xf1, 0xf8,
		0xc7, 0xce, 0xd5, 0xdc, 0x76, 0x7f, 0x64, 0x6d, 0x52, 0x5b, 0x40, 0x49,
		0x3e, 0x37, 0x2c, 0x25, 0x1a, 0x13, 0x08, 0x01, 0xe6, 0xef, 0xf4, 0xfd,
		0xc2, 0xcb, 0xd0, 0xd9, 0xae, 0xa7, 0xbc, 0xb5, 0x8a, 0x83, 0x98, 0x91,
		0x4d, 0x44, 0x5f, 0x56, 0x69, 0x60, 0x7b, 0x72, 0x05, 0x0c, 0x17, 0x1e,
		0x21, 0x28, 0x33, 0x3a, 0xdd, 0xd4, 0xcf, 0xc6, 0xf9, 0xf0, 0xeb, 0xe2,
		0x95, 0x9c, 0x87, 0x8e, 0xb1, 0xb8, 0xa3, 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d, 0x43, 0x51, 0x5f,
		0x75, 0x7b, 0x69, 0x67, 0x3d, 0x33, 0x21, 0x2f, 0x05, 0x0b, 0x19, 0x17,
		0x76, 0x78, 0x6a, 0x64, 0x4e, 0x40, 0x52, 0x5c, 0x06, 0x08, 0x1a, 0x14,
		0x3e, 0x30, 0x22, 0x2c, 0x96, 0x98, 0x8a, 0x84, 0xae, 0xa0, 0xb2, 0xbc,
		0xe6, 0xe8, 0xfa, 0xf4, 0xde, 0xd0, 0xc2, 0xcc, 0x41, 0x4f, 0x5d, 0x53,
		0x79, 0x77, 0x65, 0x6b, 0x31, 0x3f, 0x2d, 0x23, 0x09, 0x07, 0x15, 0x1b,
		0xa1, 0xaf, 0xbd, 0xb3, 0x99, 0x97, 0x85, 0x8b, 0xd1, 0xdf, 0xcd, 0xc3,
		0xe9, 0xe7, 0xf5, 0xfb, 0x9a, 0x94, 0x86, 0x88, 0xa2, 0xac, 0xbe, 0xb0,
		0xea, 0xe4, 0xf6, 0xf8, 0xd2, 0xdc, 0xce, 0xc0, 0x7a, 0x74, 0x66, 0x68,
		0x42, 0x4c, 0x5e, 0x50, 0x0a, 0x04, 0x16, 0x18, 0x32, 0x3c, 0x2e, 0x20,
		0xec, 0xe2, 0xf0, 0xfe, 0xd4, 0xda, 0xc8, 0xc6, 0x9c, 0x92, 0x80, 0x8e,
		0xa4, 0xaa, 0xb8, 0xb6, 0x0c, 0x02, 0x10, 0x1e, 0x34, 0x3a, 0x28, 0x26,
		0x7c, 0x72, 0x60, 0x6e, 0x44, 0x4a, 0x58, 0x56, 0x37, 0x39, 0x2b, 0x25,
		0x0f, 0x01, 0x13, 0x1d, 0x47, 0x49, 0x5b, 0x55, 0x7f, 0x71, 0x63, 0x6d,
		0xd7, 0xd9, 0xcb, 0xc5, 0xef, 0xe1, 0xf3, 0xfd, 0xa7, 0xa9, 0xbb, 0xb5,
		0x9f, 0x91, 0x83, 0x8d
		],
		
		// Key Schedule Core
		core:function(word,iteration)
		{
			/* rotate the 32-bit word 8 bits to the left */
			word = this.rotate(word);
			/* apply S-Box substitution on all 4 parts of the 32-bit word */
			for (var i = 0; i < 4; ++i)
				word[i] = this.sbox[word[i]];
			/* XOR the output of the rcon operation with i to the first part (leftmost) only */
			word[0] = word[0]^this.Rcon[iteration];
			return word;
		},
		
		/* Rijndael's key expansion
		 * expands an 128,192,256 key into an 176,208,240 bytes key
		 *
		 * expandedKey is a pointer to an char array of large enough size
		 * key is a pointer to a non-expanded key
		 */
		expandKey:function(key,size)
		{
			var expandedKeySize = (16*(this.numberOfRounds(size)+1));
			
			/* current expanded keySize, in bytes */
			var currentSize = 0;
			var rconIteration = 1;
			var t = [];   // temporary 4-byte variable
			
			var expandedKey = [];
			for(var i = 0;i < expandedKeySize;i++)
				expandedKey[i] = 0;
		
			/* set the 16,24,32 bytes of the expanded key to the input key */
			for (var j = 0; j < size; j++)
				expandedKey[j] = key[j];
			currentSize += size;
		
			while (currentSize < expandedKeySize)
			{
				/* assign the previous 4 bytes to the temporary value t */
				for (var k = 0; k < 4; k++)
					t[k] = expandedKey[(currentSize - 4) + k];
		
				/* every 16,24,32 bytes we apply the core schedule to t
				 * and increment rconIteration afterwards
				 */
				if(currentSize % size == 0)
					t = this.core(t, rconIteration++);
		
				/* For 256-bit keys, we add an extra sbox to the calculation */
				if(size == this.keySize.SIZE_256 && ((currentSize % size) == 16))
					for(var l = 0; l < 4; l++)
						t[l] = this.sbox[t[l]];
		
				/* We XOR t with the four-byte block 16,24,32 bytes before the new expanded key.
				 * This becomes the next four bytes in the expanded key.
				 */
				for(var m = 0; m < 4; m++) {
					expandedKey[currentSize] = expandedKey[currentSize - size] ^ t[m];
					currentSize++;
				}
			}
			return expandedKey;
		},
		
		// Adds (XORs) the round key to the state
		addRoundKey:function(state,roundKey)
		{
			for (var i = 0; i < 16; i++)
				state[i] ^= roundKey[i];
			return state;
		},
		
		// Creates a round key from the given expanded key and the
		// position within the expanded key.
		createRoundKey:function(expandedKey,roundKeyPointer)
		{
			var roundKey = [];
			for (var i = 0; i < 4; i++)
				for (var j = 0; j < 4; j++)
					roundKey[j*4+i] = expandedKey[roundKeyPointer + i*4 + j];
			return roundKey;
		},
		
		/* substitute all the values from the state with the value in the SBox
		 * using the state value as index for the SBox
		 */
		subBytes:function(state,isInv)
		{
			for (var i = 0; i < 16; i++)
				state[i] = isInv?this.rsbox[state[i]]:this.sbox[state[i]];
			return state;
		},
		
		/* iterate over the 4 rows and call shiftRow() with that row */
		shiftRows:function(state,isInv)
		{
			for (var i = 0; i < 4; i++)
				state = this.shiftRow(state,i*4, i,isInv);
			return state;
		},
		
		/* each iteration shifts the row to the left by 1 */
		shiftRow:function(state,statePointer,nbr,isInv)
		{
			for (var i = 0; i < nbr; i++)
			{
				if(isInv)
				{
					var tmp = state[statePointer + 3];
					for (var j = 3; j > 0; j--)
						state[statePointer + j] = state[statePointer + j-1];
					state[statePointer] = tmp;
				}
				else
				{
					var tmp = state[statePointer];
					for (var j = 0; j < 3; j++)
						state[statePointer + j] = state[statePointer + j+1];
					state[statePointer + 3] = tmp;
				}
			}
			return state;
		},

		// galois multiplication of 8 bit characters a and b
		galois_multiplication:function(a,b)
		{
			var p = 0;
			for(var counter = 0; counter < 8; counter++)
			{
				if((b & 1) == 1)
					p ^= a;
				if(p > 0x100) p ^= 0x100;
				var hi_bit_set = (a & 0x80); //keep p 8 bit
				a <<= 1;
				if(a > 0x100) a ^= 0x100; //keep a 8 bit
				if(hi_bit_set == 0x80)
					a ^= 0x1b;
				if(a > 0x100) a ^= 0x100; //keep a 8 bit
				b >>= 1;
				if(b > 0x100) b ^= 0x100; //keep b 8 bit
			}
			return p;
		},
		
		// galois multipication of the 4x4 matrix
		mixColumns:function(state,isInv)
		{
			var column = [];
			/* iterate over the 4 columns */
			for (var i = 0; i < 4; i++)
			{
				/* construct one column by iterating over the 4 rows */
				for (var j = 0; j < 4; j++)
					column[j] = state[(j*4)+i];
				/* apply the mixColumn on one column */
				column = this.mixColumn(column,isInv);
				/* put the values back into the state */
				for (var k = 0; k < 4; k++)
					state[(k*4)+i] = column[k];
			}
			return state;
		},

		// galois multipication of 1 column of the 4x4 matrix
		mixColumn:function(column,isInv)
		{
			var mult = [];	
			if(isInv)
				mult = [14,9,13,11];
			else
				mult = [2,1,1,3];
			var cpy = [];
			for(var i = 0; i < 4; i++)
				cpy[i] = column[i];
			
			column[0] = 	this.galois_multiplication(cpy[0],mult[0]) ^
					this.galois_multiplication(cpy[3],mult[1]) ^
					this.galois_multiplication(cpy[2],mult[2]) ^
					this.galois_multiplication(cpy[1],mult[3]);
			column[1] = 	this.galois_multiplication(cpy[1],mult[0]) ^
					this.galois_multiplication(cpy[0],mult[1]) ^
					this.galois_multiplication(cpy[3],mult[2]) ^
					this.galois_multiplication(cpy[2],mult[3]);
			column[2] = 	this.galois_multiplication(cpy[2],mult[0]) ^
					this.galois_multiplication(cpy[1],mult[1]) ^
					this.galois_multiplication(cpy[0],mult[2]) ^
					this.galois_multiplication(cpy[3],mult[3]);
			column[3] = 	this.galois_multiplication(cpy[3],mult[0]) ^
					this.galois_multiplication(cpy[2],mult[1]) ^
					this.galois_multiplication(cpy[1],mult[2]) ^
					this.galois_multiplication(cpy[0],mult[3]);
			return column;
		},
		
		// applies the 4 operations of the forward round in sequence
		round:function(state, roundKey)
		{
			state = this.subBytes(state,false);
			state = this.shiftRows(state,false);
			state = this.mixColumns(state,false);
			state = this.addRoundKey(state, roundKey);
			return state;
		},
		
		// applies the 4 operations of the inverse round in sequence
		invRound:function(state,roundKey)
		{
			state = this.shiftRows(state,true);
			state = this.subBytes(state,true);
			state = this.addRoundKey(state, roundKey);
			state = this.mixColumns(state,true);
			return state;
		},
		
		/*
		 * Perform the initial operations, the standard round, and the final operations
		 * of the forward aes, creating a round key for each round
		 */
		main:function(state,expandedKey,nbrRounds)
		{
			state = this.addRoundKey(state, this.createRoundKey(expandedKey,0));
			for (var i = 1; i < nbrRounds; i++)
				state = this.round(state, this.createRoundKey(expandedKey,16*i));
			state = this.subBytes(state,false);
			state = this.shiftRows(state,false);
			state = this.addRoundKey(state, this.createRoundKey(expandedKey,16*nbrRounds));
			return state;
		},
		
		/*
		 * Perform the initial operations, the standard round, and the final operations
		 * of the inverse aes, creating a round key for each round
		 */
		invMain:function(state, expandedKey, nbrRounds)
		{
			state = this.addRoundKey(state, this.createRoundKey(expandedKey,16*nbrRounds));
			for (var i = nbrRounds-1; i > 0; i--)
				state = this.invRound(state, this.createRoundKey(expandedKey,16*i));
			state = this.shiftRows(state,true);
			state = this.subBytes(state,true);
			state = this.addRoundKey(state, this.createRoundKey(expandedKey,0));
			return state;
		},

		numberOfRounds:function(size)
		{
			var nbrRounds;
			switch (size) /* set the number of rounds */
			{
				case this.keySize.SIZE_128:
					nbrRounds = 10;
					break;
				case this.keySize.SIZE_192:
					nbrRounds = 12;
					break;
				case this.keySize.SIZE_256:
					nbrRounds = 14;
					break;
				default:
					return null;
					break;
			}
			return nbrRounds;
		},
		
		// encrypts a 128 bit input block against the given key of size specified
		encrypt:function(input,key,size)
		{
			var output = [];
			var block = []; /* the 128 bit block to encode */
			var nbrRounds = this.numberOfRounds(size);
			/* Set the block values, for the block:
			 * a0,0 a0,1 a0,2 a0,3
			 * a1,0 a1,1 a1,2 a1,3
			 * a2,0 a2,1 a2,2 a2,3
			 * a3,0 a3,1 a3,2 a3,3
			 * the mapping order is a0,0 a1,0 a2,0 a3,0 a0,1 a1,1 ... a2,3 a3,3
			 */
			for (var i = 0; i < 4; i++) /* iterate over the columns */
				for (var j = 0; j < 4; j++) /* iterate over the rows */
					block[(i+(j*4))] = input[(i*4)+j];
		
			/* expand the key into an 176, 208, 240 bytes key */
			var expandedKey = this.expandKey(key, size); /* the expanded key */
			/* encrypt the block using the expandedKey */
			block = this.main(block, expandedKey, nbrRounds);
			for (var k = 0; k < 4; k++) /* unmap the block again into the output */
				for (var l = 0; l < 4; l++) /* iterate over the rows */
					output[(k*4)+l] = block[(k+(l*4))];
			return output;
		},
		
		// decrypts a 128 bit input block against the given key of size specified
		decrypt:function(input, key, size)
		{
			var output = [];
			var block = []; /* the 128 bit block to decode */
			var nbrRounds = this.numberOfRounds(size);
			/* Set the block values, for the block:
			 * a0,0 a0,1 a0,2 a0,3
			 * a1,0 a1,1 a1,2 a1,3
			 * a2,0 a2,1 a2,2 a2,3
			 * a3,0 a3,1 a3,2 a3,3
			 * the mapping order is a0,0 a1,0 a2,0 a3,0 a0,1 a1,1 ... a2,3 a3,3
			 */
			for (var i = 0; i < 4; i++) /* iterate over the columns */
				for (var j = 0; j < 4; j++) /* iterate over the rows */
					block[(i+(j*4))] = input[(i*4)+j];
			/* expand the key into an 176, 208, 240 bytes key */
			var expandedKey = this.expandKey(key, size);
			/* decrypt the block using the expandedKey */
			block = this.invMain(block, expandedKey, nbrRounds);
			for (var k = 0; k < 4; k++)/* unmap the block again into the output */
				for (var l = 0; l < 4; l++)/* iterate over the rows */
					output[(k*4)+l] = block[(k+(l*4))];
			return output;
		}
	},
	/*
	 * END AES SECTION
	 */
	 
	/*
	 * START MODE OF OPERATION SECTION
	 */
	//structure of supported modes of operation
	modeOfOperation:{
		OFB:0,
		CFB:1,
		CBC:2
	},
	
	// get a 16 byte block (aes operates on 128bits)
	getBlock: function(bytesIn,start,end,mode)
	{
		if(end - start > 16)
			end = start + 16;
		
		return bytesIn.slice(start, end);
	},
	
	/*
	 * Mode of Operation Encryption
	 * bytesIn - Input String as array of bytes
	 * mode - mode of type modeOfOperation
	 * key - a number array of length 'size'
	 * size - the bit length of the key
	 * iv - the 128 bit number array Initialization Vector
	 */
	encrypt: function (bytesIn, mode, key, iv)
	{
		var size = key.length;
		if(iv.length%16)
		{
			throw 'iv length must be 128 bits.';
		}
		// the AES input/output
		var byteArray = [];
		var input = [];
		var output = [];
		var ciphertext = [];
		var cipherOut = [];
		// char firstRound
		var firstRound = true;
		if (mode == this.modeOfOperation.CBC)
			this.padBytesIn(bytesIn);
		if (bytesIn !== null)
		{
			for (var j = 0;j < Math.ceil(bytesIn.length/16); j++)
			{
				var start = j*16;
				var end = j*16+16;
				if(j*16+16 > bytesIn.length)
					end = bytesIn.length;
				byteArray = this.getBlock(bytesIn,start,end,mode);
				if (mode == this.modeOfOperation.CFB)
				{
					if (firstRound)
					{
						output = this.aes.encrypt(iv, key, size);
						firstRound = false;
					}
					else
						output = this.aes.encrypt(input, key, size);
					for (var i = 0; i < 16; i++)
						ciphertext[i] = byteArray[i] ^ output[i];
					for(var k = 0;k < end-start;k++)
						cipherOut.push(ciphertext[k]);
					input = ciphertext;
				}
				else if (mode == this.modeOfOperation.OFB)
				{
					if (firstRound)
					{
						output = this.aes.encrypt(iv, key, size);
						firstRound = false;
					}
					else
						output = this.aes.encrypt(input, key, size);
					for (var i = 0; i < 16; i++)
						ciphertext[i] = byteArray[i] ^ output[i];
					for(var k = 0;k < end-start;k++)
						cipherOut.push(ciphertext[k]);
					input = output;
				}
				else if (mode == this.modeOfOperation.CBC)
				{
					for (var i = 0; i < 16; i++)
						input[i] = byteArray[i] ^ ((firstRound) ? iv[i] : ciphertext[i]);
					firstRound = false;
					ciphertext = this.aes.encrypt(input, key, size);
					// always 16 bytes because of the padding for CBC
					for(var k = 0;k < 16;k++)
						cipherOut.push(ciphertext[k]);
				}
			}
		}
		return cipherOut;
	},
	
	/*
	 * Mode of Operation Decryption
	 * cipherIn - Encrypted String as array of bytes
	 * originalsize - The unencrypted string length - required for CBC
	 * mode - mode of type modeOfOperation
	 * key - a number array of length 'size'
	 * size - the bit length of the key
	 * iv - the 128 bit number array Initialization Vector
	 */
	decrypt:function(cipherIn,mode,key,iv)
	{
		var size = key.length;
		if(iv.length%16)
		{
			throw 'iv length must be 128 bits.';
		}
		// the AES input/output
		var ciphertext = [];
		var input = [];
		var output = [];
		var byteArray = [];
		var bytesOut = [];
		// char firstRound
		var firstRound = true;
		if (cipherIn !== null)
		{
			for (var j = 0;j < Math.ceil(cipherIn.length/16); j++)
			{
				var start = j*16;
				var end = j*16+16;
				if(j*16+16 > cipherIn.length)
					end = cipherIn.length;
				ciphertext = this.getBlock(cipherIn,start,end,mode);
				if (mode == this.modeOfOperation.CFB)
				{
					if (firstRound)
					{
						output = this.aes.encrypt(iv, key, size);
						firstRound = false;
					}
					else
						output = this.aes.encrypt(input, key, size);
					for (i = 0; i < 16; i++)
						byteArray[i] = output[i] ^ ciphertext[i];
					for(var k = 0;k < end-start;k++)
						bytesOut.push(byteArray[k]);
					input = ciphertext;
				}
				else if (mode == this.modeOfOperation.OFB)
				{
					if (firstRound)
					{
						output = this.aes.encrypt(iv, key, size);
						firstRound = false;
					}
					else
						output = this.aes.encrypt(input, key, size);
					for (i = 0; i < 16; i++)
						byteArray[i] = output[i] ^ ciphertext[i];
					for(var k = 0;k < end-start;k++)
						bytesOut.push(byteArray[k]);
					input = output;
				}
				else if(mode == this.modeOfOperation.CBC)
				{
					output = this.aes.decrypt(ciphertext, key, size);
					for (i = 0; i < 16; i++)
						byteArray[i] = ((firstRound) ? iv[i] : input[i]) ^ output[i];
					firstRound = false;
					for(var k = 0;k < end-start;k++)
						bytesOut.push(byteArray[k]);
					input = ciphertext;
				}
			}
			if(mode == this.modeOfOperation.CBC)
			    this.unpadBytesOut(bytesOut);
		}
		return bytesOut;
	},
	padBytesIn: function(data) {
		var len = data.length;
		var padByte = 16 - (len % 16);
		for (var i = 0; i < padByte; i++) {
			data.push(padByte);
		}
	},
	unpadBytesOut: function(data) {
		var padCount = 0;
		var padByte = -1;
		var blockSize = 16;
		if (data.length > 16) {
		for (var i = data.length - 1; i >= data.length-1 - blockSize; i--) {
			if (data[i] <= blockSize) {
				if (padByte == -1)
					padByte = data[i];
				if (data[i] != padByte) {
					padCount = 0;
					break;
				}
				padCount++;
			} else
				break;
			if (padCount == padByte)
				break;
		}
		if (padCount > 0)
			data.splice(data.length - padCount, padCount);
		}
	}
	/*
	 * END MODE OF OPERATION SECTION
	 */
};

and the class I've written :

public static class slowAES
{
    enum modeOfOperation
    {
        OFB,
        CFB,
        CBC
    }
    enum keySize
    {
        SIZE_128 = 16,
        SIZE_192 = 24,
        SIZE_256 = 32
    }
    public static byte[] decrypt(byte[] cipherinint modebyte[] keybyte[] iv)
    {
        int size = key.Length;
        // the aes input output
        List<byteciphertext = new List<byte>();
        List<byteinput = new List<byte>();
        List<byteoutput = new List<byte>();
        List<bytebyteArray = new List<byte>();
        List<bytebytesOut = new List<byte>();
        bool firstRound = true;
        if (cipherin != null)
        {
            for (int j = 0; j < Math.Ceiling((decimal)cipherin.Length / 16); j++)
            {
                int start = j * 16;
                int end = j * 16 + 16;
                if (j * 16 + 16 > cipherin.Length)
                    end = cipherin.Length;
                ciphertext = getBlock(cipherin, start, end, mode);
                //foreach (byte b in ciphertext)
                //    Console.WriteLine(b + ",");
                if ((modeOfOperation)mode == modeOfOperation.CFB)
                {
                    if (firstRound)
                    {
                        output = encrypt(iv, key, size);
                        firstRound = false;
                    }
                    else
                        output = encrypt(input, key, size);
                    for (int i = 0; i < 16; i++)
                        byteArray.Add((byte)(output[i] ^ ciphertext[i]));
                    for (var k = 0; k < end - start; k++)
                        bytesOut.Add(byteArray[k]);
                    input = ciphertext;
                }
                else if ((modeOfOperation)mode == modeOfOperation.OFB)
                {
                    if (firstRound)
                    {
                        output = encrypt(iv, key, size);
                        firstRound = false;
                    }
                    else
                        output = encrypt(input, key, size);
                    for (int i = 0; i < 16; i++)
                        byteArray.Add((byte)(output[i] ^ ciphertext[i]));
                    for (var k = 0; k < end - start; k++)
                        bytesOut.Add(byteArray[k]);
                    input = output;
                }
                else if ((modeOfOperation)mode == modeOfOperation.CBC)
                {
                    output = decrypt(ciphertext, key, size);
                    for (int i = 0; i < 16; i++)
                        byteArray.Add((byte)(((firstRound) ? iv[i] : input[i]) ^ output[i]));
                    firstRound = false;
                    for (var k = 0; k < end - start; k++)
                        bytesOut.Add(byteArray[k]);
                    input = ciphertext;
                }
            }
            //if ((modeOfOperation)mode == modeOfOperation.CBC)
            //    unpadBytesOut(bytesOut);
        }
        return bytesOut.ToArray();
    }

    private static List<bytedecrypt(List<byteinputbyte[] keyint size)
    {
        List<byteoutput = new List<byte>();
        List<byteblock = new List<byte>();
        for (int i = 0; i < 16; i++)
        {
            output.Add(0);
            block.Add(0);
        }
        int nbrRounds = numberOfRounds(size);
        for (int i = 0; i < 4; i++/* iterate over the columns */
            for (int j = 0; j < 4; j++/* iterate over the rows */
                block[(i + (j * 4))] = input[(i * 4+ j];
        /* expand the key into an 176, 208, 240 bytes key */
        var expandedKey = expandKey(key, size);
        /* decrypt the block using the expandedKey */
        block = invMain(block, expandedKey, nbrRounds); //463
        for (int k = 0; k < 4; k++)/* unmap the block again into the output */
            for (int l = 0; l < 4; l++)/* iterate over the rows */
                output[(k * 4+ l] = block[(k + (l * 4))];
        return output;
    }
    private static List<byteinvMain(List<bytestate, List<byteexpandedKeyint nbrRounds)
    {
        state = addRoundKey(state, createRoundKey(expandedKey, 16 * nbrRounds));
        
        for (int i = nbrRounds - 1; i > 0; i--)
            state = invRound(state, createRoundKey(expandedKey, 16 * i));
        state = shiftRows(state, true);
        state = subBytes(state, true);
        state = addRoundKey(state, createRoundKey(expandedKey, 0));
        return state;
    }
    private static List<byteinvRound(List<bytestate, List<byteroundKey)
    {
        state = shiftRows(state, true);
        state = subBytes(state, true);
        state = addRoundKey(state, roundKey);
        state = mixColumns(state, true);
        return state;
    }
    private static List<bytemixColumns(List<bytestatebool isInv)
    {
        List<bytecolumn = new List<byte>();
        for (int i = 0; i < 4; i++)
            column.Add(0);
        /* iterate over the 4 columns */
        for (var i = 0; i < 4; i++)
        {
            /* construct one column by iterating over the 4 rows */
            for (var j = 0; j < 4; j++)
                column[j] = state[(j * 4+ i];
            /* apply the mixColumn on one column */
            column = mixColumn(column, isInv);
            /* put the values back into the state */
            for (var k = 0; k < 4; k++)
                state[(k * 4+ i] = column[k];
        }
        return state;
    }
    private static List<bytemixColumn(List<bytecolumnbool isInv)
    {
        byte[] mult;
        byte[] a = { 1491311 };
        byte[] b = { 2113 };
        if (isInv)
            mult = a;
        else
            mult = b;
        List<bytecpy = new List<byte>();
        for (var i = 0; i < 4; i++)
            cpy.Add(column[i]);

        column[0= (byte)(galois_multiplication(cpy[0], mult[0]) ^
            galois_multiplication(cpy[3], mult[1]) ^
            galois_multiplication(cpy[2], mult[2]) ^
            galois_multiplication(cpy[1], mult[3]));
        column[1= (byte)(galois_multiplication(cpy[1], mult[0]) ^
            galois_multiplication(cpy[0], mult[1]) ^
            galois_multiplication(cpy[3], mult[2]) ^
            galois_multiplication(cpy[2], mult[3]));
        column[2= (byte)(galois_multiplication(cpy[2], mult[0]) ^
            galois_multiplication(cpy[1], mult[1]) ^
            galois_multiplication(cpy[0], mult[2]) ^
            galois_multiplication(cpy[3], mult[3]));
        column[3= (byte)(galois_multiplication(cpy[3], mult[0]) ^
            galois_multiplication(cpy[2], mult[1]) ^
            galois_multiplication(cpy[1], mult[2]) ^
            galois_multiplication(cpy[0], mult[3]));
        return column;
    }
    private static byte galois_multiplication(int aint b)
        {
            var p = 0;
            for (int counter = 0; counter < 8; counter++)
            {
                if ((b & 1== 1)
                    p ^= a;
                if (p > 0x100) p ^= 0x100;
                var hi_bit_set = (a & 0x80); //keep p 8 bit
                a <<= 1;
                if (a > 0x100) a ^= 0x100//keep a 8 bit
                if (hi_bit_set == 0x80)
                    a ^= 0x1b;
                if (a > 0x100) a ^= 0x100//keep a 8 bit
                b >>= 1;
                if (b > 0x100) b ^= 0x100//keep b 8 bit
            }
            return (byte)p;
        }    private static List<bytesubBytes(List<bytestatebool isInv)
        {
            //state.Clear();
            for (int i = 0; i < 16; i++)
                state[i] = isInv ? rsbox[state[i]] : sbox[state[i]];
            return state;
        }    private static List<byteshiftRows(List<bytestatebool isInv)
        {
            for (int i = 0; i < 4; i++)
                state = shiftRow(state, i * 4, i, isInv);
            return state;
        }    private static List<byteshiftRow(List<bytestateint statePointerint nbrbool isInv)
        {
            for (int i = 0; i < nbr; i++)
            {
                if (isInv)
                {
                    var tmp = state[statePointer + 3];
                    for (var j = 3; j > 0; j--)
                        state[statePointer + j] = state[statePointer + j - 1];
                    state[statePointer] = tmp;
                }
                else
                {
                    var tmp = state[statePointer];
                    for (var j = 0; j < 3; j++)
                        state[statePointer + j] = state[statePointer + j + 1];
                    state[statePointer + 3= tmp;
                }
            }
            return state;
        }    private static List<bytecreateRoundKey(List<byteexpandedKeyint roundKeyPointer)
        {
            List<byteroundKey = new List<byte>();
            for (int i = 0; i < 16; i++)
                roundKey.Add(0);
            for (int i = 0; i < 4; i++)
                for (int j = 0; j < 4; j++)
                    roundKey[j * 4 + i] = expandedKey[roundKeyPointer + i * 4 + j];
 
            Console.WriteLine(roundKey); 
            return roundKey;
        }    private static List<byteaddRoundKey(List<bytestate, List<byteroundKey)
    {
        for (int i = 0; i < 16; i++)
            state[i] ^= roundKey[i];
        return state;
    }
    private static List<byteencrypt(byte[] inputbyte[] keyint size)
    {
        List<byteoutput = new List<byte>();
        List<byteblock = new List<byte>();
        int nbrRounds = numberOfRounds(size);
        for (int i = 0; i < 4; i++)
            for (int j = 0; j < 4; j++)
                block.Add(input[(i * 4+ j]);
        List<byteexpandedKey = expandKey(key, size);
        foreach (byte b in expandedKey)
            Console.WriteLine(b + ",");
        return output;
    }
    private static List<byteencrypt(List<byteinputbyte[] keyint size)
    {
        List<byteoutput = new List<byte>();
        List<byteblock = new List<byte>();
        int nbrRounds = numberOfRounds(size);
        for (int i = 0; i < 4; i++)
            for (int j = 0; j < 4; j++)
                block.Add(input[(i * 4+ j]);
        List<byteexpandedKey = expandKey(key, size);
        foreach (byte b in expandedKey)
            Console.WriteLine(b + ",");
        return output;
    }
    private static int numberOfRounds(int size)
        {
            int nbrRounds = 0;
            switch (size)
            {
                case (int)keySize.SIZE_128:
                    nbrRounds = 10;
                    break;
                case (int)keySize.SIZE_192:
                    nbrRounds = 12;
                    break;
                case ((int)keySize.SIZE_256):
                    nbrRounds = 14;
                    break;
            }
            return nbrRounds;
        }    private static List<bytegetBlock(byte[] cipherInint startint endint mode)
        {
            if (end - start > 16)
                end = start + 16;
            List<byteblock = new List<byte>();
            for (int i = start; i < end; i++)
                block.Add(cipherIn[i]);
            return block;
 
        }    private static List<byteexpandKey(byte[] keyint size)
    {
        int expandedKeySize = (16 * (numberOfRounds(size) + 1));
        int currentSize = 0;
        int rconIteration = 1;
        List<bytet = new List<byte>();
        for (int i = 0; i < 4; i++)
            t.Add(0);
        List<byteexpandedKey = new List<byte>();
        for (int i = 0; i < expandedKeySize; i++)
            expandedKey.Add(0);
        /* set the 16,24,32 bytes of the expanded key to the input key */
        for (int j = 0; j < size; j++)
            expandedKey[j] = key[j];
        currentSize += size;
        while (currentSize < expandedKeySize)
        {
            /* assign the previous 4 bytes to the temporary value t */
            for (int k = 0; k < 4; k++)
                t[k] = expandedKey[(currentSize - 4+ k];

            /* every 16,24,32 bytes we apply the core schedule to t
			 * and increment rconIteration afterwards
			 */
            if (currentSize % size == 0)
                t = core(t, rconIteration++);

            /* For 256-bit keys, we add an extra sbox to the calculation */
            if (size == (int)keySize.SIZE_256 && ((currentSize % size) == 16))
                for (int l = 0; l < 4; l++)
                    t[l] = sbox[t[l]];

            /* We XOR t with the four-byte block 16,24,32 bytes before the new expanded key.
			 * This becomes the next four bytes in the expanded key.
			 */
            for (var m = 0; m < 4; m++)
            {
                expandedKey[currentSize] = ((byte)(expandedKey[currentSize - size] ^ t[m]));
                currentSize++;
            }
        }
        return expandedKey;
    }
    private static List<byterotate(List<byteword)
        {
            byte c = word[0];
            for (var i = 0; i < 3; i++)
                word[i] = word[i + 1];
            word[3= c;
 
            return word;
        }    private static List<bytecore(List<bytewordint iteration)
    {

        word = rotate(word);
        for (int i = 0; i < 4++i)
            word[i] = sbox[word[i]];
        /* XOR the output of the rcon operation with i to the first part (leftmost) only */
        word[0= (byte)(word[0^ Rcon[iteration]);
        return word;
    }
    // Rijndael Rcon
    private static byte[] Rcon = {
        0x8d0x010x020x040x080x100x200x400x800x1b0x360x6c0xd8,
        0xab0x4d0x9a0x2f0x5e0xbc0x630xc60x970x350x6a0xd40xb3,
        0x7d0xfa0xef0xc50x910x390x720xe40xd30xbd0x610xc20x9f,
        0x250x4a0x940x330x660xcc0x830x1d0x3a0x740xe80xcb0x8d,
        0x010x020x040x080x100x200x400x800x1b0x360x6c0xd80xab,
        0x4d0x9a0x2f0x5e0xbc0x630xc60x970x350x6a0xd40xb30x7d,
        0xfa0xef0xc50x910x390x720xe40xd30xbd0x610xc20x9f0x25,
        0x4a0x940x330x660xcc0x830x1d0x3a0x740xe80xcb0x8d0x01,
        0x020x040x080x100x200x400x800x1b0x360x6c0xd80xab0x4d,
        0x9a0x2f0x5e0xbc0x630xc60x970x350x6a0xd40xb30x7d0xfa,
        0xef0xc50x910x390x720xe40xd30xbd0x610xc20x9f0x250x4a,
        0x940x330x660xcc0x830x1d0x3a0x740xe80xcb0x8d0x010x02,
        0x040x080x100x200x400x800x1b0x360x6c0xd80xab0x4d0x9a,
        0x2f0x5e0xbc0x630xc60x970x350x6a0xd40xb30x7d0xfa0xef,
        0xc50x910x390x720xe40xd30xbd0x610xc20x9f0x250x4a0x94,
        0x330x660xcc0x830x1d0x3a0x740xe80xcb0x8d0x010x020x04,
        0x080x100x200x400x800x1b0x360x6c0xd80xab0x4d0x9a0x2f,
        0x5e0xbc0x630xc60x970x350x6a0xd40xb30x7d0xfa0xef0xc5,
        0x910x390x720xe40xd30xbd0x610xc20x9f0x250x4a0x940x33,
        0x660xcc0x830x1d0x3a0x740xe80xcb };

    private static byte[] G2X = {
        0x000x020x040x060x080x0a0x0c0x0e0x100x120x140x16,
        0x180x1a0x1c0x1e0x200x220x240x260x280x2a0x2c0x2e,
        0x300x320x340x360x380x3a0x3c0x3e0x400x420x440x46,
        0x480x4a0x4c0x4e0x500x520x540x560x580x5a0x5c0x5e,
        0x600x620x640x660x680x6a0x6c0x6e0x700x720x740x76,
        0x780x7a0x7c0x7e0x800x820x840x860x880x8a0x8c0x8e,
        0x900x920x940x960x980x9a0x9c0x9e0xa00xa20xa40xa6,
        0xa80xaa0xac0xae0xb00xb20xb40xb60xb80xba0xbc0xbe,
        0xc00xc20xc40xc60xc80xca0xcc0xce0xd00xd20xd40xd6,
        0xd80xda0xdc0xde0xe00xe20xe40xe60xe80xea0xec0xee,
        0xf00xf20xf40xf60xf80xfa0xfc0xfe0x1b0x190x1f0x1d,
        0x130x110x170x150x0b0x090x0f0x0d0x030x010x070x05,
        0x3b0x390x3f0x3d0x330x310x370x350x2b0x290x2f0x2d,
        0x230x210x270x250x5b0x590x5f0x5d0x530x510x570x55,
        0x4b0x490x4f0x4d0x430x410x470x450x7b0x790x7f0x7d,
        0x730x710x770x750x6b0x690x6f0x6d0x630x610x670x65,
        0x9b0x990x9f0x9d0x930x910x970x950x8b0x890x8f0x8d,
        0x830x810x870x850xbb0xb90xbf0xbd0xb30xb10xb70xb5,
        0xab0xa90xaf0xad0xa30xa10xa70xa50xdb0xd90xdf0xdd,
        0xd30xd10xd70xd50xcb0xc90xcf0xcd0xc30xc10xc70xc5,
        0xfb0xf90xff0xfd0xf30xf10xf70xf50xeb0xe90xef0xed,
        0xe30xe10xe70xe5 };

    private static byte[] G3X = {
        0x000x030x060x050x0c0x0f0x0a0x090x180x1b0x1e0x1d,
        0x140x170x120x110x300x330x360x350x3c0x3f0x3a0x39,
        0x280x2b0x2e0x2d0x240x270x220x210x600x630x660x65,
        0x6c0x6f0x6a0x690x780x7b0x7e0x7d0x740x770x720x71,
        0x500x530x560x550x5c0x5f0x5a0x590x480x4b0x4e0x4d,
        0x440x470x420x410xc00xc30xc60xc50xcc0xcf0xca0xc9,
        0xd80xdb0xde0xdd0xd40xd70xd20xd10xf00xf30xf60xf5,
        0xfc0xff0xfa0xf90xe80xeb0xee0xed0xe40xe70xe20xe1,
        0xa00xa30xa60xa50xac0xaf0xaa0xa90xb80xbb0xbe0xbd,
        0xb40xb70xb20xb10x900x930x960x950x9c0x9f0x9a0x99,
        0x880x8b0x8e0x8d0x840x870x820x810x9b0x980x9d0x9e,
        0x970x940x910x920x830x800x850x860x8f0x8c0x890x8a,
        0xab0xa80xad0xae0xa70xa40xa10xa20xb30xb00xb50xb6,
        0xbf0xbc0xb90xba0xfb0xf80xfd0xfe0xf70xf40xf10xf2,
        0xe30xe00xe50xe60xef0xec0xe90xea0xcb0xc80xcd0xce,
        0xc70xc40xc10xc20xd30xd00xd50xd60xdf0xdc0xd90xda,
        0x5b0x580x5d0x5e0x570x540x510x520x430x400x450x46,
        0x4f0x4c0x490x4a0x6b0x680x6d0x6e0x670x640x610x62,
        0x730x700x750x760x7f0x7c0x790x7a0x3b0x380x3d0x3e,
        0x370x340x310x320x230x200x250x260x2f0x2c0x290x2a,
        0x0b0x080x0d0x0e0x070x040x010x020x130x100x150x16,
        0x1f0x1c0x190x1a };

    private static byte[] G9X = {
        0x000x090x120x1b0x240x2d0x360x3f0x480x410x5a0x53,
        0x6c0x650x7e0x770x900x990x820x8b0xb40xbd0xa60xaf,
        0xd80xd10xca0xc30xfc0xf50xee0xe70x3b0x320x290x20,
        0x1f0x160x0d0x040x730x7a0x610x680x570x5e0x450x4c,
        0xab0xa20xb90xb00x8f0x860x9d0x940xe30xea0xf10xf8,
        0xc70xce0xd50xdc0x760x7f0x640x6d0x520x5b0x400x49,
        0x3e0x370x2c0x250x1a0x130x080x010xe60xef0xf40xfd,
        0xc20xcb0xd00xd90xae0xa70xbc0xb50x8a0x830x980x91,
        0x4d0x440x5f0x560x690x600x7b0x720x050x0c0x170x1e,
        0x210x280x330x3a0xdd0xd40xcf0xc60xf90xf00xeb0xe2,
        0x950x9c0x870x8e0xb10xb80xa30xaa0xec0xe50xfe0xf7,
        0xc80xc10xda0xd30xa40xad0xb60xbf0x800x890x920x9b,
        0x7c0x750x6e0x670x580x510x4a0x430x340x3d0x260x2f,
        0x100x190x020x0b0xd70xde0xc50xcc0xf30xfa0xe10xe8,
        0x9f0x960x8d0x840xbb0xb20xa90xa00x470x4e0x550x5c,
        0x630x6a0x710x780x0f0x060x1d0x140x2b0x220x390x30,
        0x9a0x930x880x810xbe0xb70xac0xa50xd20xdb0xc00xc9,
        0xf60xff0xe40xed0x0a0x030x180x110x2e0x270x3c0x35,
        0x420x4b0x500x590x660x6f0x740x7d0xa10xa80xb30xba,
        0x850x8c0x970x9e0xe90xe00xfb0xf20xcd0xc40xdf0xd6,
        0x310x380x230x2a0x150x1c0x070x0e0x790x700x6b0x62,
        0x5d0x540x4f0x46 };

    private static byte[] GBX = {
        0x000x0b0x160x1d0x2c0x270x3a0x310x580x530x4e0x45,
        0x740x7f0x620x690xb00xbb0xa60xad0x9c0x970x8a0x81,
        0xe80xe30xfe0xf50xc40xcf0xd20xd90x7b0x700x6d0x66,
        0x570x5c0x410x4a0x230x280x350x3e0x0f0x040x190x12,
        0xcb0xc00xdd0xd60xe70xec0xf10xfa0x930x980x850x8e,
        0xbf0xb40xa90xa20xf60xfd0xe00xeb0xda0xd10xcc0xc7,
        0xae0xa50xb80xb30x820x890x940x9f0x460x4d0x500x5b,
        0x6a0x610x7c0x770x1e0x150x080x030x320x390x240x2f,
        0x8d0x860x9b0x900xa10xaa0xb70xbc0xd50xde0xc30xc8,
        0xf90xf20xef0xe40x3d0x360x2b0x200x110x1a0x070x0c,
        0x650x6e0x730x780x490x420x5f0x540xf70xfc0xe10xea,
        0xdb0xd00xcd0xc60xaf0xa40xb90xb20x830x880x950x9e,
        0x470x4c0x510x5a0x6b0x600x7d0x760x1f0x140x090x02,
        0x330x380x250x2e0x8c0x870x9a0x910xa00xab0xb60xbd,
        0xd40xdf0xc20xc90xf80xf30xee0xe50x3c0x370x2a0x21,
        0x100x1b0x060x0d0x640x6f0x720x790x480x430x5e0x55,
        0x010x0a0x170x1c0x2d0x260x3b0x300x590x520x4f0x44,
        0x750x7e0x630x680xb10xba0xa70xac0x9d0x960x8b0x80,
        0xe90xe20xff0xf40xc50xce0xd30xd80x7a0x710x6c0x67,
        0x560x5d0x400x4b0x220x290x340x3f0x0e0x050x180x13,
        0xca0xc10xdc0xd70xe60xed0xf00xfb0x920x990x840x8f,
        0xbe0xb50xa80xa3 };

    private static byte[] GDX = {
        0x000x0d0x1a0x170x340x390x2e0x230x680x650x720x7f,
        0x5c0x510x460x4b0xd00xdd0xca0xc70xe40xe90xfe0xf3,
        0xb80xb50xa20xaf0x8c0x810x960x9b0xbb0xb60xa10xac,
        0x8f0x820x950x980xd30xde0xc90xc40xe70xea0xfd0xf0,
        0x6b0x660x710x7c0x5f0x520x450x480x030x0e0x190x14,
        0x370x3a0x2d0x200x6d0x600x770x7a0x590x540x430x4e,
        0x050x080x1f0x120x310x3c0x2b0x260xbd0xb00xa70xaa,
        0x890x840x930x9e0xd50xd80xcf0xc20xe10xec0xfb0xf6,
        0xd60xdb0xcc0xc10xe20xef0xf80xf50xbe0xb30xa40xa9,
        0x8a0x870x900x9d0x060x0b0x1c0x110x320x3f0x280x25,
        0x6e0x630x740x790x5a0x570x400x4d0xda0xd70xc00xcd,
        0xee0xe30xf40xf90xb20xbf0xa80xa50x860x8b0x9c0x91,
        0x0a0x070x100x1d0x3e0x330x240x290x620x6f0x780x75,
        0x560x5b0x4c0x410x610x6c0x7b0x760x550x580x4f0x42,
        0x090x040x130x1e0x3d0x300x270x2a0xb10xbc0xab0xa6,
        0x850x880x9f0x920xd90xd40xc30xce0xed0xe00xf70xfa,
        0xb70xba0xad0xa00x830x8e0x990x940xdf0xd20xc50xc8,
        0xeb0xe60xf10xfc0x670x6a0x7d0x700x530x5e0x490x44,
        0x0f0x020x150x180x3b0x360x210x2c0x0c0x010x160x1b,
        0x380x350x220x2f0x640x690x7e0x730x500x5d0x4a0x47,
        0xdc0xd10xc60xcb0xe80xe50xf20xff0xb40xb90xae0xa3,
        0x800x8d0x9a0x97 };

    private static byte[] GEX = {
        0x000x0e0x1c0x120x380x360x240x2a0x700x7e0x6c0x62,
        0x480x460x540x5a0xe00xee0xfc0xf20xd80xd60xc40xca,
        0x900x9e0x8c0x820xa80xa60xb40xba0xdb0xd50xc70xc9,
        0xe30xed0xff0xf10xab0xa50xb70xb90x930x9d0x8f0x81,
        0x3b0x350x270x290x030x0d0x1f0x110x4b0x450x570x59,
        0x730x7d0x6f0x610xad0xa30xb10xbf0x950x9b0x890x87,
        0xdd0xd30xc10xcf0xe50xeb0xf90xf70x4d0x430x510x5f,
        0x750x7b0x690x670x3d0x330x210x2f0x050x0b0x190x17,
        0x760x780x6a0x640x4e0x400x520x5c0x060x080x1a0x14,
        0x3e0x300x220x2c0x960x980x8a0x840xae0xa00xb20xbc,
        0xe60xe80xfa0xf40xde0xd00xc20xcc0x410x4f0x5d0x53,
        0x790x770x650x6b0x310x3f0x2d0x230x090x070x150x1b,
        0xa10xaf0xbd0xb30x990x970x850x8b0xd10xdf0xcd0xc3,
        0xe90xe70xf50xfb0x9a0x940x860x880xa20xac0xbe0xb0,
        0xea0xe40xf60xf80xd20xdc0xce0xc00x7a0x740x660x68,
        0x420x4c0x5e0x500x0a0x040x160x180x320x3c0x2e0x20,
        0xec0xe20xf00xfe0xd40xda0xc80xc60x9c0x920x800x8e,
        0xa40xaa0xb80xb60x0c0x020x100x1e0x340x3a0x280x26,
        0x7c0x720x600x6e0x440x4a0x580x560x370x390x2b0x25,
        0x0f0x010x130x1d0x470x490x5b0x550x7f0x710x630x6d,
        0xd70xd90xcb0xc50xef0xe10xf30xfd0xa70xa90xbb0xb5,
        0x9f0x910x830x8d };
    private static byte[] sbox = {
        0x630x7c0x770x7b0xf20x6b0x6f0xc50x300x010x670x2b0xfe0xd70xab0x76,
        0xca0x820xc90x7d0xfa0x590x470xf00xad0xd40xa20xaf0x9c0xa40x720xc0,
        0xb70xfd0x930x260x360x3f0xf70xcc0x340xa50xe50xf10x710xd80x310x15,
        0x040xc70x230xc30x180x960x050x9a0x070x120x800xe20xeb0x270xb20x75,
        0x090x830x2c0x1a0x1b0x6e0x5a0xa00x520x3b0xd60xb30x290xe30x2f0x84,
        0x530xd10x000xed0x200xfc0xb10x5b0x6a0xcb0xbe0x390x4a0x4c0x580xcf,
        0xd00xef0xaa0xfb0x430x4d0x330x850x450xf90x020x7f0x500x3c0x9f0xa8,
        0x510xa30x400x8f0x920x9d0x380xf50xbc0xb60xda0x210x100xff0xf30xd2,
        0xcd0x0c0x130xec0x5f0x970x440x170xc40xa70x7e0x3d0x640x5d0x190x73,
        0x600x810x4f0xdc0x220x2a0x900x880x460xee0xb80x140xde0x5e0x0b0xdb,
        0xe00x320x3a0x0a0x490x060x240x5c0xc20xd30xac0x620x910x950xe40x79,
        0xe70xc80x370x6d0x8d0xd50x4e0xa90x6c0x560xf40xea0x650x7a0xae0x08,
        0xba0x780x250x2e0x1c0xa60xb40xc60xe80xdd0x740x1f0x4b0xbd0x8b0x8a,
        0x700x3e0xb50x660x480x030xf60x0e0x610x350x570xb90x860xc10x1d0x9e,
        0xe10xf80x980x110x690xd90x8e0x940x9b0x1e0x870xe90xce0x550x280xdf,
        0x8c0xa10x890x0d0xbf0xe60x420x680x410x990x2d0x0f0xb00x540xbb0x16};

    // Rijndael Inverted S-box
    private static byte[] rsbox = {
        0x520x090x6a0xd50x300x360xa50x380xbf0x400xa30x9e0x810xf30xd70xfb
            , 0x7c0xe30x390x820x9b0x2f0xff0x870x340x8e0x430x440xc40xde0xe90xcb
            , 0x540x7b0x940x320xa60xc20x230x3d0xee0x4c0x950x0b0x420xfa0xc30x4e
            , 0x080x2e0xa10x660x280xd90x240xb20x760x5b0xa20x490x6d0x8b0xd10x25
            , 0x720xf80xf60x640x860x680x980x160xd40xa40x5c0xcc0x5d0x650xb60x92
            , 0x6c0x700x480x500xfd0xed0xb90xda0x5e0x150x460x570xa70x8d0x9d0x84
            , 0x900xd80xab0x000x8c0xbc0xd30x0a0xf70xe40x580x050xb80xb30x450x06
            , 0xd00x2c0x1e0x8f0xca0x3f0x0f0x020xc10xaf0xbd0x030x010x130x8a0x6b
            , 0x3a0x910x110x410x4f0x670xdc0xea0x970xf20xcf0xce0xf00xb40xe60x73
            , 0x960xac0x740x220xe70xad0x350x850xe20xf90x370xe80x1c0x750xdf0x6e
            , 0x470xf10x1a0x710x1d0x290xc50x890x6f0xb70x620x0e0xaa0x180xbe0x1b
            , 0xfc0x560x3e0x4b0xc60xd20x790x200x9a0xdb0xc00xfe0x780xcd0x5a0xf4
            , 0x1f0xdd0xa80x330x880x070xc70x310xb10x120x100x590x270x800xec0x5f
            , 0x600x510x7f0xa90x190xb50x4a0x0d0x2d0xe50x7a0x9f0x930xc90x9c0xef
            , 0xa00xe00x3b0x4d0xae0x2a0xf50xb00xc80xeb0xbb0x3c0x830x530x990x61
            , 0x170x2b0x040x7e0xba0x770xd60x260xe10x690x140x630x550x210x0c0x7d
    };


}


that's all just call that in your main code :

string finalcookie = (toHex(slowAES.decrypt(cnumbers, 2, anumbers, bnumbers))).ToLower();
and the second call by HttpWebRequest and successfully get the page you wanted:

myRequest = (HttpWebRequest)WebRequest.Create("http://www.namazvakitleri.site/?i=1");
           myRequest.Headers.Add("Cookie""__test=" + finalcookie);
           myResponse = (HttpWebResponse)myRequest.GetResponse();
           sr = new StreamReader(myResponse.GetResponseStream(), System.Text.Encoding.UTF8);
           result = sr.ReadToEnd();
           textBox1.AppendText(result + "\r\n");
notice that I added ?i=1 query string on the end of the address.

Comments

Popular posts from this blog

SlowAES Bypass the test cookie NodeMcu

How to Drive DHT sensor without Library

How does DHT11 sensor work?