Electroneum
Loading...
Searching...
No Matches
md5_l.h
Go to the documentation of this file.
1
/*
2
* libEtPan! -- a mail stuff library
3
*
4
* Copyright (C) 2001, 2005 - DINH Viet Hoa
5
* All rights reserved.
6
*
7
* Redistribution and use in source and binary forms, with or without
8
* modification, are permitted provided that the following conditions
9
* are met:
10
* 1. Redistributions of source code must retain the above copyright
11
* notice, this list of conditions and the following disclaimer.
12
* 2. Redistributions in binary form must reproduce the above copyright
13
* notice, this list of conditions and the following disclaimer in the
14
* documentation and/or other materials provided with the distribution.
15
* 3. Neither the name of the libEtPan! project nor the names of its
16
* contributors may be used to endorse or promote products derived
17
* from this software without specific prior written permission.
18
*
19
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
20
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
23
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29
* SUCH DAMAGE.
30
*/
31
32
/*
33
* $Id: md5.h,v 1.1.1.1 2005/03/18 20:17:27 zautrix Exp $
34
*/
35
36
/* MD5.H - header file for MD5C.C
37
*/
38
39
/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
40
rights reserved.
41
42
License to copy and use this software is granted provided that it
43
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
44
Algorithm" in all material mentioning or referencing this software
45
or this function.
46
47
License is also granted to make and use derivative works provided
48
that such works are identified as "derived from the RSA Data
49
Security, Inc. MD5 Message-Digest Algorithm" in all material
50
mentioning or referencing the derived work.
51
52
RSA Data Security, Inc. makes no representations concerning either
53
the merchantability of this software or the suitability of this
54
software for any particular purpose. It is provided "as is"
55
without express or implied warranty of any kind.
56
These notices must be retained in any copies of any part of this
57
documentation and/or software.
58
*/
59
#ifndef MD5_H
60
#define MD5_H
61
62
63
#include "
md5global.h
"
64
65
namespace
md5
66
{
67
/* MD5 context. */
68
typedef
struct
{
69
UINT4
state
[4];
/* state (ABCD) */
70
UINT4
count
[2];
/* number of bits, modulo 2^64 (lsb first) */
71
unsigned
char
buffer
[64];
/* input buffer */
72
}
MD5_CTX
;
73
74
static
void
MD5Init(
MD5_CTX
* context);
75
static
void
MD5Update(
MD5_CTX
*context,
const
unsigned
char
*input,
unsigned
int
inputLen );
76
static
void
MD5Final (
unsigned
char
digest[16],
MD5_CTX
*context );
77
static
inline
void
hmac_md5
(
const
unsigned
char
* text,
int
text_len,
const
unsigned
char
*
key
,
int
key_len,
unsigned
char
*digest);
78
79
80
inline
bool
md5
(
unsigned
char
*input,
int
ilen,
unsigned
char
output[16] )
81
{
82
MD5_CTX
ctx;
83
84
MD5Init( &ctx );
85
MD5Update( &ctx, input, ilen );
86
MD5Final( output, &ctx);
87
88
memset( &ctx, 0,
sizeof
(
MD5_CTX
) );
89
return
true
;
90
}
91
92
93
}
94
95
#include "md5_l.inl"
96
97
#endif
key
const char * key
Definition
hmac_keccak.cpp:39
md5global.h
md5
Definition
hmac-md5.h:43
md5::hmac_md5
void hmac_md5(const unsigned char *text, int text_len, const unsigned char *key, int key_len, unsigned char digest[HMAC_MD5_SIZE])
md5::UINT4
unsigned int UINT4
Definition
md5global.h:63
md5::MD5_CTX
Definition
md5_l.h:68
md5::MD5_CTX::buffer
unsigned char buffer[64]
Definition
md5_l.h:71
md5::MD5_CTX::state
UINT4 state[4]
Definition
md5_l.h:69
md5::MD5_CTX::count
UINT4 count[2]
Definition
md5_l.h:70
contrib
epee
include
md5_l.h
Generated on
for Electroneum by
1.16.1