GME  13
apr_md5.h
Go to the documentation of this file.
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 /* Licensed to the Apache Software Foundation (ASF) under one or more
00032  * contributor license agreements.  See the NOTICE file distributed with
00033  * this work for additional information regarding copyright ownership.
00034  * The ASF licenses this file to You under the Apache License, Version 2.0
00035  * (the "License"); you may not use this file except in compliance with
00036  * the License.  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 
00071 typedef struct apr_md5_ctx_t apr_md5_ctx_t;
00072 
00074 struct apr_md5_ctx_t {
00076     apr_uint32_t state[4];
00078     apr_uint32_t count[2];
00080     unsigned char buffer[64];
00084     apr_xlate_t *xlate;
00085 };
00086 
00091 APU_DECLARE(apr_status_t) apr_md5_init(apr_md5_ctx_t *context);
00092 
00099 APU_DECLARE(apr_status_t) apr_md5_set_xlate(apr_md5_ctx_t *context,
00100                                             apr_xlate_t *xlate);
00101 
00109 APU_DECLARE(apr_status_t) apr_md5_update(apr_md5_ctx_t *context,
00110                                          const void *input,
00111                                          apr_size_t inputLen);
00112 
00119 APU_DECLARE(apr_status_t) apr_md5_final(unsigned char digest[APR_MD5_DIGESTSIZE],
00120                                         apr_md5_ctx_t *context);
00121 
00128 APU_DECLARE(apr_status_t) apr_md5(unsigned char digest[APR_MD5_DIGESTSIZE],
00129                                   const void *input,
00130                                   apr_size_t inputLen);
00131 
00139 APU_DECLARE(apr_status_t) apr_md5_encode(const char *password, const char *salt,
00140                                          char *result, apr_size_t nbytes);
00141 
00151 APU_DECLARE(apr_status_t) apr_bcrypt_encode(const char *pw,
00152                                             unsigned int count,
00153                                             const unsigned char *salt,
00154                                             apr_size_t salt_len,
00155                                             char *out, apr_size_t out_len);
00156 
00167 APU_DECLARE(apr_status_t) apr_password_validate(const char *passwd, 
00168                                                 const char *hash);
00169 
00170 
00172 #ifdef __cplusplus
00173 }
00174 #endif
00175 
00176 #endif /* !APR_MD5_H */