ardour
md5.h
Go to the documentation of this file.
1 /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
2  * rights reserved.
3  *
4  * License to copy and use this software is granted provided that it
5  * is identified as the "RSA Data Security, Inc. MD5 Message-Digest
6  * Algorithm" in all material mentioning or referencing this software
7  * or this function.
8  *
9  * License is also granted to make and use derivative works provided
10  * that such works are identified as "derived from the RSA Data
11  * Security, Inc. MD5 Message-Digest Algorithm" in all material
12  * mentioning or referencing the derived work.
13  *
14  * RSA Data Security, Inc. makes no representations concerning either
15  * the merchantability of this software or the suitability of this
16  * software for any particular purpose. It is provided "as is"
17  * without express or implied warranty of any kind.
18  *
19  * These notices must be retained in any copies of any part of this
20  * documentation and/or software.
21  */
22 
23 #ifndef __libpbd_md5_h__
24 #define __libpbd_md5_h__
25 
26 #include <string.h>
27 #include <stdint.h>
28 
29 #include "pbd/libpbd_visibility.h"
30 
32 {
33  public:
34  MD5();
35 
36  // an MD5 digest is a 16-byte number (32 hex digits)
37  uint8_t digestRaw[16] ;
38 
39  // This version of the digest is actually
40  // a "printf'd" version of the digest.
41  char digestChars[33] ;
42 
43  void writeToString ();
44  char* digestFile (char *filename);
45  char* digestMemory (uint8_t const * memchunk, size_t len);
46  char* digestString (char const *string);
47 
48  private:
49  struct context_t {
50  uint32_t state[4]; /* state (ABCD) */
51  uint32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */
52  uint8_t buffer[64]; /* input buffer */
53  };
54 
56 
57  void Init ();
58  void Transform (uint32_t state[4], uint8_t const * block);
59  void Encode (uint8_t *output, uint32_t const *input, size_t len);
60  void Decode (uint32_t *output, uint8_t const * input, size_t len);
61  void Update (uint8_t const *input, size_t inputLen);
62  void Final ();
63 
64 };
65 
66 #endif /* __libpbd_md5_h__ */
#define LIBPBD_API
Definition: md5.h:31
context_t context
Definition: md5.h:55