1/* -*- buffer-read-only: t -*- vi: set ro: */ 2/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ 3#line 1 4/* Declarations of functions and data types used for SHA1 sum 5 library functions. 6 Copyright (C) 2000, 2001, 2003, 2005, 2006, 2008, 2009, 2010 Free Software 7 Foundation, Inc. 8 9 This program is free software; you can redistribute it and/or modify it 10 under the terms of the GNU General Public License as published by the 11 Free Software Foundation; either version 3, or (at your option) any 12 later version. 13 14 This program is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with this program; if not, write to the Free Software Foundation, 21 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ 22 23#ifndef SHA1_H 24# define SHA1_H 1 25 26# include <stdio.h> 27# include <stdint.h> 28 29# ifdef __cplusplus 30extern "C" { 31# endif 32 33#define SHA1_DIGEST_SIZE 20 34 35/* Structure to save state of computation between the single steps. */ 36struct sha1_ctx 37{ 38 uint32_t A; 39 uint32_t B; 40 uint32_t C; 41 uint32_t D; 42 uint32_t E; 43 44 uint32_t total[2]; 45 uint32_t buflen; 46 uint32_t buffer[32]; 47}; 48 49 50/* Initialize structure containing state of computation. */ 51extern void sha1_init_ctx (struct sha1_ctx *ctx); 52 53/* Starting with the result of former calls of this function (or the 54 initialization function update the context for the next LEN bytes 55 starting at BUFFER. 56 It is necessary that LEN is a multiple of 64!!! */ 57extern void sha1_process_block (const void *buffer, size_t len, 58 struct sha1_ctx *ctx); 59 60/* Starting with the result of former calls of this function (or the 61 initialization function update the context for the next LEN bytes 62 starting at BUFFER. 63 It is NOT required that LEN is a multiple of 64. */ 64extern void sha1_process_bytes (const void *buffer, size_t len, 65 struct sha1_ctx *ctx); 66 67/* Process the remaining bytes in the buffer and put result from CTX 68 in first 20 bytes following RESBUF. The result is always in little 69 endian byte order, so that a byte-wise output yields to the wanted 70 ASCII representation of the message digest. */ 71extern void *sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf); 72 73 74/* Put result from CTX in first 20 bytes following RESBUF. The result is 75 always in little endian byte order, so that a byte-wise output yields 76 to the wanted ASCII representation of the message digest. */ 77extern void *sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf); 78 79 80/* Compute SHA1 message digest for bytes read from STREAM. The 81 resulting message digest number will be written into the 20 bytes 82 beginning at RESBLOCK. */ 83extern int sha1_stream (FILE *stream, void *resblock); 84 85/* Compute SHA1 message digest for LEN bytes beginning at BUFFER. The 86 result is always in little endian byte order, so that a byte-wise 87 output yields to the wanted ASCII representation of the message 88 digest. */ 89extern void *sha1_buffer (const char *buffer, size_t len, void *resblock); 90 91# ifdef __cplusplus 92} 93# endif 94 95#endif 96