Blender  V2.93
util_md5.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1999, 2002 Aladdin Enterprises. All rights reserved.
3  *
4  * This software is provided 'as-is', without any express or implied
5  * warranty. In no event will the authors be held liable for any damages
6  * arising from the use of this software.
7  *
8  * Permission is granted to anyone to use this software for any purpose,
9  * including commercial applications, and to alter it and redistribute it
10  * freely, subject to the following restrictions:
11  *
12  * 1. The origin of this software must not be misrepresented; you must not
13  * claim that you wrote the original software. If you use this software
14  * in a product, an acknowledgment in the product documentation would be
15  * appreciated but is not required.
16  * 2. Altered source versions must be plainly marked as such, and must not be
17  * misrepresented as being the original software.
18  * 3. This notice may not be removed or altered from any source distribution.
19  *
20  * L. Peter Deutsch
21  * ghost@aladdin.com
22  */
23 
24 /* MD5
25  *
26  * Simply MD5 hash computation, used by disk cache. Adapted from external
27  * code, with minor code modifications done to remove some unused code and
28  * change code style. */
29 
30 #ifndef __UTIL_MD5_H__
31 #define __UTIL_MD5_H__
32 
33 #include "util/util_string.h"
34 #include "util/util_types.h"
35 
37 
38 class MD5Hash {
39  public:
40  MD5Hash();
41  ~MD5Hash();
42 
43  void append(const uint8_t *data, int size);
44  void append(const string &str);
45  bool append_file(const string &filepath);
46  string get_hex();
47 
48  protected:
49  void process(const uint8_t *data);
50  void finish(uint8_t digest[16]);
51 
52  uint32_t count[2]; /* message length in bits, LSW first. */
53  uint32_t abcd[4]; /* digest buffer */
54  uint8_t buf[64]; /* accumulate block */
55 };
56 
57 string util_md5_string(const string &str);
58 
60 
61 #endif /* __UTIL_MD5_H__ */
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
bool append_file(const string &filepath)
Definition: util_md5.cpp:318
string get_hex()
Definition: util_md5.cpp:366
uint8_t buf[64]
Definition: util_md5.h:54
~MD5Hash()
Definition: util_md5.cpp:270
void finish(uint8_t digest[16])
Definition: util_md5.cpp:343
void append(const uint8_t *data, int size)
Definition: util_md5.cpp:274
void process(const uint8_t *data)
Definition: util_md5.cpp:100
uint32_t abcd[4]
Definition: util_md5.h:53
uint32_t count[2]
Definition: util_md5.h:52
#define str(s)
#define CCL_NAMESPACE_END
unsigned int uint32_t
Definition: stdint.h:83
unsigned char uint8_t
Definition: stdint.h:81
string util_md5_string(const string &str)
Definition: util_md5.cpp:380