1 | /** @file
|
---|
2 | * innotek Portable Runtime - Message-Digest algorithm 5.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2007 innotek GmbH
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License as published by the Free Software Foundation,
|
---|
12 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
13 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
14 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * If you received this file as part of a commercial VirtualBox
|
---|
17 | * distribution, then only the terms of your commercial VirtualBox
|
---|
18 | * license agreement apply instead of the previous paragraph.
|
---|
19 | */
|
---|
20 |
|
---|
21 | #ifndef __iprt_md5_h__
|
---|
22 | #define __iprt_md5_h__
|
---|
23 |
|
---|
24 | #include <iprt/types.h>
|
---|
25 |
|
---|
26 | /** @defgroup grp_rt_md5 RTMd5 - Message-Digest algorithm 5
|
---|
27 | * @ingroup grp_rt
|
---|
28 | * @{
|
---|
29 | */
|
---|
30 |
|
---|
31 | /** Size of a MD5 hash. */
|
---|
32 | #define RTMD5HASHSIZE 16
|
---|
33 |
|
---|
34 | /**
|
---|
35 | * MD5 hash algorithm context.
|
---|
36 | */
|
---|
37 | typedef struct RTMD5CONTEXT
|
---|
38 | {
|
---|
39 | uint32_t buf[4];
|
---|
40 | uint32_t bits[2];
|
---|
41 | uint32_t in[16];
|
---|
42 | } RTMD5CONTEXT;
|
---|
43 |
|
---|
44 | /** Pointer to MD5 hash algorithm context. */
|
---|
45 | typedef RTMD5CONTEXT *PRTMD5CONTEXT;
|
---|
46 |
|
---|
47 | __BEGIN_DECLS
|
---|
48 |
|
---|
49 | /**
|
---|
50 | * Initialize MD5 context.
|
---|
51 | *
|
---|
52 | * @param pCtx Pointer to the MD5 context to initialize.
|
---|
53 | */
|
---|
54 | RTDECL(void) RTMd5Init(PRTMD5CONTEXT pCtx);
|
---|
55 |
|
---|
56 | /**
|
---|
57 | * Feed data into the MD5 computation.
|
---|
58 | *
|
---|
59 | * @param pCtx Pointer to the MD5 context.
|
---|
60 | * @param pvBuf Pointer to data.
|
---|
61 | * @param cbBuf Length of data (in bytes).
|
---|
62 | */
|
---|
63 | RTDECL(void) RTMd5Update(PRTMD5CONTEXT pCtx, const void *pvBuf, size_t cbBuf);
|
---|
64 |
|
---|
65 | /**
|
---|
66 | * Compute the MD5 hash of the data.
|
---|
67 | *
|
---|
68 | * @param pabDigest Where to store the hash.
|
---|
69 | * (What's passed is a pointer to the caller's buffer.)
|
---|
70 | * @param pCtx Pointer to the MD5 context.
|
---|
71 | */
|
---|
72 | RTDECL(void) RTMd5Final(uint8_t pabDigest[RTMD5HASHSIZE], PRTMD5CONTEXT pCtx);
|
---|
73 |
|
---|
74 | __END_DECLS
|
---|
75 |
|
---|
76 | /** @} */
|
---|
77 |
|
---|
78 | #endif /* !__iprt_md5_h__ */
|
---|