|
sdk-world v2026.11.05
PS2 SDK - world tier (copyleft-allowed, non-essential packages)
|
#include <string>#include <cstring>Go to the source code of this file.
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 | |
| std::string hmac | ( | const std::string & | data, |
| const std::string & | key ) |
| 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
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: