Annotation of win32/apache22/srclib/apr-util/include/apr_md5.h, revision 1.1

1.1     ! moko        1: /*
        !             2:  * This is work is derived from material Copyright RSA Data Security, Inc.
        !             3:  *
        !             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:  */
        !             8: 
        !             9: /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
        !            10:    rights reserved.
        !            11: 
        !            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.
        !            16: 
        !            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.
        !            21: 
        !            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.
        !            26: 
        !            27:    These notices must be retained in any copies of any part of this
        !            28:    documentation and/or software.
        !            29:  */
        !            30: 
        !            31: /* Licensed to the Apache Software Foundation (ASF) under one or more
        !            32:  * contributor license agreements.  See the NOTICE file distributed with
        !            33:  * this work for additional information regarding copyright ownership.
        !            34:  * The ASF licenses this file to You under the Apache License, Version 2.0
        !            35:  * (the "License"); you may not use this file except in compliance with
        !            36:  * the License.  You may obtain a copy of the License at
        !            37:  *
        !            38:  *     http://www.apache.org/licenses/LICENSE-2.0
        !            39:  *
        !            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.
        !            45:  */
        !            46: 
        !            47: #ifndef APR_MD5_H
        !            48: #define APR_MD5_H
        !            49: 
        !            50: #include "apu.h"
        !            51: #include "apr_xlate.h"
        !            52: 
        !            53: #ifdef __cplusplus
        !            54: extern "C" {
        !            55: #endif
        !            56: /**
        !            57:  * @file apr_md5.h
        !            58:  * @brief APR MD5 Routines
        !            59:  */
        !            60: 
        !            61: /**
        !            62:  * @defgroup APR_MD5 MD5 Routines
        !            63:  * @ingroup APR
        !            64:  * @{
        !            65:  */
        !            66: 
        !            67: /** The MD5 digest size */
        !            68: #define APR_MD5_DIGESTSIZE 16
        !            69: 
        !            70: /** @see apr_md5_ctx_t */
        !            71: typedef struct apr_md5_ctx_t apr_md5_ctx_t;
        !            72: 
        !            73: /** MD5 context. */
        !            74: struct apr_md5_ctx_t {
        !            75:     /** state (ABCD) */
        !            76:     apr_uint32_t state[4];
        !            77:     /** number of bits, modulo 2^64 (lsb first) */
        !            78:     apr_uint32_t count[2];
        !            79:     /** input buffer */
        !            80:     unsigned char buffer[64];
        !            81:     /** translation handle 
        !            82:      *  ignored if xlate is unsupported
        !            83:      */
        !            84:     apr_xlate_t *xlate;
        !            85: };
        !            86: 
        !            87: /**
        !            88:  * MD5 Initialize.  Begins an MD5 operation, writing a new context.
        !            89:  * @param context The MD5 context to initialize.
        !            90:  */
        !            91: APU_DECLARE(apr_status_t) apr_md5_init(apr_md5_ctx_t *context);
        !            92: 
        !            93: /**
        !            94:  * MD5 translation setup.  Provides the APR translation handle to be used 
        !            95:  * for translating the content before calculating the digest.
        !            96:  * @param context The MD5 content to set the translation for.
        !            97:  * @param xlate The translation handle to use for this MD5 context 
        !            98:  */
        !            99: APU_DECLARE(apr_status_t) apr_md5_set_xlate(apr_md5_ctx_t *context,
        !           100:                                             apr_xlate_t *xlate);
        !           101: 
        !           102: /**
        !           103:  * MD5 block update operation.  Continue an MD5 message-digest operation, 
        !           104:  * processing another message block, and updating the context.
        !           105:  * @param context The MD5 content to update.
        !           106:  * @param input next message block to update
        !           107:  * @param inputLen The length of the next message block
        !           108:  */
        !           109: APU_DECLARE(apr_status_t) apr_md5_update(apr_md5_ctx_t *context,
        !           110:                                          const void *input,
        !           111:                                          apr_size_t inputLen);
        !           112: 
        !           113: /**
        !           114:  * MD5 finalization.  Ends an MD5 message-digest operation, writing the 
        !           115:  * message digest and zeroing the context
        !           116:  * @param digest The final MD5 digest
        !           117:  * @param context The MD5 content we are finalizing.
        !           118:  */
        !           119: APU_DECLARE(apr_status_t) apr_md5_final(unsigned char digest[APR_MD5_DIGESTSIZE],
        !           120:                                         apr_md5_ctx_t *context);
        !           121: 
        !           122: /**
        !           123:  * MD5 in one step
        !           124:  * @param digest The final MD5 digest
        !           125:  * @param input The message block to use
        !           126:  * @param inputLen The length of the message block
        !           127:  */
        !           128: APU_DECLARE(apr_status_t) apr_md5(unsigned char digest[APR_MD5_DIGESTSIZE],
        !           129:                                   const void *input,
        !           130:                                   apr_size_t inputLen);
        !           131: 
        !           132: /**
        !           133:  * Encode a password using an MD5 algorithm
        !           134:  * @param password The password to encode
        !           135:  * @param salt The salt string to use for the encoding
        !           136:  * @param result The string to store the encoded password in
        !           137:  * @param nbytes The size of the result buffer
        !           138:  */
        !           139: APU_DECLARE(apr_status_t) apr_md5_encode(const char *password, const char *salt,
        !           140:                                          char *result, apr_size_t nbytes);
        !           141: 
        !           142: /**
        !           143:  * Encode a password using the bcrypt algorithm
        !           144:  * @param password The password to encode
        !           145:  * @param count The cost of the encoding, possible values are 4 to 31
        !           146:  * @param salt Pointer to binary data to be used as salt for the encoding
        !           147:  * @param salt_len The size of the salt data (must be >= 16)
        !           148:  * @param out The string to store the encoded password in
        !           149:  * @param out_len The size of the result buffer (must be >= 61)
        !           150:  */
        !           151: APU_DECLARE(apr_status_t) apr_bcrypt_encode(const char *pw,
        !           152:                                             unsigned int count,
        !           153:                                             const unsigned char *salt,
        !           154:                                             apr_size_t salt_len,
        !           155:                                             char *out, apr_size_t out_len);
        !           156: 
        !           157: /**
        !           158:  * Validate hashes created by APR-supported algorithms: md5, bcrypt, and sha1.
        !           159:  * hashes created by crypt are supported only on platforms that provide
        !           160:  * crypt(3), so don't rely on that function unless you know that your
        !           161:  * application will be run only on platforms that support it.  On platforms
        !           162:  * that don't support crypt(3), this falls back to a clear text string
        !           163:  * comparison.
        !           164:  * @param passwd The password to validate
        !           165:  * @param hash The password to validate against
        !           166:  */
        !           167: APU_DECLARE(apr_status_t) apr_password_validate(const char *passwd, 
        !           168:                                                 const char *hash);
        !           169: 
        !           170: 
        !           171: /** @} */
        !           172: #ifdef __cplusplus
        !           173: }
        !           174: #endif
        !           175: 
        !           176: #endif /* !APR_MD5_H */

E-mail: