1 /* Declarations of functions and data types used for SHA1 sum
3 Copyright (C) 2007 Free Software Foundation, Inc.
5 This file is part of the GNU Binutils.
7 This program is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3, or (at your option) any
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software Foundation,
19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
25 #include "bfd_stdint.h"
27 /* Structure to save state of computation between the single steps. */
42 /* Initialize structure containing state of computation. */
43 extern void sha1_init_ctx (struct sha1_ctx
*ctx
);
45 /* Starting with the result of former calls of this function (or the
46 initialization function update the context for the next LEN bytes
48 It is necessary that LEN is a multiple of 64! */
49 extern void sha1_process_block (const void *buffer
, size_t len
,
50 struct sha1_ctx
*ctx
);
52 /* Starting with the result of former calls of this function (or the
53 initialization function update the context for the next LEN bytes
55 It is NOT required that LEN is a multiple of 64. */
56 extern void sha1_process_bytes (const void *buffer
, size_t len
,
57 struct sha1_ctx
*ctx
);
59 /* Process the remaining bytes in the buffer and put result from CTX
60 in first 20 bytes following RESBUF. The result is always in little
61 endian byte order, so that a byte-wise output yields to the wanted
62 ASCII representation of the message digest.
64 IMPORTANT: On some systems it is required that RESBUF be correctly
65 aligned for a 32 bits value. */
66 extern void *sha1_finish_ctx (struct sha1_ctx
*ctx
, void *resbuf
);
68 /* Put result from CTX in first 20 bytes following RESBUF. The result is
69 always in little endian byte order, so that a byte-wise output yields
70 to the wanted ASCII representation of the message digest.
72 IMPORTANT: On some systems it is required that RESBUF is correctly
73 aligned for a 32 bits value. */
74 extern void *sha1_read_ctx (const struct sha1_ctx
*ctx
, void *resbuf
);
76 /* Compute SHA1 message digest for bytes read from STREAM. The
77 resulting message digest number will be written into the 20 bytes
78 beginning at RESBLOCK. */
79 extern int sha1_stream (FILE *stream
, void *resblock
);
81 /* Compute SHA1 message digest for LEN bytes beginning at BUFFER. The
82 result is always in little endian byte order, so that a byte-wise
83 output yields to the wanted ASCII representation of the message
85 extern void *sha1_buffer (const char *buffer
, size_t len
, void *resblock
);
This page took 0.031144 seconds and 4 git commands to generate.