I have a c# class I can give you the entire class to work with at some point after I select a worker. The class is encryption and it uses three encrytion options. I need them converted to a silverlight class. The existing code works in .NET for ASP, WInforms etc but I need a version to work in silverlight.
## Deliverables
public unsafe Variable Encode(string algorithm, byte[] key)
{
SymmetricAlgorithm algorithm2;
if (![login to view URL])
{
throw new InvalidOperationException("Attempt to Encode a non-binary LOUIS value");
}
CspParameters parameters = new CspParameters
{
Flags = [login to view URL]
};
new RSACryptoServiceProvider(parameters);
if (algorithm == "DESCBC")
{
algorithm2 = [login to view URL]();
}
else if (algorithm == "AESCBC")
{
algorithm2 = [login to view URL]();
}
else if (algorithm == "RC2CBC")
{
algorithm2 = [login to view URL]();
}
else
{
if (algorithm != "3DESCBC")
{
throw new InvalidOperationException("Invalid encode algorithm: \"" + algorithm + "\"");
}
algorithm2 = [login to view URL]();
}
int length = [login to view URL] / 8;
byte[] sourceArray = (byte[])this;
int i = [login to view URL];
int inputCount = (i + length) + 4;
byte[] destinationArray = new byte[inputCount];
[login to view URL]();
[login to view URL]([login to view URL], destinationArray, length);
byte[] buffer3 = new byte[length];
for (int j = 0; j != length; j++)
{
buffer3[j] = 0;
}
[login to view URL] = buffer3;
[login to view URL] = [login to view URL];
[login to view URL] = [login to view URL];
[login to view URL] = 8 * length;
[login to view URL] = key;
fixed (byte* numRef = &(destinationArray[length]))
{
*((int*)numRef) = [login to view URL](i);
}
[login to view URL](sourceArray, 0, destinationArray, length + 4, i);
return [login to view URL]().TransformFinalBlock(destinationArray, 0, inputCount);
}
public unsafe Variable Decode(string algorithm, byte[] key)
{
SymmetricAlgorithm algorithm2;
byte[] buffer2;
int num4;
if (![login to view URL])
{
throw new InvalidOperationException("Attempt to Decode a non-binary LOUIS value");
}
CspParameters parameters = new CspParameters
{
Flags = [login to view URL]
};
new RSACryptoServiceProvider(parameters);
if (algorithm == "DESCBC")
{
algorithm2 = [login to view URL]();
}
else if (algorithm == "AESCBC")
{
algorithm2 = [login to view URL]();
}
else if (algorithm == "RC2CBC")
{
algorithm2 = [login to view URL]();
}
else
{
if (algorithm != "3DESCBC")
{
throw new InvalidOperationException("Invalid decode algorithm: \"" + algorithm + "\"");
}
algorithm2 = [login to view URL]();
}
int index = [login to view URL] / 8;
byte[] inputBuffer = (byte[])this;
int length = [login to view URL];
[login to view URL] = [login to view URL];
[login to view URL] = [login to view URL];
[login to view URL] = 8 * index;
[login to view URL] = key;
[login to view URL] = new byte[index];
for (int i = 0; i != index; i++)
{
[login to view URL][i] = 0;
}
ICryptoTransform transform = [login to view URL]();
try
{
buffer2 = [login to view URL](inputBuffer, 0, length);
}
catch (Exception)
{
throw new InvalidOperationException("Invalid decode, the source is not encoded with the given algorithm and key");
}
fixed (byte* numRef = &(buffer2[index]))
{
num4 = [login to view URL](*((int*)numRef));
}
if ((num4 > (([login to view URL] - 4) - index)) || (num4 < ((([login to view URL] - 4) - index) - index)))
{
throw new InvalidOperationException("Invalid decode, the source is not encoded with the given algorithm and key");
}
inputBuffer = new byte[num4];
[login to view URL](buffer2, index + 4, inputBuffer, 0, num4);
return inputBuffer;
}
public byte[] Hash(string algorithm)
{
HashAlgorithm algorithm2;
if (algorithm == "SHA1")
{
algorithm2 = [login to view URL]();
}
else if (algorithm == "SHA256")
{
algorithm2 = [login to view URL]();
}
else if (algorithm == "SHA384")
{
algorithm2 = [login to view URL]();
}
else if (algorithm == "SHA512")
{
algorithm2 = [login to view URL]();
}
else
{
if (algorithm != "MD5")
{
throw new InvalidOperationException("Invalid hash algorithm: \"" + algorithm + "\"");
}
algorithm2 = [login to view URL]();
}
if ([login to view URL])
{
int length = [login to view URL];
Variable variable = this;
byte[] buffer = (byte[])[login to view URL]();
return [login to view URL](buffer, 8, length * 2);
}
if (![login to view URL])
{
throw new InvalidOperationException("Invalid target for hash, must be string or binary");
}
byte[] buffer2 = (byte[])this;
return [login to view URL](buffer2, 0, [login to view URL]);
}
ID Proyek: 2738441
Tentang proyek
2 proposal
Proyek remot
Aktif 12 tahun yang lalu
Ingin menghasilkan uang?
Keuntungan menawar di Freelancer
Tentukan anggaran dan garis waktu Anda
Dapatkan bayaran atas pekerjaan Anda
Uraikan proposal Anda
Gratis mendaftar dan menawar pekerjaan
2 freelancer menawar dengan rata-rata $35 USD untuk pekerjaan ini