summaryrefslogtreecommitdiff
path: root/indra/llcommon/llmd5.cpp
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2010-07-19 17:15:32 -0400
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2010-07-19 17:15:32 -0400
commit1dae91d7354aef57625e3508b23a4bb21de242e8 (patch)
tree6759f56f1a65b00a92522550c0ef30c09c147f08 /indra/llcommon/llmd5.cpp
parentd4845c1d263c07aaa0b8c2c638cd2a214e166bdd (diff)
EXT-8360 WIP - propagating COF item name changes various places
Diffstat (limited to 'indra/llcommon/llmd5.cpp')
-rw-r--r--indra/llcommon/llmd5.cpp37
1 files changed, 24 insertions, 13 deletions
diff --git a/indra/llcommon/llmd5.cpp b/indra/llcommon/llmd5.cpp
index da9cb94e13..cc73c3e45c 100644
--- a/indra/llcommon/llmd5.cpp
+++ b/indra/llcommon/llmd5.cpp
@@ -171,11 +171,6 @@ void LLMD5::update(FILE* file){
}
-
-
-
-
-
// MD5 update for istreams.
// Like update for files; see above.
@@ -192,9 +187,10 @@ void LLMD5::update(std::istream& stream){
}
-
-
-
+void LLMD5::update(const std::string& s)
+{
+ update((unsigned char *)s.c_str(),s.length());
+}
// MD5 finalization. Ends an MD5 message-digest operation, writing the
// the message digest and zeroizing the context.
@@ -277,7 +273,7 @@ LLMD5::LLMD5(const unsigned char *s)
finalize();
}
-void LLMD5::raw_digest(unsigned char *s)
+void LLMD5::raw_digest(unsigned char *s) const
{
if (!finalized)
{
@@ -293,7 +289,7 @@ void LLMD5::raw_digest(unsigned char *s)
-void LLMD5::hex_digest(char *s)
+void LLMD5::hex_digest(char *s) const
{
int i;
@@ -319,6 +315,7 @@ void LLMD5::hex_digest(char *s)
+
std::ostream& operator<<(std::ostream &stream, LLMD5 context)
{
char s[33]; /* Flawfinder: ignore */
@@ -327,13 +324,25 @@ std::ostream& operator<<(std::ostream &stream, LLMD5 context)
return stream;
}
+bool operator==(const LLMD5& a, const LLMD5& b)
+{
+ unsigned char a_guts[16];
+ unsigned char b_guts[16];
+ a.raw_digest(a_guts);
+ b.raw_digest(b_guts);
+ if (memcmp(a_guts,b_guts,16)==0)
+ return true;
+ else
+ return false;
+}
-
+bool operator!=(const LLMD5& a, const LLMD5& b)
+{
+ return !(a==b);
+}
// PRIVATE METHODS:
-
-
void LLMD5::init(){
finalized=0; // we just started!
@@ -531,3 +540,5 @@ void LLMD5::decode (uint4 *output, const uint1 *input, const uint4 len){
output[i] = ((uint4)input[j]) | (((uint4)input[j+1]) << 8) |
(((uint4)input[j+2]) << 16) | (((uint4)input[j+3]) << 24);
}
+
+