-
- void SHA256(const char *src, char *dest, int len, const char* hxc, const unsigned int* key = NULL)
- {
- // Generate the hash
- unsigned char bytehash[SHA256_DIGEST_SIZE];
- struct SHA256Context ctx;
- SHA256Init(&ctx, key);
- SHA256Update(&ctx, (unsigned char *)src, (unsigned int)len);
- SHA256Final(&ctx, bytehash);
- // Convert it to hex
- for (int i = 0, j = 0; i < SHA256_DIGEST_SIZE; i++)
- {
- dest[j++] = hxc[bytehash[i] / 16];
- dest[j++] = hxc[bytehash[i] % 16];
- dest[j] = '\0';
- }
- }
-
- unsigned int* key;
- char* chars;
-
- public:
-
- ModuleSHA256(InspIRCd* Me) : Module::Module(Me), key(NULL), chars(NULL)
- {
- }