1234567891011121314151617181920212223242526272829303132333435 |
- #include "main.h"
- /////////////////////////////////////////////////////////////////////////////
- CApiKeys::CApiKeys(void)
- {
- }
- CApiKeys::~CApiKeys(void)
- {
- }
- void CApiKeys::PushKey(const API_KEY &rak)
- {
- m_apiKeys.push_back(rak);
- }
- bool CApiKeys::Sha256HashString(const char *pszString, char *pszDigest, size_t nCChDigest)
- {
- if(!pszString || !pszDigest || (nCChDigest < SHA256_DIGEST_LENGTH))
- return false;
- SHA256_CTX context;
- if(!SHA256_Init(&context))
- return false;
- if(!SHA256_Update(&context, pszString, strlen(pszString)))
- return false;
- if(!SHA256_Final((unsigned char*)pszDigest, &context))
- return false;
- return true;
- }
|