Use DBOP to check for left button on C200v2 like we are supposed to instead of right...
[kugel-rb.git] / tools / hmac-sha1.h
blob5652690686e77743a291430735573671da53f00a
1 /* Taken from gnulib (http://savannah.gnu.org/projects/gnulib/) */
2 /* Declarations of functions and data types used for SHA1 sum
3 library functions.
4 Copyright (C) 2000, 2001, 2003, 2005, 2006 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
9 later version.
11 This program 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 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software Foundation,
18 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
20 #ifndef SHA1_H
21 #define SHA1_H 1
23 #include <stdio.h>
24 #include <stdint.h>
26 /* Structure to save state of computation between the single steps. */
27 struct sha1_ctx
29 uint32_t A;
30 uint32_t B;
31 uint32_t C;
32 uint32_t D;
33 uint32_t E;
35 uint32_t total[2];
36 uint32_t buflen;
37 uint32_t buffer[32];
41 /* Initialize structure containing state of computation. */
42 extern void sha1_init_ctx (struct sha1_ctx *ctx);
44 /* Starting with the result of former calls of this function (or the
45 initialization function update the context for the next LEN bytes
46 starting at BUFFER.
47 It is necessary that LEN is a multiple of 64!!! */
48 extern void sha1_process_block (const void *buffer, size_t len,
49 struct sha1_ctx *ctx);
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 NOT required that LEN is a multiple of 64. */
55 extern void sha1_process_bytes (const void *buffer, size_t len,
56 struct sha1_ctx *ctx);
58 /* Process the remaining bytes in the buffer and put result from CTX
59 in first 20 bytes following RESBUF. The result is always in little
60 endian byte order, so that a byte-wise output yields to the wanted
61 ASCII representation of the message digest.
63 IMPORTANT: On some systems it is required that RESBUF be correctly
64 aligned for a 32 bits value. */
65 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);
77 /* Compute SHA1 message digest for bytes read from STREAM. The
78 resulting message digest number will be written into the 20 bytes
79 beginning at RESBLOCK. */
80 extern int sha1_stream (FILE *stream, void *resblock);
82 /* Compute SHA1 message digest for LEN bytes beginning at BUFFER. The
83 result is always in little endian byte order, so that a byte-wise
84 output yields to the wanted ASCII representation of the message
85 digest. */
86 extern void *sha1_buffer (const char *buffer, size_t len, void *resblock);
88 #endif
91 /* hmac.h -- hashed message authentication codes
92 Copyright (C) 2005 Free Software Foundation, Inc.
94 This program is free software; you can redistribute it and/or modify
95 it under the terms of the GNU General Public License as published by
96 the Free Software Foundation; either version 2, or (at your option)
97 any later version.
99 This program is distributed in the hope that it will be useful,
100 but WITHOUT ANY WARRANTY; without even the implied warranty of
101 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
102 GNU General Public License for more details.
104 You should have received a copy of the GNU General Public License
105 along with this program; if not, write to the Free Software Foundation,
106 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
108 /* Written by Simon Josefsson. */
110 #ifndef HMAC_H
111 #define HMAC_H 1
113 #include <stddef.h>
115 /* Compute Hashed Message Authentication Code with SHA-1, over BUFFER
116 data of BUFLEN bytes using the KEY of KEYLEN bytes, writing the
117 output to pre-allocated 20 byte minimum RESBUF buffer. Return 0 on
118 success. */
120 hmac_sha1 (const void *key, size_t keylen,
121 const void *in, size_t inlen, void *resbuf);
123 #endif /* HMAC_H */