-
December 2nd, 2008, 09:46 PM
#1
How does this translate to c++
Hi all,
How does this translate to c++:
string key = (string)settingsReader.GetValue("SecurityKey", typeof(String));
HashAlgorithm XHash = HashAlgorithm.Create("MD5");byte[] keyArray = XHash.ComputeHash(UTF8Encoding.UTF8.GetBytes(key));
XHash.Clear();
TripleDESCryptoServiceProvider tdes = new TripleDESCryptoServiceProvider();
tdes.Key = keyArray;
tdes.Mode = CipherMode.ECB;
tdes.Padding = PaddingMode.PKCS7;
This is what I did but i am not sure if its correct because I didnt do the UTF8Encoding part.
TCHAR szKey[] = _T("Key");
DWORD pwlen = _tcslen(szKey);
result = CryptCreateHash(hProv,CALG_MD5,0,0,&hHash);
result = CryptHashData(hHash,(BYTE *)szKey,pwlen,0);
result = CryptDeriveKey(hProv,CALG_3DES,hHash,0,&hKey);
BYTE PadMode = CRYPT_MODE_ECB;
result = CryptSetKeyParam(hKey, PKCS5_PADDING, &PadMode, 0);
Please help me clarify things.
Thanks,
Jayjay
-
December 3rd, 2008, 05:03 AM
#2
Re: How does this translate to c++
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|