summaryrefslogtreecommitdiff
path: root/indra/llcommon/llmd5.h
diff options
context:
space:
mode:
authornat-goodspeed <nat@lindenlab.com>2024-09-05 15:40:12 -0400
committerGitHub <noreply@github.com>2024-09-05 15:40:12 -0400
commit04568da18d2261f3f7b851cf5341b766c9648204 (patch)
tree83d5db1c173636bb77ebb33e860fac77ab5d79e8 /indra/llcommon/llmd5.h
parent18d81e20f0b0044c16615953d7b69d7fb34d3449 (diff)
parentff2d79906ccef217194d5d9ec9d7025db03592a8 (diff)
Merge pull request #2513 from secondlife/lua-merge-dev
Merge develop branch into Lua project branch.
Diffstat (limited to 'indra/llcommon/llmd5.h')
-rw-r--r--indra/llcommon/llmd5.h82
1 files changed, 40 insertions, 42 deletions
diff --git a/indra/llcommon/llmd5.h b/indra/llcommon/llmd5.h
index 46c79cf5a2..ad063fda46 100644
--- a/indra/llcommon/llmd5.h
+++ b/indra/llcommon/llmd5.h
@@ -67,59 +67,57 @@ documentation and/or software.
*/
-#include <cstdint> // uint32_t et al.
+#include <cstdint> // uint32_t et al.
// use for the raw digest output
const int MD5RAW_BYTES = 16;
// use for outputting hex digests
-const int MD5HEX_STR_SIZE = 33; // char hex[MD5HEX_STR_SIZE]; with null
+const int MD5HEX_STR_SIZE = 33; // char hex[MD5HEX_STR_SIZE]; with null
const int MD5HEX_STR_BYTES = 32; // message system fixed size
-class LL_COMMON_API LLMD5 {
-// how many bytes to grab at a time when checking files
- static const int BLOCK_LEN;
+class LL_COMMON_API LLMD5
+{
+ // how many bytes to grab at a time when checking files
+ static const int BLOCK_LEN;
public:
-// methods for controlled operation:
- LLMD5 (); // simple initializer
- void update (const uint8_t *input, const size_t input_length);
- void update (std::istream& stream);
- void update (FILE *file);
- void update (const std::string& str);
- void finalize ();
-
-// constructors for special circumstances. All these constructors finalize
-// the MD5 context.
- LLMD5 (const unsigned char *string); // digest string, finalize
- LLMD5 (std::istream& stream); // digest stream, finalize
- LLMD5 (FILE *file); // digest file, close, finalize
- LLMD5 (const unsigned char *string, const unsigned int number);
-
-// methods to acquire finalized result
- void raw_digest(unsigned char *array) const; // provide 16-byte array for binary data
- void hex_digest(char *string) const; // provide 33-byte array for ascii-hex string
-
- friend LL_COMMON_API std::ostream& operator<< (std::ostream&, LLMD5 context);
+ // methods for controlled operation:
+ LLMD5(); // simple initializer
+ void update(const uint8_t* input, const size_t input_length);
+ void update(std::istream& stream);
+ void update(FILE* file);
+ void update(const std::string& str);
+ void finalize();
+
+ // constructors for special circumstances. All these constructors finalize
+ // the MD5 context.
+ LLMD5(const unsigned char* string); // digest string, finalize
+ LLMD5(std::istream& stream); // digest stream, finalize
+ LLMD5(FILE* file); // digest file, close, finalize
+ LLMD5(const unsigned char* string, const unsigned int number);
+
+ // methods to acquire finalized result
+ void raw_digest(unsigned char* array) const; // provide 16-byte array for binary data
+ void hex_digest(char* string) const; // provide 33-byte array for ascii-hex string
+
+ friend LL_COMMON_API std::ostream& operator<<(std::ostream&, const LLMD5& context);
private:
-
-
-// next, the private data:
- uint32_t state[4];
- uint64_t count; // number of *bits*, mod 2^64
- uint8_t buffer[64]; // input buffer
- uint8_t digest[16];
- uint8_t finalized;
-
-// last, the private methods, mostly static:
- void init (); // called by all constructors
- void transform (const uint8_t *buffer); // does the real update work. Note
- // that length is implied to be 64.
-
- static void encode (uint8_t *dest, const uint32_t *src, const size_t length);
- static void decode (uint32_t *dest, const uint8_t *src, const size_t length);
-
+ // next, the private data:
+ uint32_t state[4];
+ uint64_t count; // number of *bits*, mod 2^64
+ uint8_t buffer[64]; // input buffer
+ uint8_t digest[16];
+ bool finalized;
+
+ // last, the private methods, mostly static:
+ void init(); // called by all constructors
+ void transform(const uint8_t* buffer); // does the real update work. Note
+ // that length is implied to be 64.
+
+ static void encode(uint8_t* dest, const uint32_t* src, const size_t length);
+ static void decode(uint32_t* dest, const uint8_t* src, const size_t length);
};
LL_COMMON_API bool operator==(const LLMD5& a, const LLMD5& b);