/ [pam-modules] / trunk / pam_sql / sha1.h
To checkout: svn checkout http://svn.gnu.org.ua/sources/pam-modules/trunk/pam_sql/sha1.h
Puszcza

Contents of /trunk/pam_sql/sha1.h

Parent Directory Parent Directory | Revision Log Revision Log


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

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

Send suggestions and bug reports to Sergey Poznyakoff
ViewVC Help
Powered by ViewVC 1.1.20