Reputation: 21
I am trying to convert following C# code into C++
SHA256 hash = SHA256.Create();
hash.TransformBlock(key, 0, key.Length, null, 0);
for (int i = 0; i < 1000; ++i)
{
hash.TransformBlock(cipheredSHA256Hash, 0, 32, null, 0);
}
hash.TransformFinalBlock(cipheredSHA256Hash,0, 0);
using (RijndaelManaged rijndael = new RijndaelManaged())
{
rijndael.Key = hash.Hash;
rijndael.Mode = CipherMode.ECB;
rijndael.Padding = PaddingMode.Zeros;
ICryptoTransform decryptor = rijndael.CreateDecryptor();
return decryptor.TransformFinalBlock(cipheredOffSet60, 0, cipheredOffSet60.Length);
}
is there any option for above code in C++
Upvotes: 0
Views: 5648
Reputation: 209
Try having a look at the free Crypto++ library. It implements several cryptographic algorithms, including SHA256 and AES/Rijndael.
Check the following discussions for examples on how to create SHA256 hashes and decrypt AES:
Create a SHA256 hash with Crypto++
Upvotes: 1