Cjaker
[0xDEADBEEF] EXCEPTION_ACCESS_VIOLATION
Hi guys, i am trying make a simple socket connection to retrieve the character list, and in this process i think my rsaEncrypt function have problem, can anyone help me with this?
I think the problem is in double variable, because he occupies 8 bytes and i don't found other solution for this.
All other things is working fine (position, encryptionPos...)
Code:
I think the problem is in double variable, because he occupies 8 bytes and i don't found other solution for this.
All other things is working fine (position, encryptionPos...)
Code:
Code:
private BigInteger OTRsa = BigInteger.Parse("109120132967399429278860960508995541528237502902798129123468757937266291492576446330739696001110603907230888610072655818825358503429057592827629436413108566029093628212635953836686562675849720620786279431090218017681061521755056710823876476444260558147179707119674283982419152118103759076030616683978566631413");
public void rsaEncrypt()
{
double m = 0;
List<byte> rsaBytes = new List<byte>();
for (int i = encryptionPos; i < position; i++)
{
rsaBytes.Add(message[i]);
}
rsaBytes.Reverse();
for (int i = 0; i < rsaBytes.Count; i++)
{
m = m + (rsaBytes[i] * Math.Pow(256, i));
}
double pow = 65537;
double c = Math.Pow(200, pow) % (double)OTRsa;
Console.WriteLine(c);
List<byte> newArray = new List<byte>();
for (int i = 0; i < 1024; i += 8)
{
newArray.Add((byte)(((int)c >> i) & 255));
}
message.RemoveRange(encryptionPos, message.Count - encryptionPos);
message.InsertRange(encryptionPos, newArray);
encryptionPos = 0;
}