- }
-
- virtual ~ModuleMD5()
- {
- }
-
- void Implements(char* List)
- {
- List[I_OnRequest] = 1;
- }
-
- virtual char* OnRequest(Request* request)
- {
- HashRequest* MD5 = (HashRequest*)request;
- ServerInstance->Log(DEBUG,"MD5 REQUEST type %s", request->GetId());
- if (strcmp("KEY", request->GetId()) == 0)
- {
- this->key = (unsigned int*)MD5->GetKeyData();
- }
- else if (strcmp("HEX", request->GetId()) == 0)
- {
- this->chars = (char*)MD5->GetOutputs();
- }
- else if (strcmp("SUM", request->GetId()) == 0)
- {
- ServerInstance->Log(DEBUG,"MD5 SUM!");
- static char data[MAXBUF];
- GenHash((const char*)MD5->GetHashData(), data, chars ? chars : "0123456789abcdef", key);
- return data;
- }
- else if (strcmp("RESET", request->GetId()) == 0)
- {
- ServerInstance->Log(DEBUG,"MD5 RESET!");
- this->chars = NULL;
- this->key = NULL;
- }
- return NULL;
+ char res[16];
+ MyMD5(res, (void*)data.data(), data.length());
+ return std::string(res, 16);