Apache Portable Runtime Utility Library
|
00001 /* 00002 * Adopted for apr-util by Tollef Fog Heen <tfheen@err.no> 00003 */ 00004 00005 /* 00006 * This is an OpenSSL-compatible implementation of the RSA Data Security, 00007 * Inc. MD5 Message-Digest Algorithm. 00008 * 00009 * Written by Solar Designer <solar@openwall.com> in 2001, and placed in 00010 * the public domain. See md5.c for more information. 00011 */ 00012 00013 /* Copyright 2000-2005 The Apache Software Foundation or its licensors, as 00014 * applicable. 00015 * 00016 * Licensed under the Apache License, Version 2.0 (the "License"); 00017 * you may not use this file except in compliance with the License. 00018 * You may obtain a copy of the License at 00019 * 00020 * http://www.apache.org/licenses/LICENSE-2.0 00021 * 00022 * Unless required by applicable law or agreed to in writing, software 00023 * distributed under the License is distributed on an "AS IS" BASIS, 00024 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00025 * See the License for the specific language governing permissions and 00026 * limitations under the License. 00027 */ 00028 00029 #ifndef APR_MD5_H 00030 #define APR_MD5_H 00031 00032 #include "apu.h" 00033 #include "apr_xlate.h" 00034 00035 #ifdef __cplusplus 00036 extern "C" { 00037 #endif 00038 00050 #define APR_MD5_DIGESTSIZE 16 00051 00053 typedef struct apr_md5_ctx_t apr_md5_ctx_t; 00054 00056 struct apr_md5_ctx_t { 00058 apr_uint32_t state[4]; 00060 apr_uint32_t count[2]; 00062 unsigned char buffer[64]; 00066 apr_xlate_t *xlate; 00067 }; 00068 00073 APU_DECLARE(apr_status_t) apr_md5_init(apr_md5_ctx_t *context); 00074 00081 APU_DECLARE(apr_status_t) apr_md5_set_xlate(apr_md5_ctx_t *context, 00082 apr_xlate_t *xlate); 00083 00091 APU_DECLARE(apr_status_t) apr_md5_update(apr_md5_ctx_t *context, 00092 const void *input, 00093 apr_size_t inputLen); 00094 00101 APU_DECLARE(apr_status_t) apr_md5_final(unsigned char digest[APR_MD5_DIGESTSIZE], 00102 apr_md5_ctx_t *context); 00103 00110 APU_DECLARE(apr_status_t) apr_md5(unsigned char digest[APR_MD5_DIGESTSIZE], 00111 const void *input, 00112 apr_size_t inputLen); 00113 00121 APU_DECLARE(apr_status_t) apr_md5_encode(const char *password, const char *salt, 00122 char *result, apr_size_t nbytes); 00123 00124 00135 APU_DECLARE(apr_status_t) apr_password_validate(const char *passwd, 00136 const char *hash); 00137 00138 00140 #ifdef __cplusplus 00141 } 00142 #endif 00143 00144 #endif /* !APR_MD5_H */