public string UpdateLeaderBoard(string pname, string fscore, string ipaddress, string gameid)
{
string timestamp = DateTime.Now.ToShortTimeString();
lboardparameters = fscore + "," + timestamp + "," + ipaddress + "," + gameid;
string sKy = "go!Animate@2010Cart00nNetw@rk!!!";
string sIV = "go!Animate@2010Cart00nNetw@rk!!!";
lboardparameters = EncryptRJ256(sKy, sIV, lboardparameters);
// string url = "http://www.cartoonnetworkasia.com/contest/2010/09_hp_smart_numbers_up/gameSubmit.php?lboardparameters=" + lboardparameters;
return lboardparameters;
//openurl();
}
public static string EncryptRJ256(string prm_key, string prm_iv, string prm_text_to_encrypt)
{
string sToEncrypt = prm_text_to_encrypt;
RijndaelManaged myRijndael = new RijndaelManaged();
myRijndael.Padding = PaddingMode.Zeros;
myRijndael.Mode = CipherMode.CBC;
myRijndael.KeySize = 256;
myRijndael.BlockSize = 256;
byte[] encrypted = null;
byte[] toEncrypt = null;
byte[] key = null;
byte[] IV = null;
key = System.Text.Encoding.ASCII.GetBytes(prm_key);
IV = System.Text.Encoding.ASCII.GetBytes(prm_iv);
ICryptoTransform encryptor = myRijndael.CreateEncryptor(key, IV);
MemoryStream msEncrypt = new MemoryStream();
CryptoStream csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write);
toEncrypt = System.Text.Encoding.ASCII.GetBytes(sToEncrypt);
csEncrypt.Write(toEncrypt, 0, toEncrypt.Length);
csEncrypt.FlushFinalBlock();
encrypted = msEncrypt.ToArray();
return (Convert.ToBase64String(encrypted));
}
{
string timestamp = DateTime.Now.ToShortTimeString();
lboardparameters = fscore + "," + timestamp + "," + ipaddress + "," + gameid;
string sKy = "go!Animate@2010Cart00nNetw@rk!!!";
string sIV = "go!Animate@2010Cart00nNetw@rk!!!";
lboardparameters = EncryptRJ256(sKy, sIV, lboardparameters);
// string url = "http://www.cartoonnetworkasia.com/contest/2010/09_hp_smart_numbers_up/gameSubmit.php?lboardparameters=" + lboardparameters;
return lboardparameters;
//openurl();
}
public static string EncryptRJ256(string prm_key, string prm_iv, string prm_text_to_encrypt)
{
string sToEncrypt = prm_text_to_encrypt;
RijndaelManaged myRijndael = new RijndaelManaged();
myRijndael.Padding = PaddingMode.Zeros;
myRijndael.Mode = CipherMode.CBC;
myRijndael.KeySize = 256;
myRijndael.BlockSize = 256;
byte[] encrypted = null;
byte[] toEncrypt = null;
byte[] key = null;
byte[] IV = null;
key = System.Text.Encoding.ASCII.GetBytes(prm_key);
IV = System.Text.Encoding.ASCII.GetBytes(prm_iv);
ICryptoTransform encryptor = myRijndael.CreateEncryptor(key, IV);
MemoryStream msEncrypt = new MemoryStream();
CryptoStream csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write);
toEncrypt = System.Text.Encoding.ASCII.GetBytes(sToEncrypt);
csEncrypt.Write(toEncrypt, 0, toEncrypt.Length);
csEncrypt.FlushFinalBlock();
encrypted = msEncrypt.ToArray();
return (Convert.ToBase64String(encrypted));
}