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-2004 The Apache Software Foundation 00032 * 00033 * Licensed under the Apache License, Version 2.0 (the "License"); 00034 * you may not use this file except in compliance with the License. 00035 * You may obtain a copy of the License at 00036 * 00037 * http://www.apache.org/licenses/LICENSE-2.0 00038 * 00039 * Unless required by applicable law or agreed to in writing, software 00040 * distributed under the License is distributed on an "AS IS" BASIS, 00041 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00042 * See the License for the specific language governing permissions and 00043 * limitations under the License. 00044 */ 00045 00046 #ifndef APR_MD5_H 00047 #define APR_MD5_H 00048 00049 #include "apu.h" 00050 #include "apr_xlate.h" 00051 00052 #ifdef __cplusplus 00053 extern "C" { 00054 #endif 00055 00067 #define APR_MD5_DIGESTSIZE 16 00068 00070 typedef struct apr_md5_ctx_t apr_md5_ctx_t; 00071 00073 struct apr_md5_ctx_t { 00075 apr_uint32_t state[4]; 00077 apr_uint32_t count[2]; 00079 unsigned char buffer[64]; 00083 apr_xlate_t *xlate; 00084 }; 00085 00090 APU_DECLARE(apr_status_t) apr_md5_init(apr_md5_ctx_t *context); 00091 00098 APU_DECLARE(apr_status_t) apr_md5_set_xlate(apr_md5_ctx_t *context, 00099 apr_xlate_t *xlate); 00100 00108 APU_DECLARE(apr_status_t) apr_md5_update(apr_md5_ctx_t *context, 00109 const void *input, 00110 apr_size_t inputLen); 00111 00118 APU_DECLARE(apr_status_t) apr_md5_final(unsigned char digest[APR_MD5_DIGESTSIZE], 00119 apr_md5_ctx_t *context); 00120 00127 APU_DECLARE(apr_status_t) apr_md5(unsigned char digest[APR_MD5_DIGESTSIZE], 00128 const void *input, 00129 apr_size_t inputLen); 00130 00138 APU_DECLARE(apr_status_t) apr_md5_encode(const char *password, const char *salt, 00139 char *result, apr_size_t nbytes); 00140 00141 00152 APU_DECLARE(apr_status_t) apr_password_validate(const char *passwd, 00153 const char *hash); 00154 00155 00157 #ifdef __cplusplus 00158 } 00159 #endif 00160 00161 #endif /* !APR_MD5_H */