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 (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef ___iprt_md5_h
|
---|
27 | #define ___iprt_md5_h
|
---|
28 |
|
---|
29 | #include <iprt/types.h>
|
---|
30 |
|
---|
31 | /** @defgroup grp_rt_md5 RTMd5 - Message-Digest algorithm 5
|
---|
32 | * @ingroup grp_rt
|
---|
33 | * @{
|
---|
34 | */
|
---|
35 |
|
---|
36 | /** Size of a MD5 hash. */
|
---|
37 | #define RTMD5HASHSIZE 16
|
---|
38 |
|
---|
39 | /**
|
---|
40 | * MD5 hash algorithm context.
|
---|
41 | */
|
---|
42 | typedef struct RTMD5CONTEXT
|
---|
43 | {
|
---|
44 | uint32_t buf[4];
|
---|
45 | uint32_t bits[2];
|
---|
46 | uint32_t in[16];
|
---|
47 | } RTMD5CONTEXT;
|
---|
48 |
|
---|
49 | /** Pointer to MD5 hash algorithm context. */
|
---|
50 | typedef RTMD5CONTEXT *PRTMD5CONTEXT;
|
---|
51 |
|
---|
52 | __BEGIN_DECLS
|
---|
53 |
|
---|
54 | /**
|
---|
55 | * Initialize MD5 context.
|
---|
56 | *
|
---|
57 | * @param pCtx Pointer to the MD5 context to initialize.
|
---|
58 | */
|
---|
59 | RTDECL(void) RTMd5Init(PRTMD5CONTEXT pCtx);
|
---|
60 |
|
---|
61 | /**
|
---|
62 | * Feed data into the MD5 computation.
|
---|
63 | *
|
---|
64 | * @param pCtx Pointer to the MD5 context.
|
---|
65 | * @param pvBuf Pointer to data.
|
---|
66 | * @param cbBuf Length of data (in bytes).
|
---|
67 | */
|
---|
68 | RTDECL(void) RTMd5Update(PRTMD5CONTEXT pCtx, const void *pvBuf, size_t cbBuf);
|
---|
69 |
|
---|
70 | /**
|
---|
71 | * Compute the MD5 hash of the data.
|
---|
72 | *
|
---|
73 | * @param pabDigest Where to store the hash.
|
---|
74 | * (What's passed is a pointer to the caller's buffer.)
|
---|
75 | * @param pCtx Pointer to the MD5 context.
|
---|
76 | */
|
---|
77 | RTDECL(void) RTMd5Final(uint8_t pabDigest[RTMD5HASHSIZE], PRTMD5CONTEXT pCtx);
|
---|
78 |
|
---|
79 | __END_DECLS
|
---|
80 |
|
---|
81 | /** @} */
|
---|
82 |
|
---|
83 | #endif /* !__iprt_md5_h__ */
|
---|