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 |
|
---|
17 | #ifndef ___iprt_md5_h
|
---|
18 | #define ___iprt_md5_h
|
---|
19 |
|
---|
20 | #include <iprt/types.h>
|
---|
21 |
|
---|
22 | /** @defgroup grp_rt_md5 RTMd5 - Message-Digest algorithm 5
|
---|
23 | * @ingroup grp_rt
|
---|
24 | * @{
|
---|
25 | */
|
---|
26 |
|
---|
27 | /** Size of a MD5 hash. */
|
---|
28 | #define RTMD5HASHSIZE 16
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * MD5 hash algorithm context.
|
---|
32 | */
|
---|
33 | typedef struct RTMD5CONTEXT
|
---|
34 | {
|
---|
35 | uint32_t buf[4];
|
---|
36 | uint32_t bits[2];
|
---|
37 | uint32_t in[16];
|
---|
38 | } RTMD5CONTEXT;
|
---|
39 |
|
---|
40 | /** Pointer to MD5 hash algorithm context. */
|
---|
41 | typedef RTMD5CONTEXT *PRTMD5CONTEXT;
|
---|
42 |
|
---|
43 | __BEGIN_DECLS
|
---|
44 |
|
---|
45 | /**
|
---|
46 | * Initialize MD5 context.
|
---|
47 | *
|
---|
48 | * @param pCtx Pointer to the MD5 context to initialize.
|
---|
49 | */
|
---|
50 | RTDECL(void) RTMd5Init(PRTMD5CONTEXT pCtx);
|
---|
51 |
|
---|
52 | /**
|
---|
53 | * Feed data into the MD5 computation.
|
---|
54 | *
|
---|
55 | * @param pCtx Pointer to the MD5 context.
|
---|
56 | * @param pvBuf Pointer to data.
|
---|
57 | * @param cbBuf Length of data (in bytes).
|
---|
58 | */
|
---|
59 | RTDECL(void) RTMd5Update(PRTMD5CONTEXT pCtx, const void *pvBuf, size_t cbBuf);
|
---|
60 |
|
---|
61 | /**
|
---|
62 | * Compute the MD5 hash of the data.
|
---|
63 | *
|
---|
64 | * @param pabDigest Where to store the hash.
|
---|
65 | * (What's passed is a pointer to the caller's buffer.)
|
---|
66 | * @param pCtx Pointer to the MD5 context.
|
---|
67 | */
|
---|
68 | RTDECL(void) RTMd5Final(uint8_t pabDigest[RTMD5HASHSIZE], PRTMD5CONTEXT pCtx);
|
---|
69 |
|
---|
70 | __END_DECLS
|
---|
71 |
|
---|
72 | /** @} */
|
---|
73 |
|
---|
74 | #endif /* !__iprt_md5_h__ */
|
---|