|
||||
Warning, file /include/nettle/sha1.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* sha1.h 0002 0003 The sha1 hash function. 0004 0005 Copyright (C) 2001, 2012 Niels Möller 0006 0007 This file is part of GNU Nettle. 0008 0009 GNU Nettle is free software: you can redistribute it and/or 0010 modify it under the terms of either: 0011 0012 * the GNU Lesser General Public License as published by the Free 0013 Software Foundation; either version 3 of the License, or (at your 0014 option) any later version. 0015 0016 or 0017 0018 * the GNU General Public License as published by the Free 0019 Software Foundation; either version 2 of the License, or (at your 0020 option) any later version. 0021 0022 or both in parallel, as here. 0023 0024 GNU Nettle is distributed in the hope that it will be useful, 0025 but WITHOUT ANY WARRANTY; without even the implied warranty of 0026 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0027 General Public License for more details. 0028 0029 You should have received copies of the GNU General Public License and 0030 the GNU Lesser General Public License along with this program. If 0031 not, see http://www.gnu.org/licenses/. 0032 */ 0033 0034 #ifndef NETTLE_SHA1_H_INCLUDED 0035 #define NETTLE_SHA1_H_INCLUDED 0036 0037 #include "nettle-types.h" 0038 0039 #ifdef __cplusplus 0040 extern "C" { 0041 #endif 0042 0043 /* Name mangling */ 0044 #define sha1_init nettle_sha1_init 0045 #define sha1_update nettle_sha1_update 0046 #define sha1_digest nettle_sha1_digest 0047 #define sha1_compress nettle_sha1_compress 0048 0049 /* SHA1 */ 0050 0051 #define SHA1_DIGEST_SIZE 20 0052 #define SHA1_BLOCK_SIZE 64 0053 /* For backwards compatibility */ 0054 #define SHA1_DATA_SIZE SHA1_BLOCK_SIZE 0055 0056 /* Digest is kept internally as 5 32-bit words. */ 0057 #define _SHA1_DIGEST_LENGTH 5 0058 0059 struct sha1_ctx 0060 { 0061 uint32_t state[_SHA1_DIGEST_LENGTH]; /* State variables */ 0062 uint64_t count; /* 64-bit block count */ 0063 unsigned int index; /* index into buffer */ 0064 uint8_t block[SHA1_BLOCK_SIZE]; /* SHA1 data buffer */ 0065 }; 0066 0067 void 0068 sha1_init(struct sha1_ctx *ctx); 0069 0070 void 0071 sha1_update(struct sha1_ctx *ctx, 0072 size_t length, 0073 const uint8_t *data); 0074 0075 void 0076 sha1_digest(struct sha1_ctx *ctx, 0077 size_t length, 0078 uint8_t *digest); 0079 0080 /* SHA1 compression function. STATE points to 5 uint32_t words, 0081 and DATA points to 64 bytes of input data, possibly unaligned. */ 0082 void 0083 sha1_compress(uint32_t *state, const uint8_t *data); 0084 0085 /* Old name, for backwards compatibility. */ 0086 #define _nettle_sha1_compress nettle_sha1_compress 0087 0088 #ifdef __cplusplus 0089 } 0090 #endif 0091 0092 #endif /* NETTLE_SHA1_H_INCLUDED */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |