|
CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
|
Usage: std::string msg = "The quick brown fox jumps over the lazy dog"; std::string key = "key"; std::string md5hmac = hmac< MD5 >(msg, key); std::string sha1hmac = hmac< SHA1 >(msg, key); std::string sha2hmac = hmac<SHA256>(msg, key);. More...
Classes | |
| class | CRC32 |
| compute CRC32 hash, based on Intel's Slicing-by-8 algorithm More... | |
| class | Hash |
| abstract base class More... | |
| class | Keccak |
| compute Keccak hash (designated SHA3) More... | |
| class | MD5 |
| compute MD5 hash More... | |
| class | SHA1 |
| compute SHA1 hash More... | |
| class | SHA256 |
| compute SHA256 hash More... | |
| class | SHA3 |
| compute SHA3 hash More... | |
Functions | |
| template<typename HashMethod> | |
| std::string | hmac (const void *data, size_t numDataBytes, const void *key, size_t numKeyBytes) |
| compute HMAC hash of data and key using MD5, SHA1 or SHA256 | |
| template<typename HashMethod> | |
| std::string | hmac (const std::string &data, const std::string &key) |
| convenience function for std::string | |
Usage: std::string msg = "The quick brown fox jumps over the lazy dog"; std::string key = "key"; std::string md5hmac = hmac< MD5 >(msg, key); std::string sha1hmac = hmac< SHA1 >(msg, key); std::string sha2hmac = hmac<SHA256>(msg, key);.
Note: To keep my code simple, HMAC computation currently needs the whole message at once. This is in contrast to the hashes MD5, SHA1, etc. where an add() method is available for incremental computation. You can use any hash for HMAC as long as it provides:
| std::string hash::hmac | ( | const std::string & | data, |
| const std::string & | key ) |