- virtual char* OnRequest(Request* request)
- {
- HashRequest* SHA = (HashRequest*)request;
- if (strcmp("KEY", request->GetId()) == 0)
- {
- this->key = (unsigned int*)SHA->GetKeyData();
- }
- else if (strcmp("HEX", request->GetId()) == 0)
- {
- this->chars = (char*)SHA->GetOutputs();
- }
- else if (strcmp("SUM", request->GetId()) == 0)
- {
- static char data[MAXBUF];
- SHA256((const char*)SHA->GetHashData(), data, strlen(SHA->GetHashData()), chars ? chars : "0123456789abcdef", key);
- return data;
- }
- else if (strcmp("NAME", request->GetId()) == 0)
- {
- return "sha256";
- }
- else if (strcmp("RESET", request->GetId()) == 0)
- {
- this->chars = NULL;
- this->key = NULL;
- }
- return NULL;
- }
-
- virtual Version GetVersion()
- {
- return Version(1, 1, 0, 1, VF_VENDOR|VF_SERVICEPROVIDER, API_VERSION);
- }
+ HashSHA256(Module* parent) : HashProvider(parent, "hash/sha256", 32, 64) {}