aboutsummaryrefslogtreecommitdiff
path: root/src/shared/Util.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-09-02 18:14:10 -0500
committermegamage <none@none>2009-09-02 18:14:10 -0500
commitea12ff233b985bd9db6f99eee07fefde80811a94 (patch)
tree92109342be4da2582bdc1a97cf10183efaf5452f /src/shared/Util.cpp
parent9d161ff757daf47335f7cc84825463cc30818c8c (diff)
[8450] Prevented using of plaintext passwords in sql queries Author: arrai
--HG-- branch : trunk
Diffstat (limited to 'src/shared/Util.cpp')
-rw-r--r--src/shared/Util.cpp20
1 files changed, 20 insertions, 0 deletions
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();
+}
+