Adjust fileList from perl
[msysgit.git] / include / apr-0 / apr_md5.h
blob83b6171a259480fa92fc5ebfc4569d7eb39340e3
1 /*
2 * This is work is derived from material Copyright RSA Data Security, Inc.
4 * The RSA copyright statement and Licence for that original material is
5 * included below. This is followed by the Apache copyright statement and
6 * licence for the modifications made to that material.
7 */
9 /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
10 rights reserved.
12 License to copy and use this software is granted provided that it
13 is identified as the "RSA Data Security, Inc. MD5 Message-Digest
14 Algorithm" in all material mentioning or referencing this software
15 or this function.
17 License is also granted to make and use derivative works provided
18 that such works are identified as "derived from the RSA Data
19 Security, Inc. MD5 Message-Digest Algorithm" in all material
20 mentioning or referencing the derived work.
22 RSA Data Security, Inc. makes no representations concerning either
23 the merchantability of this software or the suitability of this
24 software for any particular purpose. It is provided "as is"
25 without express or implied warranty of any kind.
27 These notices must be retained in any copies of any part of this
28 documentation and/or software.
31 /* Copyright 2000-2005 The Apache Software Foundation or its licensors, as
32 * applicable.
34 * Licensed under the Apache License, Version 2.0 (the "License");
35 * you may not use this file except in compliance with the License.
36 * You may obtain a copy of the License at
38 * http://www.apache.org/licenses/LICENSE-2.0
40 * Unless required by applicable law or agreed to in writing, software
41 * distributed under the License is distributed on an "AS IS" BASIS,
42 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
43 * See the License for the specific language governing permissions and
44 * limitations under the License.
47 #ifndef APR_MD5_H
48 #define APR_MD5_H
50 #include "apu.h"
51 #include "apr_xlate.h"
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 /**
57 * @file apr_md5.h
58 * @brief APR MD5 Routines
61 /**
62 * @defgroup APR_MD5 MD5 Routines
63 * @ingroup APR
64 * @{
67 /** The MD5 digest size */
68 #define APR_MD5_DIGESTSIZE 16
69 #define MD5_DIGESTSIZE APR_MD5_DIGESTSIZE /**< @deprecated */
71 /** @see apr_md5_ctx_t */
72 typedef struct apr_md5_ctx_t apr_md5_ctx_t;
74 /** MD5 context. */
75 struct apr_md5_ctx_t {
76 /** state (ABCD) */
77 apr_uint32_t state[4];
78 /** number of bits, modulo 2^64 (lsb first) */
79 apr_uint32_t count[2];
80 /** input buffer */
81 unsigned char buffer[64];
82 /** translation handle
83 * ignored if xlate is unsupported
85 apr_xlate_t *xlate;
88 /**
89 * MD5 Initialize. Begins an MD5 operation, writing a new context.
90 * @param context The MD5 context to initialize.
92 APU_DECLARE(apr_status_t) apr_md5_init(apr_md5_ctx_t *context);
94 /**
95 * MD5 translation setup. Provides the APR translation handle to be used
96 * for translating the content before calculating the digest.
97 * @param context The MD5 content to set the translation for.
98 * @param xlate The translation handle to use for this MD5 context
100 APU_DECLARE(apr_status_t) apr_md5_set_xlate(apr_md5_ctx_t *context,
101 apr_xlate_t *xlate);
104 * MD5 block update operation. Continue an MD5 message-digest operation,
105 * processing another message block, and updating the context.
106 * @param context The MD5 content to update.
107 * @param input next message block to update
108 * @param inputLen The length of the next message block
110 APU_DECLARE(apr_status_t) apr_md5_update(apr_md5_ctx_t *context,
111 const void *input,
112 apr_size_t inputLen);
115 * MD5 finalization. Ends an MD5 message-digest operation, writing the
116 * message digest and zeroing the context
117 * @param digest The final MD5 digest
118 * @param context The MD5 content we are finalizing.
120 APU_DECLARE(apr_status_t) apr_md5_final(unsigned char digest[APR_MD5_DIGESTSIZE],
121 apr_md5_ctx_t *context);
124 * MD5 in one step
125 * @param digest The final MD5 digest
126 * @param input The message block to use
127 * @param inputLen The length of the message block
129 APU_DECLARE(apr_status_t) apr_md5(unsigned char digest[APR_MD5_DIGESTSIZE],
130 const void *input,
131 apr_size_t inputLen);
134 * Encode a password using an MD5 algorithm
135 * @param password The password to encode
136 * @param salt The salt to use for the encoding
137 * @param result The string to store the encoded password in
138 * @param nbytes The length of the string
140 APU_DECLARE(apr_status_t) apr_md5_encode(const char *password, const char *salt,
141 char *result, apr_size_t nbytes);
145 * Validate any password encypted with any algorithm that APR understands
146 * @param passwd The password to validate
147 * @param hash The password to validate against
149 APU_DECLARE(apr_status_t) apr_password_validate(const char *passwd,
150 const char *hash);
153 /** @} */
154 #ifdef __cplusplus
156 #endif
158 #endif /* !APR_MD5_H */