GME  13
apr_sha1.h
Go to the documentation of this file.
00001 /* Licensed to the Apache Software Foundation (ASF) under one or more
00002  * contributor license agreements.  See the NOTICE file distributed with
00003  * this work for additional information regarding copyright ownership.
00004  * The ASF licenses this file to You under the Apache License, Version 2.0
00005  * (the "License"); you may not use this file except in compliance with
00006  * the License.  You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 /* NIST Secure Hash Algorithm
00017  *      heavily modified by Uwe Hollerbach uh@alumni.caltech edu
00018  *      from Peter C. Gutmann's implementation as found in
00019  *      Applied Cryptography by Bruce Schneier
00020  *      This code is hereby placed in the public domain
00021  */
00022 
00023 #ifndef APR_SHA1_H
00024 #define APR_SHA1_H
00025 
00026 #include "apu.h"
00027 #include "apr_general.h"
00028 
00029 #ifdef __cplusplus
00030 extern "C" {
00031 #endif
00032 
00039 #define APR_SHA1_DIGESTSIZE 20
00040 
00045 #define APR_SHA1PW_ID "{SHA}"
00046 
00048 #define APR_SHA1PW_IDLEN 5
00049 
00051 typedef struct apr_sha1_ctx_t apr_sha1_ctx_t;
00052 
00056 struct apr_sha1_ctx_t {
00058     apr_uint32_t digest[5];
00060     apr_uint32_t count_lo, count_hi;
00062     apr_uint32_t data[16];
00064     int local;
00065 };
00066 
00082 APU_DECLARE(void) apr_sha1_base64(const char *clear, int len, char *out);
00083 
00088 APU_DECLARE(void) apr_sha1_init(apr_sha1_ctx_t *context);
00089 
00096 APU_DECLARE(void) apr_sha1_update(apr_sha1_ctx_t *context, const char *input,
00097                                 unsigned int inputLen);
00098 
00105 APU_DECLARE(void) apr_sha1_update_binary(apr_sha1_ctx_t *context,
00106                                        const unsigned char *input,
00107                                        unsigned int inputLen);
00108 
00114 APU_DECLARE(void) apr_sha1_final(unsigned char digest[APR_SHA1_DIGESTSIZE],
00115                                apr_sha1_ctx_t *context);
00116 
00117 #ifdef __cplusplus
00118 }
00119 #endif
00120 
00121 #endif  /* APR_SHA1_H */