-
MFC에서 HASH Class 사용하기개발/지름 2008. 1. 24. 14:10반응형
출처 - CodeProject
MD5// Define a CHash object
CHash hashObj;// Set the algorithm
hashObj.SetHashAlgorithm(MD5);// Set the operation
hashObj.SetHashOperation(STRING_HASH);// Set the string
hashObj.SetHashString("String to hash");// Hash the string
CString outHash = hashObj.DoHash();SHA1
// Define a CHash object
CHash hashObj;// Set the algorithm
hashObj.SetHashAlgorithm(SHA1);// Set the operation
hashObj.SetHashOperation(FILE_HASH);// Set the file
hashObj.SetHashFile("C:\\Windows\\Explorer.exe");// Hash the file
CString outHash = hashObj.DoHash();
SHA2// Define a CHash object
CHash hashObj;// Set the operation
hashObj.SetHashOperation(FILE_HASH);// Set the algorithm
hashObj.SetHashAlgorithm(SHA2);// Set the SHA-2 strength
hashObj.SetSHA2Strength(256);// Set the file
hashObj.SetHashFile("C:\\Windows\\Explorer.exe");// Hash the file
CString outHash = hashObj.DoHash();반응형