求救CalculateLicense序列号加密算法
public static string CalculateLicense (int number, string key){
byte[] buffer3 = new byte[4];
if (key.Trim() == string.Empty)
{
key = Path.GetFileNameWithoutExtension(Application.get_ExecutablePath());
}
byte[] buffer4 = new byte[key.get_Length()];
MemoryStream stream1 = new MemoryStream();
for (int i = 0;i < 4; i++)
{
buffer3[3 - i] = (byte) (number % 0x100);
number /= 0x100;
}
int num2 = 0;
for (int j = 0;j < key.get_Length(); j++)
{
buffer4[j] = (byte) (key.get_Chars(j) ^ buffer3[num2]);
num2 = (num2 + 1) % 4;
}
CryptoStream stream2 = new CryptoStream(stream1, new DESCryptoServiceProvider().CreateEncryptor(new byte[]{0x68, 2, 0xba, 0x3d, 0x2e, 0x63, 0x4b, 0x45}, new byte[]{0xed, 0x27, 0x63, 0x62, 0xfe, 0x88, 0x11, 0x6e}), 1);
stream2.Write(buffer4, 0, buffer4.Length);
stream2.FlushFinalBlock();
buffer3 = new byte[stream1.get_Length()];
stream1.set_Position((long) 0);
stream1.Read(buffer3, 0, buffer3.Length);
return Convert.ToBase64String(buffer3, 0, buffer3.Length);
}
补充:.NET技术 , VB.NET