aboutsummaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/Auth/Sha1.h2
-rw-r--r--src/shared/Util.cpp20
-rw-r--r--src/shared/Util.h1
3 files changed, 21 insertions, 2 deletions
diff --git a/src/shared/Auth/Sha1.h b/src/shared/Auth/Sha1.h
index 68c61eb7a8e..099cf99321a 100644
--- a/src/shared/Auth/Sha1.h
+++ b/src/shared/Auth/Sha1.h
@@ -44,8 +44,6 @@ class Sha1Hash
uint8 *GetDigest(void) { return mDigest; };
int GetLength(void) { return SHA_DIGEST_LENGTH; };
- BigNumber GetBigNumber();
-
private:
SHA_CTX mC;
uint8 mDigest[SHA_DIGEST_LENGTH];
diff --git a/src/shared/Util.cpp b/src/shared/Util.cpp
index 41ed9c0fa8b..ede7a27ea7b 100644
--- a/src/shared/Util.cpp
+++ b/src/shared/Util.cpp
@@ -502,3 +502,23 @@ void vutf8printf(FILE *out, const char *str, va_list* ap)
vfprintf(out, str, *ap);
#endif
}
+
+void hexEncodeByteArray(uint8* bytes, uint32 arrayLen, std::string& result)
+{
+ std::ostringstream ss;
+ for(uint32 i=0; i<arrayLen; ++i)
+ {
+ for(uint8 j=0; j<2; ++j)
+ {
+ unsigned char nibble = 0x0F & (bytes[i]>>((1-j)*4));
+ char encodedNibble;
+ if(nibble < 0x0A)
+ encodedNibble = '0'+nibble;
+ else
+ encodedNibble = 'A'+nibble-0x0A;
+ ss << encodedNibble;
+ }
+ }
+ result = ss.str();
+}
+
diff --git a/src/shared/Util.h b/src/shared/Util.h
index 91f7c95b5ab..04be6e93bed 100644
--- a/src/shared/Util.h
+++ b/src/shared/Util.h
@@ -291,6 +291,7 @@ void vutf8printf(FILE *out, const char *str, va_list* ap);
bool IsIPAddress(char const* ipaddress);
uint32 CreatePIDFile(const std::string& filename);
+void hexEncodeByteArray(uint8* bytes, uint32 arrayLen, std::string& result);
#endif
//handler for operations on large flags