Adobe Source Libraries
2.0.0
A collection of C++ libraries.
Loading...
Searching...
No Matches
md5.hpp
Go to the documentation of this file.
1
/*
2
Copyright 2005-2007 Adobe Systems Incorporated and others
3
Distributed under the Boost Software License - Version 1.0 (see the accompanying file LICENSE
4
or a copy at https://stlab.github.io/adobe_source_libraries/licenses.html)
5
*/
6
7
/**************************************************************************************************/
8
9
#ifndef ADOBE_MD5_HPP
10
#define ADOBE_MD5_HPP
11
12
#include <
adobe/config.hpp
>
13
14
#include <array>
15
#include <cstddef>
16
#include <cstdint>
17
18
/**************************************************************************************************/
19
20
/*
21
Relevant copyright information is provided below and may not be removed from this file.
22
23
Derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm.
24
*/
25
26
/**************************************************************************************************/
27
28
/*
29
MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm
30
31
Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All rights
32
reserved.
33
34
License to copy and use this software is granted provided that it is
35
identified as the "RSA Data Security, Inc. MD5 Message-Digest Algorithm" in
36
all material mentioning or referencing this software or this function.
37
38
License is also granted to make and use derivative works provided that such
39
works are identified as "derived from the RSA Data Security, Inc. MD5
40
Message-Digest Algorithm" in all material mentioning or referencing the
41
derived work.
42
43
RSA Data Security, Inc. makes no representations concerning either the
44
merchantability of this software or the suitability of this software for
45
any particular purpose. It is provided "as is" without express or implied
46
warranty of any kind.
47
48
These notices must be retained in any copies of any part of this
49
documentation and/or software.
50
*/
51
52
/**************************************************************************************************/
53
54
namespace
adobe
{
55
60
67
73
82
90
91
92
/**************************************************************************************************/
93
94
class
md5_t
{
95
public
:
96
typedef
std::array<std::uint8_t, 16>
digest_t
;
97
98
md5_t
();
99
100
void
update
(
void
* input_block, std::size_t input_length);
101
102
digest_t
final
();
103
104
private
:
105
void
reset();
106
107
std::uint32_t state_m[4];
/* state (ABCD) */
108
std::uint32_t count_m[2];
/* number of bits, modulo 2^64 (lsb first) */
109
std::uint8_t buffer_m[64];
/* input buffer */
110
};
111
112
/**************************************************************************************************/
113
124
inline
md5_t::digest_t
md5
(
void
* input_block, std::size_t input_length) {
125
md5_t
m;
126
127
m.
update
(input_block, input_length);
128
129
return
m.
final
();
130
}
131
132
/**************************************************************************************************/
133
134
}
// namespace adobe
135
136
/**************************************************************************************************/
137
138
#endif
139
140
/**************************************************************************************************/
adobe::md5_t::md5
md5_t::digest_t md5(void *input_block, std::size_t input_length)
Definition
md5.hpp:124
adobe::md5_t::update
void update(void *input_block, std::size_t input_length)
adobe::md5_t::final
digest_t final()
adobe::md5_t::digest_t
std::array< std::uint8_t, 16 > digest_t
Definition
md5.hpp:96
adobe::md5_t::md5_t
md5_t()
config.hpp
adobe
Definition
class_template.hpp:7
adobe
md5.hpp
Generated by
1.14.0