Explorar el Código

完成md5类接口变更

Jeff hace 5 años
padre
commit
f40b2734bf
Se han modificado 1 ficheros con 10 adiciones y 1 borrados
  1. 10 1
      SATService/SATService/md5.cpp

+ 10 - 1
SATService/SATService/md5.cpp

@@ -324,7 +324,16 @@ LPCTSTR CMD5::GetFileMD5(LPCTSTR lpFilePath)
 
 	FILE *pFile = NULL;
 	if ( fopen_s(&pFile, lpFilePath, "r+") ) {
-
+		fseek(pFile, 0, SEEK_END);  
+		size_t nSrcLen = ftell(pFile);  
+		fseek(pFile, 0, SEEK_SET);  
+		byte* pSrcData = (byte*)malloc(nSrcLen);  
+		fread(pSrcData, nSrcLen, 1, pFile);  
+		fclose(pFile);  
+
+		m_pInputText =  pSrcData; 
+		m_nInputLen = nSrcLen;
+		m_bValidDigest = CalcDigest();
 	}
 
 	if( m_bValidDigest )