add GetSHA1ForString
This commit is contained in:
@@ -444,6 +444,20 @@ RString CryptManager::GetMD5ForString( RString sData )
|
|||||||
return RString( (const char *) digest, sizeof(digest) );
|
return RString( (const char *) digest, sizeof(digest) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RString CryptManager::GetSHA1ForString( RString sData )
|
||||||
|
{
|
||||||
|
unsigned char digest[16];
|
||||||
|
|
||||||
|
int iHash = register_hash( &sha1_desc );
|
||||||
|
|
||||||
|
hash_state hash;
|
||||||
|
int iRet = hash_descriptor[iHash].init( &hash );
|
||||||
|
iRet = hash_descriptor[iHash].process( &hash, (const unsigned char *) sData.data(), sData.size() );
|
||||||
|
iRet = hash_descriptor[iHash].done( &hash, digest );
|
||||||
|
|
||||||
|
return RString( (const char *) digest, sizeof(digest) );
|
||||||
|
}
|
||||||
|
|
||||||
RString CryptManager::GetPublicKeyFileName()
|
RString CryptManager::GetPublicKeyFileName()
|
||||||
{
|
{
|
||||||
return PUBLIC_KEY_PATH;
|
return PUBLIC_KEY_PATH;
|
||||||
|
|||||||
@@ -22,8 +22,9 @@ public:
|
|||||||
|
|
||||||
static void GetRandomBytes( void *pData, int iBytes );
|
static void GetRandomBytes( void *pData, int iBytes );
|
||||||
|
|
||||||
static RString GetMD5ForFile( RString fn ); // binary
|
static RString GetMD5ForFile( RString fn ); // in binary
|
||||||
static RString GetMD5ForString( RString sData ); // in binary
|
static RString GetMD5ForString( RString sData ); // in binary
|
||||||
|
static RString GetSHA1ForString( RString sData ); // in binary
|
||||||
|
|
||||||
static RString GetPublicKeyFileName();
|
static RString GetPublicKeyFileName();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user