forked from neomutt/neomutt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmd5.h
56 lines (49 loc) · 1.61 KB
/
md5.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**
* @file
* Calculate the MD5 checksum of a buffer
*
* @authors
* Copyright (C) 1995-2008 Free Software Foundation, Inc.
*
* @copyright
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 2 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MUTT_LIB_MD5_H
#define MUTT_LIB_MD5_H
#include <stdint.h>
#include <stdio.h>
typedef uint32_t md5_uint32;
/**
* struct Md5Ctx - Cursor for the MD5 hashing
*
* Structure to save state of computation between the single steps
*/
struct Md5Ctx
{
md5_uint32 A;
md5_uint32 B;
md5_uint32 C;
md5_uint32 D;
md5_uint32 total[2];
md5_uint32 buflen;
md5_uint32 buffer[32];
};
void *mutt_md5(const char *str, void *buf);
void *mutt_md5_bytes(const void *buffer, size_t len, void *resbuf);
void *mutt_md5_finish_ctx(struct Md5Ctx *md5ctx, void *resbuf);
void mutt_md5_init_ctx(struct Md5Ctx *md5ctx);
void mutt_md5_process(const char *str, struct Md5Ctx *md5ctx);
void mutt_md5_process_bytes(const void *buf, size_t buflen, struct Md5Ctx *md5ctx);
void mutt_md5_toascii(const void *digest, char *resbuf);
#endif /* MUTT_LIB_MD5_H */