"Fossies" - the Fresh Open Source Software Archive
Member "xorriso-1.5.4/libjte/sha256.h" (30 Jan 2021, 2325 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
Alternatively you can here view
the uninterpreted source code file.
For more information about "sha256.h" see the Fossies "Dox" file reference
1 /* Declaration of functions and data types used for SHA256 sum computing
2 library functions.
3 Copyright (C) 2007 Free Software Foundation, Inc.
5 Copied here from the GNU C Library version 2.7 on the 10 May 2009
6 by Steve McIntyre <firstname.lastname@example.org>. This code was under GPL v2.1
7 in glibc, and that license gives us the option to use and
8 distribute the code under the terms of the GPL v2 instead. I'm
9 taking that option.
11 This program is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2, or (at your option) any
14 later version.
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
25 #ifndef _SHA256_H
26 #define _SHA256_H 1
28 #include <limits.h>
30 #ifdef HAVE_STDINT_H
31 #include <stdint.h>
33 #ifdef HAVE_INTTYPES_H
34 #include <inttypes.h>
38 #include <stdio.h>
41 /* Structure to save state of computation between the single steps. */
42 struct sha256_ctx
44 uint32_t H;
46 uint32_t total;
47 uint32_t buflen;
48 char buffer __attribute__ ((__aligned__ (__alignof__ (uint32_t))));
51 /* Initialize structure containing state of computation.
52 (FIPS 180-2: 5.3.2) */
53 extern void sha256_init_ctx (struct sha256_ctx *ctx);
55 /* Starting with the result of former calls of this function (or the
56 initialization function update the context for the next LEN bytes
57 starting at BUFFER.
58 It is NOT required that LEN is a multiple of 64. */
59 extern void sha256_process_bytes (const void *buffer, size_t len,
60 struct sha256_ctx *ctx);
62 /* Process the remaining bytes in the buffer and put result from CTX
63 in first 32 bytes following RESBUF.
65 IMPORTANT: On some systems it is required that RESBUF is correctly
66 aligned for a 32 bits value. */
67 extern void *sha256_finish_ctx (struct sha256_ctx *ctx, void *resbuf);
69 #endif /* sha256.h */