براي تبديل اين كد از C# به C++ مشكل دارم:
public string Encrypt(string plainText)
{
byte[] initVectorBytes = Encoding.ASCII.GetBytes("laksjdhfgmznxsdf");
byte[] saltValueBytes = Encoding.ASCII.GetBytes("pass1");
byte[] plainTextBytes = Encoding.UTF8.GetBytes(plainText);
PasswordDeriveBytes password = new PasswordDeriveBytes(
"pass2",
saltValueBytes,
"SHA1",
2);
byte[] keyBytes = password.GetBytes(256 / 8);
RijndaelManaged symmetricKey = new RijndaelManaged();
symmetricKey.Mode = CipherMode.CBC;
ICryptoTransform encryptor = symmetricKey.CreateEncryptor(
keyBytes,
initVectorBytes);
MemoryStream memoryStream = new MemoryStream();
CryptoStream cryptoStream = new CryptoStream(memoryStream,
encryptor,
CryptoStreamMode.Write);
cryptoStream.Write(plainTextBytes, 0, plainTextBytes.Length);
cryptoStream.FlushFinalBlock();
byte[] cipherTextBytes = memoryStream.ToArray();
memoryStream.Close();
cryptoStream.Close();
string cipherText = Convert.ToBase64String(cipherTextBytes);
return cipherText;
}
با converter (دانلود كردم) كه تبديل ميكنم كلي خطا داره.
ممكنه راهنماييم كنيد؟