00001 /* 00002 * This is work is derived from material Copyright RSA Data Security, Inc. 00003 * 00004 * The RSA copyright statement and Licence for that original material is 00005 * included below. This is followed by the Apache copyright statement and 00006 * licence for the modifications made to that material. 00007 */ 00008 00009 /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All 00010 rights reserved. 00011 00012 License to copy and use this software is granted provided that it 00013 is identified as the "RSA Data Security, Inc. MD5 Message-Digest 00014 Algorithm" in all material mentioning or referencing this software 00015 or this function. 00016 00017 License is also granted to make and use derivative works provided 00018 that such works are identified as "derived from the RSA Data 00019 Security, Inc. MD5 Message-Digest Algorithm" in all material 00020 mentioning or referencing the derived work. 00021 00022 RSA Data Security, Inc. makes no representations concerning either 00023 the merchantability of this software or the suitability of this 00024 software for any particular purpose. It is provided "as is" 00025 without express or implied warranty of any kind. 00026 00027 These notices must be retained in any copies of any part of this 00028 documentation and/or software. 00029 */ 00030 00031 /* Copyright 2000-2005 The Apache Software Foundation or its licensors, as 00032 * applicable. 00033 * 00034 * Licensed under the Apache License, Version 2.0 (the "License"); 00035 * you may not use this file except in compliance with the License. 00036 * You may obtain a copy of the License at 00037 * 00038 * http://www.apache.org/licenses/LICENSE-2.0 00039 * 00040 * Unless required by applicable law or agreed to in writing, software 00041 * distributed under the License is distributed on an "AS IS" BASIS, 00042 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00043 * See the License for the specific language governing permissions and 00044 * limitations under the License. 00045 */ 00046 00047 #ifndef APR_MD5_H 00048 #define APR_MD5_H 00049 00050 #include "apu.h" 00051 #include "apr_xlate.h" 00052 00053 #ifdef __cplusplus 00054 extern "C" { 00055 #endif 00056 00068 #define APR_MD5_DIGESTSIZE 16 00069 #define MD5_DIGESTSIZE APR_MD5_DIGESTSIZE 00072 typedef struct apr_md5_ctx_t apr_md5_ctx_t; 00073 00075 struct apr_md5_ctx_t { 00077 apr_uint32_t state[4]; 00079 apr_uint32_t count[2]; 00081 unsigned char buffer[64]; 00085 apr_xlate_t *xlate; 00086 }; 00087 00092 APU_DECLARE(apr_status_t) apr_md5_init(apr_md5_ctx_t *context); 00093 00100 APU_DECLARE(apr_status_t) apr_md5_set_xlate(apr_md5_ctx_t *context, 00101 apr_xlate_t *xlate); 00102 00110 APU_DECLARE(apr_status_t) apr_md5_update(apr_md5_ctx_t *context, 00111 const void *input, 00112 apr_size_t inputLen); 00113 00120 APU_DECLARE(apr_status_t) apr_md5_final(unsigned char digest[APR_MD5_DIGESTSIZE], 00121 apr_md5_ctx_t *context); 00122 00129 APU_DECLARE(apr_status_t) apr_md5(unsigned char digest[APR_MD5_DIGESTSIZE], 00130 const void *input, 00131 apr_size_t inputLen); 00132 00140 APU_DECLARE(apr_status_t) apr_md5_encode(const char *password, const char *salt, 00141 char *result, apr_size_t nbytes); 00142 00143 00149 APU_DECLARE(apr_status_t) apr_password_validate(const char *passwd, 00150 const char *hash); 00151 00152 00154 #ifdef __cplusplus 00155 } 00156 #endif 00157 00158 #endif /* !APR_MD5_H */