"Fossies" - the Fresh Open Source Software Archive

Member "xorriso-1.5.4/libjte/sha1.h" (30 Jan 2021, 1899 Bytes) of package /linux/misc/xorriso-1.5.4.pl02.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "sha1.h" see the Fossies "Dox" file reference documentation.

    1 /* sha1.c - SHA1 hash function
    2  * Copyright (C) 1998, 2001, 2002, 2003, 2008 Free Software Foundation, Inc.
    3  *
    4  * This file was part of Libgcrypt.
    5  *
    6  * Libgcrypt is free software; you can redistribute it and/or modify
    7  * it under the terms of the GNU Lesser General Public License as
    8  * published by the Free Software Foundation; either version 2.1 of
    9  * the License, or (at your option) any later version.
   10  *
   11  * Libgcrypt is distributed in the hope that it will be useful,
   12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   14  * GNU Lesser General Public License for more details.
   15  *
   16  * You should have received a copy of the GNU Lesser General Public
   17  * License along with this program; if not, see <http://www.gnu.org/licenses/>.
   18  */
   19 
   20 /* Borrowed and adapted slightly for use in JTE by Steve McIntyre
   21  * <steve@einval.com> October 2010 */
   22 
   23 /* Structure to save state of computation between the single steps.  */
   24 typedef struct 
   25 {
   26   uint32_t           h0,h1,h2,h3,h4;
   27   uint32_t           nblocks;
   28   unsigned char buf[64];
   29   int           count;
   30 } SHA1_CONTEXT;
   31 
   32 /* Initialize structure containing state of computation. */
   33 void sha1_init_ctx  (void *context);
   34 
   35 /* Starting with the result of former calls of this function (or the
   36    initialization function update the context for the next inlen bytes
   37    starting at inbuf_arg.
   38    It is NOT required that inlen is a multiple of 64.  */
   39 void sha1_write     (void *context, const void *inbuf_arg, size_t inlen);
   40 
   41 /* Process the remaining bytes in the buffer and finish the checksum
   42    calculation. */
   43 void sha1_finish_ctx(void *context);
   44 
   45 /* Read the checksum result - 20 bytes. The result is always in little
   46    endian byte order, so that a byte-wise output yields to the wanted
   47    ASCII representation of the message digest. */
   48 unsigned char *sha1_read(void *context);