From c492f5a98732d9d856e0846ece467d964dab646a Mon Sep 17 00:00:00 2001 From: brain Date: Thu, 10 Apr 2008 16:09:26 +0000 Subject: Whoops, overwriting hash with the hex isnt a good idea git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9447 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_ripemd160.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_ripemd160.cpp b/src/modules/m_ripemd160.cpp index 78b164315..b6fd27344 100644 --- a/src/modules/m_ripemd160.cpp +++ b/src/modules/m_ripemd160.cpp @@ -64,8 +64,8 @@ typedef unsigned char byte; typedef unsigned int dword; #else -typedef uint8_t byte; -typedef uint32_t dword; +typedef uint8_t byte; +typedef uint32_t dword; #endif /* collect four bytes into one word: */ @@ -435,7 +435,7 @@ class ModuleRIPEMD160 : public Module } unsigned int* currkey; - char* chars; + const char* chars; public: @@ -461,19 +461,19 @@ class ModuleRIPEMD160 : public Module } else if (strcmp("HEX", request->GetId()) == 0) { - this->chars = (char*)SHA->GetOutputs(); + this->chars = SHA->GetOutputs(); } else if (strcmp("SUM", request->GetId()) == 0) { - static char* data; - data = (char*)RMD((byte *)SHA->GetHashData().data(),SHA->GetHashData().length(), currkey); + static char output[MAXBUF]; + char* data = (char*)RMD((byte *)SHA->GetHashData().data(),SHA->GetHashData().length(), currkey); for (int i = 0, j = 0; i < RMDsize / 8; i++) { - data[j++] = chars[data[i] / 16]; - data[j++] = chars[data[i] % 16]; - data[j] = '\0'; + output[j++] = chars[data[i] / 16]; + output[j++] = chars[data[i] % 16]; + output[j] = '\0'; } - return data; + return output; } else if (strcmp("NAME", request->GetId()) == 0) { -- cgit v1.2.3