]> git.cryptolib.org Git - avr-crypto-lib.git/blob - hfal/hfal_skein256.c
fixing E-Mail-Address & Copyright
[avr-crypto-lib.git] / hfal / hfal_skein256.c
1 /* hfal_skein256.c */
2 /*
3     This file is part of the AVR-Crypto-Lib.
4     Copyright (C) 2006-2015 Daniel Otte (bg@nerilex.org)
5
6     This program is free software: you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation, either version 3 of the License, or
9     (at your option) any later version.
10
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.
15
16     You should have received a copy of the GNU General Public License
17     along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 */
19 /**
20  * \file     hfal_skein256.c
21  * \email    bg@nerilex.org
22  * \author   Daniel Otte 
23  * \date     2009-03-13
24  * \license  GPLv3 or later
25  * 
26  */
27
28 #include <avr/pgmspace.h>
29 #include <stdlib.h>
30 #include "hashfunction_descriptor.h"
31 #include "skein.h"
32
33
34 static const char skein256_128_str[]   PROGMEM = "Skein-256-128";
35 static const char skein256_160_str[]   PROGMEM = "Skein-256-160";
36 static const char skein256_224_str[]   PROGMEM = "Skein-256-224";
37 static const char skein256_256_str[]   PROGMEM = "Skein-256-256";
38 static const char skein256_384_str[]   PROGMEM = "Skein-256-384";
39 static const char skein256_512_str[]   PROGMEM = "Skein-256-512";
40
41 void skein256_128_init(skein256_ctx_t *ctx){
42         skein256_init(ctx, 128);
43 }
44 void skein256_160_init(skein256_ctx_t *ctx){
45         skein256_init(ctx, 160);
46 }
47 void skein256_224_init(skein256_ctx_t *ctx){
48         skein256_init(ctx, 224);
49 }
50 void skein256_256_init(skein256_ctx_t *ctx){
51         skein256_init(ctx, 256);
52 }
53 void skein256_384_init(skein256_ctx_t *ctx){
54         skein256_init(ctx, 384);
55 }
56 void skein256_512_init(skein256_ctx_t *ctx){
57         skein256_init(ctx, 512);
58 }
59
60 const hfdesc_t skein256_128_desc PROGMEM = {
61         HFDESC_TYPE_HASHFUNCTION,
62         0,
63         skein256_128_str,
64         sizeof(skein256_ctx_t),
65         SKEIN256_BLOCKSIZE,
66         128,
67         (hf_init_fpt)skein256_128_init,
68         (hf_nextBlock_fpt)skein256_nextBlock,
69         (hf_lastBlock_fpt)skein256_lastBlock,
70         (hf_ctx2hash_fpt)skein256_ctx2hash,
71         (hf_free_fpt)NULL,
72         (hf_mem_fpt)NULL
73 };
74 const hfdesc_t skein256_160_desc PROGMEM = {
75         HFDESC_TYPE_HASHFUNCTION,
76         0,
77         skein256_160_str,
78         sizeof(skein256_ctx_t),
79         SKEIN256_BLOCKSIZE,
80         160,
81         (hf_init_fpt)skein256_160_init,
82         (hf_nextBlock_fpt)skein256_nextBlock,
83         (hf_lastBlock_fpt)skein256_lastBlock,
84         (hf_ctx2hash_fpt)skein256_ctx2hash,
85         (hf_free_fpt)NULL,
86         (hf_mem_fpt)NULL
87 };
88 const hfdesc_t skein256_224_desc PROGMEM = {
89         HFDESC_TYPE_HASHFUNCTION,
90         0,
91         skein256_224_str,
92         sizeof(skein256_ctx_t),
93         SKEIN256_BLOCKSIZE,
94         224,
95         (hf_init_fpt)skein256_224_init,
96         (hf_nextBlock_fpt)skein256_nextBlock,
97         (hf_lastBlock_fpt)skein256_lastBlock,
98         (hf_ctx2hash_fpt)skein256_ctx2hash,
99         (hf_free_fpt)NULL,
100         (hf_mem_fpt)NULL
101 };
102 const hfdesc_t skein256_256_desc PROGMEM = {
103         HFDESC_TYPE_HASHFUNCTION,
104         0,
105         skein256_256_str,
106         sizeof(skein256_ctx_t),
107         SKEIN256_BLOCKSIZE,
108         256,
109         (hf_init_fpt)skein256_256_init,
110         (hf_nextBlock_fpt)skein256_nextBlock,
111         (hf_lastBlock_fpt)skein256_lastBlock,
112         (hf_ctx2hash_fpt)skein256_ctx2hash,
113         (hf_free_fpt)NULL,
114         (hf_mem_fpt)NULL
115 };
116 const hfdesc_t skein256_384_desc PROGMEM = {
117         HFDESC_TYPE_HASHFUNCTION,
118         0,
119         skein256_384_str,
120         sizeof(skein256_ctx_t),
121         SKEIN256_BLOCKSIZE,
122         384,
123         (hf_init_fpt)skein256_384_init,
124         (hf_nextBlock_fpt)skein256_nextBlock,
125         (hf_lastBlock_fpt)skein256_lastBlock,
126         (hf_ctx2hash_fpt)skein256_ctx2hash,
127         (hf_free_fpt)NULL,
128         (hf_mem_fpt)NULL
129 };
130 const hfdesc_t skein256_512_desc PROGMEM = {
131         HFDESC_TYPE_HASHFUNCTION,
132         0,
133         skein256_512_str,
134         sizeof(skein256_ctx_t),
135         SKEIN256_BLOCKSIZE,
136         512,
137         (hf_init_fpt)skein256_512_init,
138         (hf_nextBlock_fpt)skein256_nextBlock,
139         (hf_lastBlock_fpt)skein256_lastBlock,
140         (hf_ctx2hash_fpt)skein256_ctx2hash,
141         (hf_free_fpt)NULL,
142         (hf_mem_fpt)NULL
143 };