/* A5_1.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/*
* File: A5_1.c
* Author: Daniel Otte
* ! Warning, this is weak crypto !
*
*/
-
+
#include <stdint.h>
#include <string.h>
#include "A5_1.h"
uint8_t a5_1_clock_core(a5_1_ctx_t *c, uint8_t clockoverride);
-
/*
* length is length of key in bits!
*/
-void a5_1_init(a5_1_ctx_t *c, void *key, uint8_t keylength_b, void *iv, uint8_t ivlength_b){
- uint8_t i,t;
- memset(c->r1, 0, 3);
- memset(c->r2, 0, 3);
- memset(c->r3, 0, 3);
- for(i=0; i<keylength_b; ++i){
- t=((uint8_t*)key)[i/8];
- t=1&(t>>i);
- c->r1[0] ^= t;
- c->r2[0] ^= t;
- c->r3[0] ^= t;
- a5_1_clock_core(c, 0x7);
- }
- for(i=0; i<ivlength_b; ++i){
- t=((uint8_t*)iv)[i/8];
- t=1&(t>>i);
- c->r1[0] ^= t;
- c->r2[0] ^= t;
- c->r3[0] ^= t;
- a5_1_clock_core(c, 0x7);
- }
- for(i=0; i<100; ++i)
- a5_1_clock_core(c,0);
+void a5_1_init(a5_1_ctx_t *c, void *key, uint8_t keylength_b, void *iv,
+ uint8_t ivlength_b)
+{
+ uint8_t i, t;
+ memset(c->r1, 0, 3);
+ memset(c->r2, 0, 3);
+ memset(c->r3, 0, 3);
+ for (i = 0; i < keylength_b; ++i) {
+ t = ((uint8_t*) key)[i / 8];
+ t = 1 & (t >> i);
+ c->r1[0] ^= t;
+ c->r2[0] ^= t;
+ c->r3[0] ^= t;
+ a5_1_clock_core(c, 0x7);
+ }
+ for (i = 0; i < ivlength_b; ++i) {
+ t = ((uint8_t*) iv)[i / 8];
+ t = 1 & (t >> i);
+ c->r1[0] ^= t;
+ c->r2[0] ^= t;
+ c->r3[0] ^= t;
+ a5_1_clock_core(c, 0x7);
+ }
+ for (i = 0; i < 100; ++i)
+ a5_1_clock_core(c, 0);
}
static
-void shiftreg(uint8_t *d){
- uint8_t c, c2;
- c=d[0]>>7;
- d[0] <<= 1;
- c2=d[1]>>7;
- d[1] = (d[1]<<1) | c;
- d[2] = (d[2]<<1) | c2;
-}
-
-const uint8_t parity3_lut[] PROGMEM = {0, 1, 1, 0,
- 1, 0, 0, 1};
-const uint8_t clock_lut[] PROGMEM = {0x7, 0x6, 0x5, 0x3,
- 0x3, 0x5, 0x6, 0x7};
-
-uint8_t a5_1_clock_core(a5_1_ctx_t *c, uint8_t clockoverride){
- uint8_t ret,clk,fb;
- ret = (0x04&c->r1[2]) | (0x20&c->r2[2]) | (0x40&c->r3[2]);
- ret = ret^(ret>>6);
- ret &= 0x7;
- ret = pgm_read_byte(parity3_lut+ret);
- clk = (0x08&c->r1[1]) | (0x10&c->r2[1]) | (0x20&c->r3[1]);
- clk >>= 3;
- clk = pgm_read_byte(clock_lut+clk);
- clk |= clockoverride;
-
- if(clk&1){
- fb = c->r1[2] ^ (1&((c->r1[1])>>5));
- fb &= 0x7;
- fb = pgm_read_byte(parity3_lut+fb);
- shiftreg(c->r1);
- c->r1[0] |= fb;
- c->r1[2] &= 0x07;
- }
- clk>>=1;
- if(clk&1){
- fb = c->r2[2]>>4 ;
- fb &= 0x7;
- fb = pgm_read_byte(parity3_lut+fb);
- shiftreg(c->r2);
- c->r2[0] |= fb;
- c->r2[2] &= 0x3F;
-
- }
- clk>>=1;
- if(clk&1){
- fb = (c->r3[2]>>4) ^ (1&((c->r3[0])>>7));
- fb &= 0x7;
- fb = pgm_read_byte(parity3_lut+fb);
- shiftreg(c->r3);
- c->r3[0] |= fb;
- c->r3[2] &= 0x7F;
- }
- return ret;
+void shiftreg(uint8_t *d)
+{
+ uint8_t c, c2;
+ c = d[0] >> 7;
+ d[0] <<= 1;
+ c2 = d[1] >> 7;
+ d[1] = (d[1] << 1) | c;
+ d[2] = (d[2] << 1) | c2;
}
-uint8_t a5_1_clock(a5_1_ctx_t *c){
- return a5_1_clock_core(c, 0);
+const uint8_t parity3_lut[] PROGMEM = { 0, 1, 1, 0,
+ 1, 0, 0, 1 };
+const uint8_t clock_lut[] PROGMEM = { 0x7, 0x6, 0x5, 0x3,
+ 0x3, 0x5, 0x6, 0x7 };
+
+uint8_t a5_1_clock_core(a5_1_ctx_t *c, uint8_t clockoverride)
+{
+ uint8_t ret, clk, fb;
+ ret = (0x04 & c->r1[2]) | (0x20 & c->r2[2]) | (0x40 & c->r3[2]);
+ ret = ret ^ (ret >> 6);
+ ret &= 0x7;
+ ret = pgm_read_byte(parity3_lut + ret);
+ clk = (0x08 & c->r1[1]) | (0x10 & c->r2[1]) | (0x20 & c->r3[1]);
+ clk >>= 3;
+ clk = pgm_read_byte(clock_lut + clk);
+ clk |= clockoverride;
+
+ if (clk & 1) {
+ fb = c->r1[2] ^ (1 & ((c->r1[1]) >> 5));
+ fb &= 0x7;
+ fb = pgm_read_byte(parity3_lut + fb);
+ shiftreg(c->r1);
+ c->r1[0] |= fb;
+ c->r1[2] &= 0x07;
+ }
+ clk >>= 1;
+ if (clk & 1) {
+ fb = c->r2[2] >> 4;
+ fb &= 0x7;
+ fb = pgm_read_byte(parity3_lut + fb);
+ shiftreg(c->r2);
+ c->r2[0] |= fb;
+ c->r2[2] &= 0x3F;
+
+ }
+ clk >>= 1;
+ if (clk & 1) {
+ fb = (c->r3[2] >> 4) ^ (1 & ((c->r3[0]) >> 7));
+ fb &= 0x7;
+ fb = pgm_read_byte(parity3_lut + fb);
+ shiftreg(c->r3);
+ c->r3[0] |= fb;
+ c->r3[2] &= 0x7F;
+ }
+ return ret;
}
-
-uint8_t a5_1_gen(a5_1_ctx_t *c){
- uint8_t ret=0;
- ret = a5_1_clock(c);
- ret <<= 1;
- ret = a5_1_clock(c);
- ret <<= 1;
- ret = a5_1_clock(c);
- ret <<= 1;
- ret = a5_1_clock(c);
- ret <<= 1;
- ret = a5_1_clock(c);
- ret <<= 1;
- ret = a5_1_clock(c);
- ret <<= 1;
- ret = a5_1_clock(c);
- ret <<= 1;
- ret = a5_1_clock(c);
- return ret;
+uint8_t a5_1_clock(a5_1_ctx_t *c)
+{
+ return a5_1_clock_core(c, 0);
}
-
-
+uint8_t a5_1_gen(a5_1_ctx_t *c)
+{
+ uint8_t ret = 0;
+ ret = a5_1_clock(c);
+ ret <<= 1;
+ ret = a5_1_clock(c);
+ ret <<= 1;
+ ret = a5_1_clock(c);
+ ret <<= 1;
+ ret = a5_1_clock(c);
+ ret <<= 1;
+ ret = a5_1_clock(c);
+ ret <<= 1;
+ ret = a5_1_clock(c);
+ ret <<= 1;
+ ret = a5_1_clock(c);
+ ret <<= 1;
+ ret = a5_1_clock(c);
+ return ret;
+}
/* A5_1.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/*
* File: A5_1.h
* Author: Daniel Otte
#define PARITY_LOOKUP 0x96
typedef struct {
- /* we are wasting one byte here but this allows a much faster implementation */
- uint8_t r1[3], r2[3], r3[3]; /* the three regs, 19,22,23 bit in length */
+ /* we are wasting one byte here but this allows a much faster implementation */
+ uint8_t r1[3], r2[3], r3[3]; /* the three regs, 19,22,23 bit in length */
} a5_1_ctx_t;
-
-void a5_1_init(a5_1_ctx_t *c, void *key, uint8_t keylength_b, void *iv, uint8_t ivlength_b);
-uint8_t a5_1_clock(a5_1_ctx_t *c);
-uint8_t a5_1_gen(a5_1_ctx_t *c);
+void a5_1_init(a5_1_ctx_t *c, void *key, uint8_t keylength_b, void *iv,
+ uint8_t ivlength_b);
+uint8_t a5_1_clock(a5_1_ctx_t *c);
+uint8_t a5_1_gen(a5_1_ctx_t *c);
#endif
/* aes.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file aes.h
* \email daniel.otte@rub.de
/* aes128_enc.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file aes128_enc.c
* \email daniel.otte@rub.de
#include "aes.h"
#include "aes_enc.h"
-void aes128_enc(void *buffer, aes128_ctx_t *ctx){
- aes_encrypt_core(buffer, (aes_genctx_t*)ctx, 10);
+void aes128_enc(void *buffer, aes128_ctx_t *ctx)
+{
+ aes_encrypt_core(buffer, (aes_genctx_t*) ctx, 10);
}
/* aes128_enc.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file aes128_enc.h
* \email daniel.otte@rub.de
#include "aes_types.h"
#include "aes_enc.h"
-
/**
* \brief encrypt with 128 bit key.
*
*/
void aes128_enc(void *buffer, aes128_ctx_t *ctx);
-
-
#endif /* AES128_ENC_H_ */
/* aes192_dec.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file aes192_dec.h
* \email daniel.otte@rub.de
*/
void aes192_dec(void *buffer, aes192_ctx_t *ctx);
-
-
#endif /* AES192_DEC_H_ */
/* aes192_enc.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file aes192_enc.c
* \email daniel.otte@rub.de
#include "aes.h"
#include "aes_enc.h"
-void aes192_enc(void *buffer, aes192_ctx_t *ctx){
- aes_encrypt_core(buffer, (aes_genctx_t*)ctx, 12);
+void aes192_enc(void *buffer, aes192_ctx_t *ctx)
+{
+ aes_encrypt_core(buffer, (aes_genctx_t*) ctx, 12);
}
/* aes192_enc.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file aes192_enc.h
* \email daniel.otte@rub.de
#include "aes_types.h"
#include "aes_enc.h"
-
/**
* \brief encrypt with 192 bit key.
*
*/
void aes192_enc(void *buffer, aes192_ctx_t *ctx);
-
-
#endif /* AES192_ENC_H_ */
/* aes256_enc.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file aes256_enc.h
* \email daniel.otte@rub.de
#include "aes_types.h"
#include "aes_enc.h"
-
/**
* \brief encrypt with 256 bit key.
*
*/
void aes256_enc(void *buffer, aes256_ctx_t *ctx);
-
-
#endif /* AES256_ENC_H_ */
/* aes_enc.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file aes_enc.c
* \email daniel.otte@rub.de
#include "aes_enc.h"
#include <avr/pgmspace.h>
-void aes_shiftcol(void *data, uint8_t shift){
- uint8_t tmp[4];
- tmp[0] = ((uint8_t*)data)[ 0];
- tmp[1] = ((uint8_t*)data)[ 4];
- tmp[2] = ((uint8_t*)data)[ 8];
- tmp[3] = ((uint8_t*)data)[12];
- ((uint8_t*)data)[ 0] = tmp[(shift+0)&3];
- ((uint8_t*)data)[ 4] = tmp[(shift+1)&3];
- ((uint8_t*)data)[ 8] = tmp[(shift+2)&3];
- ((uint8_t*)data)[12] = tmp[(shift+3)&3];
+void aes_shiftcol(void *data, uint8_t shift)
+{
+ uint8_t tmp[4];
+ tmp[0] = ((uint8_t*) data)[0];
+ tmp[1] = ((uint8_t*) data)[4];
+ tmp[2] = ((uint8_t*) data)[8];
+ tmp[3] = ((uint8_t*) data)[12];
+ ((uint8_t*) data)[0] = tmp[(shift + 0) & 3];
+ ((uint8_t*) data)[4] = tmp[(shift + 1) & 3];
+ ((uint8_t*) data)[8] = tmp[(shift + 2) & 3];
+ ((uint8_t*) data)[12] = tmp[(shift + 3) & 3];
}
#define GF256MUL_1(a) (a)
#define GF256MUL_3(a) (gf256mul(3, (a), 0x1b))
static
-void aes_enc_round(aes_cipher_state_t *state, const aes_roundkey_t *k){
- uint8_t tmp[16], t;
- uint8_t i;
- /* subBytes */
- for(i=0; i<16; ++i){
- tmp[i] = pgm_read_byte(aes_sbox+state->s[i]);
- }
- /* shiftRows */
- aes_shiftcol(tmp+1, 1);
- aes_shiftcol(tmp+2, 2);
- aes_shiftcol(tmp+3, 3);
- /* mixColums */
- for(i=0; i<4; ++i){
- t = tmp[4*i+0] ^ tmp[4*i+1] ^ tmp[4*i+2] ^ tmp[4*i+3];
- state->s[4*i+0] =
- GF256MUL_2(tmp[4*i+0]^tmp[4*i+1])
- ^ tmp[4*i+0]
- ^ t;
- state->s[4*i+1] =
- GF256MUL_2(tmp[4*i+1]^tmp[4*i+2])
- ^ tmp[4*i+1]
- ^ t;
- state->s[4*i+2] =
- GF256MUL_2(tmp[4*i+2]^tmp[4*i+3])
- ^ tmp[4*i+2]
- ^ t;
- state->s[4*i+3] =
- GF256MUL_2(tmp[4*i+3]^tmp[4*i+0])
- ^ tmp[4*i+3]
- ^ t;
- }
+void aes_enc_round(aes_cipher_state_t *state, const aes_roundkey_t *k)
+{
+ uint8_t tmp[16], t;
+ uint8_t i;
+ /* subBytes */
+ for (i = 0; i < 16; ++i) {
+ tmp[i] = pgm_read_byte(aes_sbox + state->s[i]);
+ }
+ /* shiftRows */
+ aes_shiftcol(tmp + 1, 1);
+ aes_shiftcol(tmp + 2, 2);
+ aes_shiftcol(tmp + 3, 3);
+ /* mixColums */
+ for (i = 0; i < 4; ++i) {
+ t = tmp[4 * i + 0] ^ tmp[4 * i + 1] ^ tmp[4 * i + 2] ^ tmp[4 * i + 3];
+ state->s[4 * i + 0] =
+ GF256MUL_2(tmp[4*i+0]^tmp[4*i+1])
+ ^ tmp[4 * i + 0]
+ ^ t;
+ state->s[4 * i + 1] =
+ GF256MUL_2(tmp[4*i+1]^tmp[4*i+2])
+ ^ tmp[4 * i + 1]
+ ^ t;
+ state->s[4 * i + 2] =
+ GF256MUL_2(tmp[4*i+2]^tmp[4*i+3])
+ ^ tmp[4 * i + 2]
+ ^ t;
+ state->s[4 * i + 3] =
+ GF256MUL_2(tmp[4*i+3]^tmp[4*i+0])
+ ^ tmp[4 * i + 3]
+ ^ t;
+ }
- /* addKey */
- for(i=0; i<16; ++i){
- state->s[i] ^= k->ks[i];
- }
+ /* addKey */
+ for (i = 0; i < 16; ++i) {
+ state->s[i] ^= k->ks[i];
+ }
}
-
static
-void aes_enc_lastround(aes_cipher_state_t *state,const aes_roundkey_t *k){
- uint8_t i;
- /* subBytes */
- for(i=0; i<16; ++i){
- state->s[i] = pgm_read_byte(aes_sbox+state->s[i]);
- }
- /* shiftRows */
- aes_shiftcol(state->s+1, 1);
- aes_shiftcol(state->s+2, 2);
- aes_shiftcol(state->s+3, 3);
- /* keyAdd */
- for(i=0; i<16; ++i){
- state->s[i] ^= k->ks[i];
- }
+void aes_enc_lastround(aes_cipher_state_t *state, const aes_roundkey_t *k)
+{
+ uint8_t i;
+ /* subBytes */
+ for (i = 0; i < 16; ++i) {
+ state->s[i] = pgm_read_byte(aes_sbox + state->s[i]);
+ }
+ /* shiftRows */
+ aes_shiftcol(state->s + 1, 1);
+ aes_shiftcol(state->s + 2, 2);
+ aes_shiftcol(state->s + 3, 3);
+ /* keyAdd */
+ for (i = 0; i < 16; ++i) {
+ state->s[i] ^= k->ks[i];
+ }
}
-void aes_encrypt_core(aes_cipher_state_t *state, const aes_genctx_t *ks, uint8_t rounds){
- uint8_t i;
- for(i=0; i<16; ++i){
- state->s[i] ^= ks->key[0].ks[i];
- }
- i=1;
- for(;rounds>1;--rounds){
- aes_enc_round(state, &(ks->key[i]));
- ++i;
- }
- aes_enc_lastround(state, &(ks->key[i]));
+void aes_encrypt_core(aes_cipher_state_t *state, const aes_genctx_t *ks,
+ uint8_t rounds)
+{
+ uint8_t i;
+ for (i = 0; i < 16; ++i) {
+ state->s[i] ^= ks->key[0].ks[i];
+ }
+ i = 1;
+ for (; rounds > 1; --rounds) {
+ aes_enc_round(state, &(ks->key[i]));
+ ++i;
+ }
+ aes_enc_lastround(state, &(ks->key[i]));
}
/* aes_enc.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file aes_enc.h
* \email daniel.otte@rub.de
#include "aes_types.h"
#include <stdint.h>
-
-void aes_encrypt_core(aes_cipher_state_t *state, const aes_genctx_t *ks, uint8_t rounds);
-
+void aes_encrypt_core(aes_cipher_state_t *state, const aes_genctx_t *ks,
+ uint8_t rounds);
#endif
#include <stdint.h>
#include <avr/pgmspace.h>
const uint8_t aes_invsbox[256] PROGMEM = {
- 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb,
- 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb,
- 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e,
- 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25,
- 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92,
- 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84,
- 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06,
- 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b,
- 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73,
- 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e,
- 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b,
- 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4,
- 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f,
- 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef,
- 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61,
- 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d
+ 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e,
+ 0x81, 0xf3, 0xd7, 0xfb,
+ 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44,
+ 0xc4, 0xde, 0xe9, 0xcb,
+ 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b,
+ 0x42, 0xfa, 0xc3, 0x4e,
+ 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49,
+ 0x6d, 0x8b, 0xd1, 0x25,
+ 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc,
+ 0x5d, 0x65, 0xb6, 0x92,
+ 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57,
+ 0xa7, 0x8d, 0x9d, 0x84,
+ 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05,
+ 0xb8, 0xb3, 0x45, 0x06,
+ 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03,
+ 0x01, 0x13, 0x8a, 0x6b,
+ 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce,
+ 0xf0, 0xb4, 0xe6, 0x73,
+ 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8,
+ 0x1c, 0x75, 0xdf, 0x6e,
+ 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e,
+ 0xaa, 0x18, 0xbe, 0x1b,
+ 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe,
+ 0x78, 0xcd, 0x5a, 0xf4,
+ 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59,
+ 0x27, 0x80, 0xec, 0x5f,
+ 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f,
+ 0x93, 0xc9, 0x9c, 0xef,
+ 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c,
+ 0x83, 0x53, 0x99, 0x61,
+ 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63,
+ 0x55, 0x21, 0x0c, 0x7d
};
/* aes_invsbox.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file aes_invsbox.h
* \email daniel.otte@rub.de
/* aes_keyschedule.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008, 2009 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008, 2009 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file aes_keyschedule.c
* \email daniel.otte@rub.de
#include <avr/pgmspace.h>
static
-void aes_rotword(void *a){
- uint8_t t;
- t=((uint8_t*)a)[0];
- ((uint8_t*)a)[0] = ((uint8_t*)a)[1];
- ((uint8_t*)a)[1] = ((uint8_t*)a)[2];
- ((uint8_t*)a)[2] = ((uint8_t*)a)[3];
- ((uint8_t*)a)[3] = t;
+void aes_rotword(void *a)
+{
+ uint8_t t;
+ t = ((uint8_t*) a)[0];
+ ((uint8_t*) a)[0] = ((uint8_t*) a)[1];
+ ((uint8_t*) a)[1] = ((uint8_t*) a)[2];
+ ((uint8_t*) a)[2] = ((uint8_t*) a)[3];
+ ((uint8_t*) a)[3] = t;
}
const uint8_t rc_tab[] PROGMEM = { 0x01, 0x02, 0x04, 0x08,
- 0x10, 0x20, 0x40, 0x80,
- 0x1b, 0x36 };
+ 0x10, 0x20, 0x40, 0x80,
+ 0x1b, 0x36 };
-void aes_init(const void *key, uint16_t keysize_b, aes_genctx_t *ctx){
- uint8_t hi,i,nk, next_nk;
- uint8_t rc=0;
- union {
- uint32_t v32;
- uint8_t v8[4];
- } tmp;
- nk=keysize_b>>5; /* 4, 6, 8 */
- hi=4*(nk+6+1);
- memcpy(ctx, key, keysize_b/8);
- next_nk = nk;
- for(i=nk;i<hi;++i){
- tmp.v32 = ((uint32_t*)(ctx->key[0].ks))[i-1];
- if(i!=next_nk){
- if(nk==8 && i%8==4){
- tmp.v8[0] = pgm_read_byte(aes_sbox+tmp.v8[0]);
- tmp.v8[1] = pgm_read_byte(aes_sbox+tmp.v8[1]);
- tmp.v8[2] = pgm_read_byte(aes_sbox+tmp.v8[2]);
- tmp.v8[3] = pgm_read_byte(aes_sbox+tmp.v8[3]);
- }
- } else {
- next_nk += nk;
- aes_rotword(&(tmp.v32));
- tmp.v8[0] = pgm_read_byte(aes_sbox+tmp.v8[0]);
- tmp.v8[1] = pgm_read_byte(aes_sbox+tmp.v8[1]);
- tmp.v8[2] = pgm_read_byte(aes_sbox+tmp.v8[2]);
- tmp.v8[3] = pgm_read_byte(aes_sbox+tmp.v8[3]);
- tmp.v8[0] ^= pgm_read_byte(rc_tab+rc);
- rc++;
- }
- ((uint32_t*)(ctx->key[0].ks))[i] = ((uint32_t*)(ctx->key[0].ks))[i-nk]
- ^ tmp.v32;
- }
+void aes_init(const void *key, uint16_t keysize_b, aes_genctx_t *ctx)
+{
+ uint8_t hi, i, nk, next_nk;
+ uint8_t rc = 0;
+ union {
+ uint32_t v32;
+ uint8_t v8[4];
+ } tmp;
+ nk = keysize_b >> 5; /* 4, 6, 8 */
+ hi = 4 * (nk + 6 + 1);
+ memcpy(ctx, key, keysize_b / 8);
+ next_nk = nk;
+ for (i = nk; i < hi; ++i) {
+ tmp.v32 = ((uint32_t*) (ctx->key[0].ks))[i - 1];
+ if (i != next_nk) {
+ if (nk == 8 && i % 8 == 4) {
+ tmp.v8[0] = pgm_read_byte(aes_sbox + tmp.v8[0]);
+ tmp.v8[1] = pgm_read_byte(aes_sbox + tmp.v8[1]);
+ tmp.v8[2] = pgm_read_byte(aes_sbox + tmp.v8[2]);
+ tmp.v8[3] = pgm_read_byte(aes_sbox + tmp.v8[3]);
+ }
+ } else {
+ next_nk += nk;
+ aes_rotword(&(tmp.v32));
+ tmp.v8[0] = pgm_read_byte(aes_sbox + tmp.v8[0]);
+ tmp.v8[1] = pgm_read_byte(aes_sbox + tmp.v8[1]);
+ tmp.v8[2] = pgm_read_byte(aes_sbox + tmp.v8[2]);
+ tmp.v8[3] = pgm_read_byte(aes_sbox + tmp.v8[3]);
+ tmp.v8[0] ^= pgm_read_byte(rc_tab + rc);
+ rc++;
+ }
+ ((uint32_t*) (ctx->key[0].ks))[i] = ((uint32_t*) (ctx->key[0].ks))[i
+ - nk]
+ ^ tmp.v32;
+ }
}
-void aes128_init(const void *key, aes128_ctx_t *ctx){
- aes_init(key, 128, (aes_genctx_t*)ctx);
+void aes128_init(const void *key, aes128_ctx_t *ctx)
+{
+ aes_init(key, 128, (aes_genctx_t*) ctx);
}
-void aes192_init(const void *key, aes192_ctx_t *ctx){
- aes_init(key, 192, (aes_genctx_t*)ctx);
+void aes192_init(const void *key, aes192_ctx_t *ctx)
+{
+ aes_init(key, 192, (aes_genctx_t*) ctx);
}
-void aes256_init(const void *key, aes256_ctx_t *ctx){
- aes_init(key, 256, (aes_genctx_t*)ctx);
+void aes256_init(const void *key, aes256_ctx_t *ctx)
+{
+ aes_init(key, 256, (aes_genctx_t*) ctx);
}
/* aes_keyschedule.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file aes_keyschedule.h
* \email daniel.otte@rub.de
* \ingroup AES
*/
-
#ifndef AES_KEYSCHEDULE_H_
#define AES_KEYSCHEDULE_H_
/* aes_sbox.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file aes_sbox.h
* \email daniel.otte@rub.de
/* arcfour.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/*
* File: arcfour.c
* Author: Daniel Otte
* length is length of key in bytes!
*/
-void arcfour_init(const void *key, uint16_t length_b, arcfour_ctx_t *ctx){
- uint8_t t;
- const uint8_t length_B = length_b/8;
- uint8_t nidx = length_B;
- uint8_t x=0,y=0;
- const uint8_t *kptr = (const uint8_t*)key;
- do{
- ctx->s[x]=x;
- }while((uint8_t)++x);
+void arcfour_init(const void *key, uint16_t length_b, arcfour_ctx_t *ctx)
+{
+ uint8_t t;
+ const uint8_t length_B = length_b / 8;
+ uint8_t nidx = length_B;
+ uint8_t x = 0, y = 0;
+ const uint8_t *kptr = (const uint8_t*) key;
+ do {
+ ctx->s[x] = x;
+ } while ((uint8_t) ++x);
- do{
- y += ctx->s[x] + *kptr++;
- if(!--nidx){
- kptr = (const uint8_t*)key;
- nidx = length_B;
- }
- y &= 0xff;
- /* ctx->s[y] <--> ctx->s[x] */
- t = ctx->s[y];
- ctx->s[y] = ctx->s[x];
- ctx->s[x] = t;
- }while((uint8_t)++x);
+ do {
+ y += ctx->s[x] + *kptr++;
+ if (!--nidx) {
+ kptr = (const uint8_t*) key;
+ nidx = length_B;
+ }
+ y &= 0xff;
+ /* ctx->s[y] <--> ctx->s[x] */
+ t = ctx->s[y];
+ ctx->s[y] = ctx->s[x];
+ ctx->s[x] = t;
+ } while ((uint8_t) ++x);
- ctx->i = ctx->j = 0;
+ ctx->i = ctx->j = 0;
}
-uint8_t arcfour_gen(arcfour_ctx_t *ctx){
- uint8_t t;
- ctx->i++;
- ctx->j += ctx->s[ctx->i];
- /* ctx->s[i] <--> ctx->s[j] */
- t = ctx->s[ctx->j];
- ctx->s[ctx->j] = ctx->s[ctx->i];
- ctx->s[ctx->i] = t;
- return ctx->s[(ctx->s[ctx->j] + ctx->s[ctx->i]) & 0xff];
+uint8_t arcfour_gen(arcfour_ctx_t *ctx)
+{
+ uint8_t t;
+ ctx->i++;
+ ctx->j += ctx->s[ctx->i];
+ /* ctx->s[i] <--> ctx->s[j] */
+ t = ctx->s[ctx->j];
+ ctx->s[ctx->j] = ctx->s[ctx->i];
+ ctx->s[ctx->i] = t;
+ return ctx->s[(ctx->s[ctx->j] + ctx->s[ctx->i]) & 0xff];
}
/* arcfour.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/*
* File: arcfour.h
* Author: Daniel Otte
* http://www.mozilla.org/projects/security/pki/nss/draft-kaukonen-cipher-arcfour-03.txt
*/
-
#ifndef ARCFOUR_H_
#define ARCFOUR_H_
* The struct holds the two indices and the S-Box
*/
typedef struct arcfour_ctx_st {
- uint8_t i,j;
- uint8_t s[256];
+ uint8_t i, j;
+ uint8_t s[256];
} arcfour_ctx_t;
-
/** \fn void arcfour_init(const void *key, uint8_t length_B, arcfour_ctx_t *ctx)
* \brief setup a context with a key
*
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
/**
* base64 decoder (RFC3548)
* Author: Daniel Otte
/*
#define USE_GCC_EXTENSION
-*/
+ */
#if 1
#ifdef USE_GCC_EXTENSION
static
-int ascii2bit6(char a){
- switch(a){
- case 'A'...'Z':
- return a-'A';
- case 'a'...'z':
- return a-'a'+26;
- case '0'...'9':
- return a-'0'+52;
- case '+':
- case '-':
- return 62;
- case '/':
- case '_':
- return 63;
- default:
- return -1;
- }
+int ascii2bit6(char a) {
+ switch(a) {
+ case 'A'...'Z':
+ return a-'A';
+ case 'a'...'z':
+ return a-'a'+26;
+ case '0'...'9':
+ return a-'0'+52;
+ case '+':
+ case '-':
+ return 62;
+ case '/':
+ case '_':
+ return 63;
+ default:
+ return -1;
+ }
}
#else
-static
-uint8_t ascii2bit6(char a){
- int r;
- switch(a>>4){
- case 0x5:
- case 0x4:
- r=a-'A';
- if(r<0 || r>25){
- return -1;
- } else {
- return r;
- }
- case 0x7:
- case 0x6:
- r=a-'a';
- if(r<0 || r>25){
- return -1;
- } else {
- return r+26;
- }
- break;
- case 0x3:
- if(a>'9')
- return -1;
- return a-'0'+52;
- default:
- break;
- }
- switch (a){
- case '+':
- case '-':
- return 62;
- case '/':
- case '_':
- return 63;
- default:
- return 0xff;
- }
+static uint8_t ascii2bit6(char a)
+{
+ int r;
+ switch (a >> 4) {
+ case 0x5:
+ case 0x4:
+ r = a - 'A';
+ if (r < 0 || r > 25) {
+ return -1;
+ } else {
+ return r;
+ }
+ case 0x7:
+ case 0x6:
+ r = a - 'a';
+ if (r < 0 || r > 25) {
+ return -1;
+ } else {
+ return r + 26;
+ }
+ break;
+ case 0x3:
+ if (a > '9')
+ return -1;
+ return a - '0' + 52;
+ default:
+ break;
+ }
+ switch (a) {
+ case '+':
+ case '-':
+ return 62;
+ case '/':
+ case '_':
+ return 63;
+ default:
+ return 0xff;
+ }
}
#endif
#else
-static
-uint8_t ascii2bit6(uint8_t a){
- if(a>='A' && a<='Z'){
- return a-'A';
- } else {
- if(a>='a' && a<= 'z'){
- return a-'a'+26;
- } else {
- if(a>='0' && a<='9'){
- return a-'0'+52;
- } else {
- if(a=='+' || a=='-'){
- return 62;
- } else {
- if(a=='/' || a=='_'){
- return 63;
- } else {
- return 0xff;
- }
- }
- }
- }
- }
+static
+uint8_t ascii2bit6(uint8_t a) {
+ if(a>='A' && a<='Z') {
+ return a-'A';
+ } else {
+ if(a>='a' && a<= 'z') {
+ return a-'a'+26;
+ } else {
+ if(a>='0' && a<='9') {
+ return a-'0'+52;
+ } else {
+ if(a=='+' || a=='-') {
+ return 62;
+ } else {
+ if(a=='/' || a=='_') {
+ return 63;
+ } else {
+ return 0xff;
+ }
+ }
+ }
+ }
+ }
}
#endif
-int base64_binlength(char *str, uint8_t strict){
- int l=0;
- uint8_t term=0;
- for(;;){
- if(*str=='\0')
- break;
- if(*str=='\n' || *str=='\r'){
- str++;
- continue;
- }
- if(*str=='='){
- term++;
- str++;
- if(term==2){
- break;
- }
- continue;
- }
- if(term)
- return -1;
- if(ascii2bit6(*str)==-1){
- if(strict)
- return -1;
- } else {
- l++;
- }
- str++;
- }
- switch(term){
- case 0:
- if(l%4!=0)
- return -1;
- return l/4*3;
- case 1:
- if(l%4!=3)
- return -1;
- return (l+1)/4*3-1;
- case 2:
- if(l%4!=2)
- return -1;
- return (l+2)/4*3-2;
- default:
- return -1;
- }
+int base64_binlength(char *str, uint8_t strict)
+{
+ int l = 0;
+ uint8_t term = 0;
+ for (;;) {
+ if (*str == '\0')
+ break;
+ if (*str == '\n' || *str == '\r') {
+ str++;
+ continue;
+ }
+ if (*str == '=') {
+ term++;
+ str++;
+ if (term == 2) {
+ break;
+ }
+ continue;
+ }
+ if (term)
+ return -1;
+ if (ascii2bit6(*str) == -1) {
+ if (strict)
+ return -1;
+ } else {
+ l++;
+ }
+ str++;
+ }
+ switch (term) {
+ case 0:
+ if (l % 4 != 0)
+ return -1;
+ return l / 4 * 3;
+ case 1:
+ if (l % 4 != 3)
+ return -1;
+ return (l + 1) / 4 * 3 - 1;
+ case 2:
+ if (l % 4 != 2)
+ return -1;
+ return (l + 2) / 4 * 3 - 2;
+ default:
+ return -1;
+ }
}
/*
- |543210543210543210543210|
- |765432107654321076543210|
+ |543210543210543210543210|
+ |765432107654321076543210|
- . . . .
- |54321054|32105432|10543210|
- |76543210|76543210|76543210|
+ . . . .
+ |54321054|32105432|10543210|
+ |76543210|76543210|76543210|
-*/
+ */
-int base64dec(void *dest, const char *b64str, uint8_t strict){
- uint8_t buffer[4];
- uint8_t idx=0;
- uint8_t term=0;
- for(;;){
+int base64dec(void *dest, const char *b64str, uint8_t strict)
+{
+ uint8_t buffer[4];
+ uint8_t idx = 0;
+ uint8_t term = 0;
+ for (;;) {
// cli_putstr_P(PSTR("\r\n DBG: got 0x"));
// cli_hexdump(b64str, 1);
- buffer[idx]= ascii2bit6(*b64str);
+ buffer[idx] = ascii2bit6(*b64str);
// cli_putstr_P(PSTR(" --> 0x"));
// cli_hexdump(buffer+idx, 1);
-
- if(buffer[idx]==0xFF){
- if(*b64str=='='){
- term++;
- b64str++;
- if(term==2)
- goto finalize; /* definitly the end */
- }else{
- if(*b64str == '\0'){
- goto finalize; /* definitly the end */
- }else{
- if(*b64str == '\r' || *b64str == '\n' || !(strict)){
- b64str++; /* charcters that we simply ignore */
- }else{
- return -1;
- }
- }
- }
- }else{
- if(term)
- return -1; /* this happens if we get a '=' in the stream */
- idx++;
- b64str++;
- }
- if(idx==4){
- ((uint8_t*)dest)[0] = buffer[0]<<2 | buffer[1]>>4;
- ((uint8_t*)dest)[1] = buffer[1]<<4 | buffer[2]>>2;
- ((uint8_t*)dest)[2] = buffer[2]<<6 | buffer[3];
- dest = (uint8_t*)dest +3;
- idx=0;
- }
- }
- finalize:
- /* the final touch */
- if(idx==0)
- return 0;
- if(term==1){
- ((uint8_t*)dest)[0] = buffer[0]<<2 | buffer[1]>>4;
- ((uint8_t*)dest)[1] = buffer[1]<<4 | buffer[2]>>2;
- return 0;
- }
- if(term==2){
- ((uint8_t*)dest)[0] = buffer[0]<<2 | buffer[1]>>4;
- return 0;
- }
- return -1;
+
+ if (buffer[idx] == 0xFF) {
+ if (*b64str == '=') {
+ term++;
+ b64str++;
+ if (term == 2)
+ goto finalize;
+ /* definitly the end */
+ } else {
+ if (*b64str == '\0') {
+ goto finalize;
+ /* definitly the end */
+ } else {
+ if (*b64str == '\r' || *b64str == '\n' || !(strict)) {
+ b64str++; /* charcters that we simply ignore */
+ } else {
+ return -1;
+ }
+ }
+ }
+ } else {
+ if (term)
+ return -1; /* this happens if we get a '=' in the stream */
+ idx++;
+ b64str++;
+ }
+ if (idx == 4) {
+ ((uint8_t*) dest)[0] = buffer[0] << 2 | buffer[1] >> 4;
+ ((uint8_t*) dest)[1] = buffer[1] << 4 | buffer[2] >> 2;
+ ((uint8_t*) dest)[2] = buffer[2] << 6 | buffer[3];
+ dest = (uint8_t*) dest + 3;
+ idx = 0;
+ }
+ }
+ finalize:
+ /* the final touch */
+ if (idx == 0)
+ return 0;
+ if (term == 1) {
+ ((uint8_t*) dest)[0] = buffer[0] << 2 | buffer[1] >> 4;
+ ((uint8_t*) dest)[1] = buffer[1] << 4 | buffer[2] >> 2;
+ return 0;
+ }
+ if (term == 2) {
+ ((uint8_t*) dest)[0] = buffer[0] << 2 | buffer[1] >> 4;
+ return 0;
+ }
+ return -1;
}
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
#ifndef BASE64_DEC_H_
#define BASE64_DEC_H_
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
/**
* base64 encoder (RFC3548)
* Author: Daniel Otte
#include <avr/pgmspace.h>
const char base64_alphabet[64] PROGMEM = {
- 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
- 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
- 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
- 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
- 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
- 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
- 'w', 'x', 'y', 'z', '0', '1', '2', '3',
- '4', '5', '6', '7', '8', '9', '+', '/' };
+ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
+ 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
+ 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
+ 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
+ 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
+ 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
+ 'w', 'x', 'y', 'z', '0', '1', '2', '3',
+ '4', '5', '6', '7', '8', '9', '+', '/' };
-static
-char bit6toAscii(uint8_t a){
- a &= (uint8_t)0x3F;
- return pgm_read_byte(base64_alphabet+a);
+static
+char bit6toAscii(uint8_t a)
+{
+ a &= (uint8_t) 0x3F;
+ return pgm_read_byte(base64_alphabet + a);
}
#else
-static
-char bit6toAscii(uint8_t a){
- a &= (uint8_t)0x3F;
-
- if(a<=25){
- return a+'A';
- } else {
- if(a<=51){
- return a-26+'a';
- } else {
- if(a<=61){
- return a-52+'0';
- } else {
- if(a==62){
- return '+';
- } else {
- return '/'; /* a == 63 */
- }
- }
- }
- }
+static
+char bit6toAscii(uint8_t a) {
+ a &= (uint8_t)0x3F;
+
+ if(a<=25) {
+ return a+'A';
+ } else {
+ if(a<=51) {
+ return a-26+'a';
+ } else {
+ if(a<=61) {
+ return a-52+'0';
+ } else {
+ if(a==62) {
+ return '+';
+ } else {
+ return '/'; /* a == 63 */
+ }
+ }
+ }
+ }
}
#endif
-void base64enc(char *dest,const void *src, uint16_t length){
- uint16_t i,j;
- uint8_t a[4];
- for(i=0; i<length/3; ++i){
- a[0]= (((uint8_t*)src)[i*3+0])>>2;
- a[1]= (((((uint8_t*)src)[i*3+0])<<4) | ((((uint8_t*)src)[i*3+1])>>4)) & 0x3F;
- a[2]= (((((uint8_t*)src)[i*3+1])<<2) | ((((uint8_t*)src)[i*3+2])>>6)) & 0x3F;
- a[3]= (((uint8_t*)src)[i*3+2]) & 0x3F;
- for(j=0; j<4; ++j){
- *dest++=bit6toAscii(a[j]);
- }
- }
- /* now we do the rest */
- switch(length%3){
- case 0:
- break;
- case 1:
- a[0]=(((uint8_t*)src)[i*3+0])>>2;
- a[1]=((((uint8_t*)src)[i*3+0])<<4)&0x3F;
- *dest++ = bit6toAscii(a[0]);
- *dest++ = bit6toAscii(a[1]);
- *dest++ = '=';
- *dest++ = '=';
- break;
- case 2:
- a[0]= (((uint8_t*)src)[i*3+0])>>2;
- a[1]= (((((uint8_t*)src)[i*3+0])<<4) | ((((uint8_t*)src)[i*3+1])>>4)) & 0x3F;
- a[2]= ((((uint8_t*)src)[i*3+1])<<2) & 0x3F;
- *dest++ = bit6toAscii(a[0]);
- *dest++ = bit6toAscii(a[1]);
- *dest++ = bit6toAscii(a[2]);
- *dest++ = '=';
- break;
- default: /* this will not happen! */
- break;
- }
-/* finalize: */
- *dest='\0';
+void base64enc(char *dest, const void *src, uint16_t length)
+{
+ uint16_t i, j;
+ uint8_t a[4];
+ for (i = 0; i < length / 3; ++i) {
+ a[0] = (((uint8_t*) src)[i * 3 + 0]) >> 2;
+ a[1] = (((((uint8_t*) src)[i * 3 + 0]) << 4)
+ | ((((uint8_t*) src)[i * 3 + 1]) >> 4)) & 0x3F;
+ a[2] = (((((uint8_t*) src)[i * 3 + 1]) << 2)
+ | ((((uint8_t*) src)[i * 3 + 2]) >> 6)) & 0x3F;
+ a[3] = (((uint8_t*) src)[i * 3 + 2]) & 0x3F;
+ for (j = 0; j < 4; ++j) {
+ *dest++ = bit6toAscii(a[j]);
+ }
+ }
+ /* now we do the rest */
+ switch (length % 3) {
+ case 0:
+ break;
+ case 1:
+ a[0] = (((uint8_t*) src)[i * 3 + 0]) >> 2;
+ a[1] = ((((uint8_t*) src)[i * 3 + 0]) << 4) & 0x3F;
+ *dest++ = bit6toAscii(a[0]);
+ *dest++ = bit6toAscii(a[1]);
+ *dest++ = '=';
+ *dest++ = '=';
+ break;
+ case 2:
+ a[0] = (((uint8_t*) src)[i * 3 + 0]) >> 2;
+ a[1] = (((((uint8_t*) src)[i * 3 + 0]) << 4)
+ | ((((uint8_t*) src)[i * 3 + 1]) >> 4)) & 0x3F;
+ a[2] = ((((uint8_t*) src)[i * 3 + 1]) << 2) & 0x3F;
+ *dest++ = bit6toAscii(a[0]);
+ *dest++ = bit6toAscii(a[1]);
+ *dest++ = bit6toAscii(a[2]);
+ *dest++ = '=';
+ break;
+ default: /* this will not happen! */
+ break;
+ }
+ /* finalize: */
+ *dest = '\0';
}
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
#ifndef BASE64_ENC_H_
#define BASE64_ENC_H_
/* bcal-basic.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2009 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2009 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include <stdlib.h>
#include <stdint.h>
#include "keysize_descriptor.h"
uint8_t bcal_cipher_init(const bcdesc_t *cipher_descriptor,
- const void *key, uint16_t keysize_b, bcgen_ctx_t *ctx){
- if(!is_valid_keysize_P((PGM_VOID_P)pgm_read_word(&(cipher_descriptor->valid_keysize_desc)),
- keysize_b)){
- return 1;
- }
- uint8_t flags;
- bc_init_fpt init_fpt;
- ctx->desc_ptr = (bcdesc_t*)cipher_descriptor;
- ctx->keysize = keysize_b;
- flags = pgm_read_byte(cipher_descriptor->flags);
- init_fpt.initvoid = (void_fpt)(pgm_read_word(&(cipher_descriptor->init.initvoid)));
- if(init_fpt.initvoid == NULL){
- if(!(ctx->ctx = malloc((keysize_b+7)/8)))
- return 2;
- memcpy(ctx->ctx, key, (keysize_b+7)/8);
- return 0;
- }
- if(!(ctx->ctx = malloc(pgm_read_word(&(cipher_descriptor->ctxsize_B)))))
- return 3;
- if((flags&BC_INIT_TYPE)==BC_INIT_TYPE_1){
- init_fpt.init1((void*)key, (ctx->ctx));
- }else{
- init_fpt.init2((void*)key, keysize_b, (ctx->ctx));
- }
- return 0;
+ const void *key, uint16_t keysize_b, bcgen_ctx_t *ctx)
+{
+ if (!is_valid_keysize_P((PGM_VOID_P) pgm_read_word(&(cipher_descriptor->valid_keysize_desc)),
+ keysize_b)) {
+ return 1;
+ }
+ uint8_t flags;
+ bc_init_fpt init_fpt;
+ ctx->desc_ptr = (bcdesc_t*) cipher_descriptor;
+ ctx->keysize = keysize_b;
+ flags = pgm_read_byte(cipher_descriptor->flags);
+ init_fpt.initvoid =
+ (void_fpt) (pgm_read_word(&(cipher_descriptor->init.initvoid)));
+ if (init_fpt.initvoid == NULL) {
+ if (!(ctx->ctx = malloc((keysize_b + 7) / 8)))
+ return 2;
+ memcpy(ctx->ctx, key, (keysize_b + 7) / 8);
+ return 0;
+ }
+ if (!(ctx->ctx = malloc(pgm_read_word(&(cipher_descriptor->ctxsize_B)))))
+ return 3;
+ if ((flags & BC_INIT_TYPE) == BC_INIT_TYPE_1) {
+ init_fpt.init1((void*) key, (ctx->ctx));
+ } else {
+ init_fpt.init2((void*) key, keysize_b, (ctx->ctx));
+ }
+ return 0;
}
-void bcal_cipher_free(bcgen_ctx_t *ctx){
- if(!ctx)
- return;
- bc_free_fpt free_fpt;
- free_fpt = (bc_free_fpt)(pgm_read_word(&(ctx->desc_ptr->free)));
- if(free_fpt)
- free_fpt((ctx->ctx));
- free(ctx->ctx);
+void bcal_cipher_free(bcgen_ctx_t *ctx)
+{
+ if (!ctx)
+ return;
+ bc_free_fpt free_fpt;
+ free_fpt = (bc_free_fpt) (pgm_read_word(&(ctx->desc_ptr->free)));
+ if (free_fpt)
+ free_fpt((ctx->ctx));
+ free(ctx->ctx);
}
-void bcal_cipher_enc(void *block, const bcgen_ctx_t *ctx){
- bc_enc_fpt enc_fpt;
- enc_fpt.encvoid = (void_fpt)pgm_read_word(&(ctx->desc_ptr->enc.encvoid));
- if(!enc_fpt.encvoid){
- /* very bad error, no enciphering function specified */
- return;
- }
- enc_fpt.enc1(block, (ctx->ctx));
-
-}
+void bcal_cipher_enc(void *block, const bcgen_ctx_t *ctx)
+{
+ bc_enc_fpt enc_fpt;
+ enc_fpt.encvoid = (void_fpt) pgm_read_word(&(ctx->desc_ptr->enc.encvoid));
+ if (!enc_fpt.encvoid) {
+ /* very bad error, no enciphering function specified */
+ return;
+ }
+ enc_fpt.enc1(block, (ctx->ctx));
-void bcal_cipher_dec(void *block, const bcgen_ctx_t *ctx){
- bc_dec_fpt dec_fpt;
- dec_fpt.decvoid = (void_fpt)pgm_read_word(&(ctx->desc_ptr->dec.decvoid));
- if(!dec_fpt.decvoid){
- /* very bad error, no deciphering function specified */
- return;
- }
- dec_fpt.dec1(block, (ctx->ctx));
}
-uint16_t bcal_cipher_getBlocksize_b(const bcdesc_t *desc){
- return pgm_read_word(&(desc->blocksize_b));
+void bcal_cipher_dec(void *block, const bcgen_ctx_t *ctx)
+{
+ bc_dec_fpt dec_fpt;
+ dec_fpt.decvoid = (void_fpt) pgm_read_word(&(ctx->desc_ptr->dec.decvoid));
+ if (!dec_fpt.decvoid) {
+ /* very bad error, no deciphering function specified */
+ return;
+ }
+ dec_fpt.dec1(block, (ctx->ctx));
}
-PGM_VOID_P bcal_cipher_getKeysizeDesc(const bcdesc_t *desc){
- return (PGM_VOID_P)pgm_read_word(&(desc->valid_keysize_desc));
+uint16_t bcal_cipher_getBlocksize_b(const bcdesc_t *desc)
+{
+ return pgm_read_word(&(desc->blocksize_b));
}
+PGM_VOID_P bcal_cipher_getKeysizeDesc(const bcdesc_t *desc) {
+ return (PGM_VOID_P)pgm_read_word(&(desc->valid_keysize_desc));
+}
/* bcal-basic.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2009 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2009 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef BCAL_BASIC_H_
#define BCAL_BASIC_H_
#include <avr/pgmspace.h>
uint8_t bcal_cipher_init(const bcdesc_t *cipher_descriptor,
- const void *key, uint16_t keysize_b, bcgen_ctx_t *ctx);
+ const void *key, uint16_t keysize_b, bcgen_ctx_t *ctx);
void bcal_cipher_free(bcgen_ctx_t *ctx);
void bcal_cipher_enc(void *block, const bcgen_ctx_t *ctx);
void bcal_cipher_dec(void *block, const bcgen_ctx_t *ctx);
/* bcal-cbc.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include <stdint.h>
#include <string.h>
#include "bcal-basic.h"
#include "memxor.h"
-uint8_t bcal_cbc_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b, bcal_cbc_ctx_t *ctx){
- ctx->desc = (bcdesc_t*)desc;
- ctx->blocksize_B = (bcal_cipher_getBlocksize_b(desc)+7)/8;
- ctx->prev_block = malloc(ctx->blocksize_B);
+uint8_t bcal_cbc_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b,
+ bcal_cbc_ctx_t *ctx)
+{
+ ctx->desc = (bcdesc_t*) desc;
+ ctx->blocksize_B = (bcal_cipher_getBlocksize_b(desc) + 7) / 8;
+ ctx->prev_block = malloc(ctx->blocksize_B);
- if(ctx->prev_block == NULL){
- return 0x11;
- }
- return bcal_cipher_init(desc, key, keysize_b, &(ctx->cctx));
+ if (ctx->prev_block == NULL) {
+ return 0x11;
+ }
+ return bcal_cipher_init(desc, key, keysize_b, &(ctx->cctx));
}
-void bcal_cbc_free(bcal_cbc_ctx_t *ctx){
- bcal_cipher_free(&(ctx->cctx));
- free(ctx->prev_block);
+void bcal_cbc_free(bcal_cbc_ctx_t *ctx)
+{
+ bcal_cipher_free(&(ctx->cctx));
+ free(ctx->prev_block);
}
-
-void bcal_cbc_loadIV(const void *iv, bcal_cbc_ctx_t *ctx){
- if(iv){
- memcpy(ctx->prev_block, iv, ctx->blocksize_B);
- }
+void bcal_cbc_loadIV(const void *iv, bcal_cbc_ctx_t *ctx)
+{
+ if (iv) {
+ memcpy(ctx->prev_block, iv, ctx->blocksize_B);
+ }
}
-void bcal_cbc_encNext(void *block, bcal_cbc_ctx_t *ctx){
- memxor(block, ctx->prev_block, ctx->blocksize_B);
- bcal_cipher_enc(block, &(ctx->cctx));
- memcpy(ctx->prev_block, block, ctx->blocksize_B);
+void bcal_cbc_encNext(void *block, bcal_cbc_ctx_t *ctx)
+{
+ memxor(block, ctx->prev_block, ctx->blocksize_B);
+ bcal_cipher_enc(block, &(ctx->cctx));
+ memcpy(ctx->prev_block, block, ctx->blocksize_B);
}
-void bcal_cbc_decNext(void *block, bcal_cbc_ctx_t *ctx){
- uint8_t tmp[ctx->blocksize_B];
- memcpy(tmp, block, ctx->blocksize_B);
- bcal_cipher_dec(block, &(ctx->cctx));
- memxor(block, ctx->prev_block, ctx->blocksize_B);
- memcpy(ctx->prev_block, tmp, ctx->blocksize_B);
+void bcal_cbc_decNext(void *block, bcal_cbc_ctx_t *ctx)
+{
+ uint8_t tmp[ctx->blocksize_B];
+ memcpy(tmp, block, ctx->blocksize_B);
+ bcal_cipher_dec(block, &(ctx->cctx));
+ memxor(block, ctx->prev_block, ctx->blocksize_B);
+ memcpy(ctx->prev_block, tmp, ctx->blocksize_B);
}
-void bcal_cbc_decRand(void *block, const void *prev_block, bcal_cbc_ctx_t *ctx){
- bcal_cipher_dec(block, &(ctx->cctx));
- memxor(block, prev_block, ctx->blocksize_B);
+void bcal_cbc_decRand(void *block, const void *prev_block, bcal_cbc_ctx_t *ctx)
+{
+ bcal_cipher_dec(block, &(ctx->cctx));
+ memxor(block, prev_block, ctx->blocksize_B);
}
-void bcal_cbc_encMsg(const void *iv, void *msg, uint16_t msg_blocks, bcal_cbc_ctx_t *ctx){
- bcal_cbc_loadIV(iv, ctx);
- while(msg_blocks--){
- bcal_cbc_encNext(msg, ctx);
- msg = (uint8_t*)msg + ctx->blocksize_B;
- }
+void bcal_cbc_encMsg(const void *iv, void *msg, uint16_t msg_blocks,
+ bcal_cbc_ctx_t *ctx)
+{
+ bcal_cbc_loadIV(iv, ctx);
+ while (msg_blocks--) {
+ bcal_cbc_encNext(msg, ctx);
+ msg = (uint8_t*) msg + ctx->blocksize_B;
+ }
}
-void bcal_cbc_decMsg(const void *iv, void *msg, uint16_t msg_blocks, bcal_cbc_ctx_t *ctx){
- msg=(uint8_t*)msg + (msg_blocks-1)*ctx->blocksize_B;
- while(msg_blocks > 1){
- bcal_cbc_decRand(msg, (uint8_t*)msg-ctx->blocksize_B, ctx);
- msg_blocks -= 1;
- msg=(uint8_t*)msg-ctx->blocksize_B;
- }
- bcal_cbc_decRand(msg, iv, ctx);
+void bcal_cbc_decMsg(const void *iv, void *msg, uint16_t msg_blocks,
+ bcal_cbc_ctx_t *ctx)
+{
+ msg = (uint8_t*) msg + (msg_blocks - 1) * ctx->blocksize_B;
+ while (msg_blocks > 1) {
+ bcal_cbc_decRand(msg, (uint8_t*) msg - ctx->blocksize_B, ctx);
+ msg_blocks -= 1;
+ msg = (uint8_t*) msg - ctx->blocksize_B;
+ }
+ bcal_cbc_decRand(msg, iv, ctx);
}
/* bcal-cbc.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef BCALCBC_H_
#define BCALCBC_H_
#include "blockcipher_descriptor.h"
#include "bcal-basic.h"
-typedef struct{
- bcdesc_t* desc;
- bcgen_ctx_t cctx;
- uint8_t* prev_block;
- uint8_t blocksize_B;
+typedef struct {
+ bcdesc_t* desc;
+ bcgen_ctx_t cctx;
+ uint8_t* prev_block;
+ uint8_t blocksize_B;
} bcal_cbc_ctx_t;
-uint8_t bcal_cbc_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b, bcal_cbc_ctx_t *ctx);
+uint8_t bcal_cbc_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b,
+ bcal_cbc_ctx_t *ctx);
void bcal_cbc_free(bcal_cbc_ctx_t *ctx);
void bcal_cbc_loadIV(const void *iv, bcal_cbc_ctx_t *ctx);
void bcal_cbc_encNext(void *block, bcal_cbc_ctx_t *ctx);
void bcal_cbc_decNext(void *block, bcal_cbc_ctx_t *ctx);
void bcal_cbc_decRand(void *block, const void *prev_block, bcal_cbc_ctx_t *ctx);
-void bcal_cbc_encMsg(const void *iv, void *msg, uint16_t msg_blocks, bcal_cbc_ctx_t *ctx);
-void bcal_cbc_decMsg(const void *iv, void *msg, uint16_t msg_blocks, bcal_cbc_ctx_t *ctx);
-
+void bcal_cbc_encMsg(const void *iv, void *msg, uint16_t msg_blocks,
+ bcal_cbc_ctx_t *ctx);
+void bcal_cbc_decMsg(const void *iv, void *msg, uint16_t msg_blocks,
+ bcal_cbc_ctx_t *ctx);
#endif /* BCALCBC_H_ */
/* bcal-cfb_bit.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include <stdint.h>
#include <string.h>
#include "bcal-cfb_bit.h"
#include "bcal-basic.h"
-static uint8_t read_bit(void *block, uint32_t index){
- uint8_t r;
- r=((uint8_t*)block)[index/8];
- r=(r&(0x80>>(index&7)))?0xff:0x00;
- return r;
+static uint8_t read_bit(void *block, uint32_t index)
+{
+ uint8_t r;
+ r = ((uint8_t*) block)[index / 8];
+ r = (r & (0x80 >> (index & 7))) ? 0xff : 0x00;
+ return r;
}
-static void write_bit(void *block, uint32_t index, uint8_t value){
- if(value){
- /* set bit */
- ((uint8_t*)block)[index/8] |= 0x80>>(index&7);
- }else{
- /* clear bit */
- ((uint8_t*)block)[index/8] &= ~(0x80>>(index&7));
- }
+static void write_bit(void *block, uint32_t index, uint8_t value)
+{
+ if (value) {
+ /* set bit */
+ ((uint8_t*) block)[index / 8] |= 0x80 >> (index & 7);
+ } else {
+ /* clear bit */
+ ((uint8_t*) block)[index / 8] &= ~(0x80 >> (index & 7));
+ }
}
-uint8_t bcal_cfb_b_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b, uint16_t size_b, bcal_cfb_b_ctx_t *ctx){
- ctx->desc = (bcdesc_t*)desc;
- ctx->blocksize_B = (bcal_cipher_getBlocksize_b(desc)+7)/8;
- ctx->in_block=malloc(ctx->blocksize_B);
- if(ctx->in_block==NULL){
- return 0x11;
- }
- if(size_b>bcal_cipher_getBlocksize_b(desc)){
- return 0x12;
- }
- ctx->size_b = size_b;
- return bcal_cipher_init(desc, key, keysize_b, &(ctx->cctx));
+uint8_t bcal_cfb_b_init(const bcdesc_t *desc, const void *key,
+ uint16_t keysize_b, uint16_t size_b, bcal_cfb_b_ctx_t *ctx)
+{
+ ctx->desc = (bcdesc_t*) desc;
+ ctx->blocksize_B = (bcal_cipher_getBlocksize_b(desc) + 7) / 8;
+ ctx->in_block = malloc(ctx->blocksize_B);
+ if (ctx->in_block == NULL) {
+ return 0x11;
+ }
+ if (size_b > bcal_cipher_getBlocksize_b(desc)) {
+ return 0x12;
+ }
+ ctx->size_b = size_b;
+ return bcal_cipher_init(desc, key, keysize_b, &(ctx->cctx));
}
-void bcal_cfb_b_free(bcal_cfb_b_ctx_t *ctx){
- free(ctx->in_block);
- bcal_cipher_free(&(ctx->cctx));
+void bcal_cfb_b_free(bcal_cfb_b_ctx_t *ctx)
+{
+ free(ctx->in_block);
+ bcal_cipher_free(&(ctx->cctx));
}
-void bcal_cfb_b_loadIV(const void *iv, bcal_cfb_b_ctx_t *ctx){
- if(iv){
- memcpy(ctx->in_block, iv, ctx->blocksize_B);
- }
+void bcal_cfb_b_loadIV(const void *iv, bcal_cfb_b_ctx_t *ctx)
+{
+ if (iv) {
+ memcpy(ctx->in_block, iv, ctx->blocksize_B);
+ }
}
-void bcal_cfb_b_encNext(void *block, uint8_t offset, bcal_cfb_b_ctx_t *ctx){
- uint8_t tmp[ctx->blocksize_B];
- offset &= 7;
- memcpy(tmp, ctx->in_block, ctx->blocksize_B);
- bcal_cipher_enc(tmp, &(ctx->cctx));
- uint16_t i,j;
- uint8_t a;
- for(i=0; i<ctx->blocksize_B*8-ctx->size_b; ++i){
- a = read_bit(ctx->in_block, i+ctx->size_b);
- write_bit(ctx->in_block, i, a);
- }
- for(j=offset,i=0; i<ctx->size_b; ++i, ++j){
- a = read_bit(tmp, i) ^ read_bit(block, j);
- write_bit(ctx->in_block, ctx->blocksize_B*8-ctx->size_b+i, a);
- write_bit(block, j, a);
- }
+void bcal_cfb_b_encNext(void *block, uint8_t offset, bcal_cfb_b_ctx_t *ctx)
+{
+ uint8_t tmp[ctx->blocksize_B];
+ offset &= 7;
+ memcpy(tmp, ctx->in_block, ctx->blocksize_B);
+ bcal_cipher_enc(tmp, &(ctx->cctx));
+ uint16_t i, j;
+ uint8_t a;
+ for (i = 0; i < ctx->blocksize_B * 8 - ctx->size_b; ++i) {
+ a = read_bit(ctx->in_block, i + ctx->size_b);
+ write_bit(ctx->in_block, i, a);
+ }
+ for (j = offset, i = 0; i < ctx->size_b; ++i, ++j) {
+ a = read_bit(tmp, i) ^ read_bit(block, j);
+ write_bit(ctx->in_block, ctx->blocksize_B * 8 - ctx->size_b + i, a);
+ write_bit(block, j, a);
+ }
}
-void bcal_cfb_b_decNext(void *block, uint8_t offset, bcal_cfb_b_ctx_t *ctx){
- uint8_t tmp[ctx->blocksize_B];
- offset &= 7;
- memcpy(tmp, ctx->in_block, ctx->blocksize_B);
- bcal_cipher_enc(tmp, &(ctx->cctx));
- uint16_t i,j;
- uint8_t a,b;
- for(i=0; i<ctx->blocksize_B*8-ctx->size_b; ++i){
- a = read_bit(ctx->in_block, i+ctx->size_b);
- write_bit(ctx->in_block, i, a);
- }
- for(j=offset,i=0; i<ctx->size_b; ++i, ++j){
- a = read_bit(tmp, i);
- b = read_bit(block, j);
- a ^= b;
- write_bit(ctx->in_block, ctx->blocksize_B*8-ctx->size_b+i, b);
- write_bit(block, j, a);
- }
+void bcal_cfb_b_decNext(void *block, uint8_t offset, bcal_cfb_b_ctx_t *ctx)
+{
+ uint8_t tmp[ctx->blocksize_B];
+ offset &= 7;
+ memcpy(tmp, ctx->in_block, ctx->blocksize_B);
+ bcal_cipher_enc(tmp, &(ctx->cctx));
+ uint16_t i, j;
+ uint8_t a, b;
+ for (i = 0; i < ctx->blocksize_B * 8 - ctx->size_b; ++i) {
+ a = read_bit(ctx->in_block, i + ctx->size_b);
+ write_bit(ctx->in_block, i, a);
+ }
+ for (j = offset, i = 0; i < ctx->size_b; ++i, ++j) {
+ a = read_bit(tmp, i);
+ b = read_bit(block, j);
+ a ^= b;
+ write_bit(ctx->in_block, ctx->blocksize_B * 8 - ctx->size_b + i, b);
+ write_bit(block, j, a);
+ }
}
-void bcal_cfb_b_encMsg(const void *iv, void *msg, uint8_t offset, uint32_t msg_blocks, bcal_cfb_b_ctx_t *ctx){
- bcal_cfb_b_loadIV(iv, ctx);
- uint32_t addr;
- addr = ((uint16_t)msg)*8+offset;
- while(msg_blocks--){
- msg = (void*)((uint16_t)(addr/8));
- offset = addr&7;
- bcal_cfb_b_encNext(msg, offset, ctx);
- addr += ctx->size_b;
- }
+void bcal_cfb_b_encMsg(const void *iv, void *msg, uint8_t offset,
+ uint32_t msg_blocks, bcal_cfb_b_ctx_t *ctx)
+{
+ bcal_cfb_b_loadIV(iv, ctx);
+ uint32_t addr;
+ addr = ((uint16_t) msg) * 8 + offset;
+ while (msg_blocks--) {
+ msg = (void*) ((uint16_t) (addr / 8));
+ offset = addr & 7;
+ bcal_cfb_b_encNext(msg, offset, ctx);
+ addr += ctx->size_b;
+ }
}
-void bcal_cfb_b_decMsg(const void *iv, void *msg, uint8_t offset, uint32_t msg_blocks, bcal_cfb_b_ctx_t *ctx){
- bcal_cfb_b_loadIV(iv, ctx);
- uint32_t addr;
- addr = ((uint16_t)msg)*8+offset;
- while(msg_blocks--){
- msg = (void*)((uint16_t)(addr/8));
- offset = addr&7;
- bcal_cfb_b_decNext(msg, offset, ctx);
- addr += ctx->size_b;
- }
+void bcal_cfb_b_decMsg(const void *iv, void *msg, uint8_t offset,
+ uint32_t msg_blocks, bcal_cfb_b_ctx_t *ctx)
+{
+ bcal_cfb_b_loadIV(iv, ctx);
+ uint32_t addr;
+ addr = ((uint16_t) msg) * 8 + offset;
+ while (msg_blocks--) {
+ msg = (void*) ((uint16_t) (addr / 8));
+ offset = addr & 7;
+ bcal_cfb_b_decNext(msg, offset, ctx);
+ addr += ctx->size_b;
+ }
}
/* bcal-cfb_bit.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef BCALCFB_BIT_H_
#define BCALCFB_BIT_H_
#include "bcal-basic.h"
#include "blockcipher_descriptor.h"
-
-typedef struct{
- bcdesc_t* desc;
- bcgen_ctx_t cctx;
- uint8_t* in_block;
- uint8_t blocksize_B;
- uint16_t size_b;
+typedef struct {
+ bcdesc_t* desc;
+ bcgen_ctx_t cctx;
+ uint8_t* in_block;
+ uint8_t blocksize_B;
+ uint16_t size_b;
} bcal_cfb_b_ctx_t;
-
-uint8_t bcal_cfb_b_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b, uint16_t size_b, bcal_cfb_b_ctx_t *ctx);
+uint8_t bcal_cfb_b_init(const bcdesc_t *desc, const void *key,
+ uint16_t keysize_b, uint16_t size_b, bcal_cfb_b_ctx_t *ctx);
void bcal_cfb_b_free(bcal_cfb_b_ctx_t *ctx);
void bcal_cfb_b_loadIV(const void *iv, bcal_cfb_b_ctx_t *ctx);
void bcal_cfb_b_encNext(void *block, uint8_t offset, bcal_cfb_b_ctx_t *ctx);
void bcal_cfb_b_decNext(void *block, uint8_t offset, bcal_cfb_b_ctx_t *ctx);
-void bcal_cfb_b_encMsg(const void *iv, void *msg, uint8_t offset, uint32_t msg_blocks, bcal_cfb_b_ctx_t *ctx);
-void bcal_cfb_b_decMsg(const void *iv, void *msg, uint8_t offset, uint32_t msg_blocks, bcal_cfb_b_ctx_t *ctx);
-
+void bcal_cfb_b_encMsg(const void *iv, void *msg, uint8_t offset,
+ uint32_t msg_blocks, bcal_cfb_b_ctx_t *ctx);
+void bcal_cfb_b_decMsg(const void *iv, void *msg, uint8_t offset,
+ uint32_t msg_blocks, bcal_cfb_b_ctx_t *ctx);
#endif /* BCALCFB_BIT_H_ */
/* bcal-cfb_byte.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include <stdint.h>
#include <string.h>
#include "bcal-basic.h"
#include "memxor.h"
-
-uint8_t bcal_cfb_B_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b, uint16_t size_b, bcal_cfb_B_ctx_t *ctx){
- ctx->desc = (bcdesc_t*)desc;
- ctx->blocksize_B = (bcal_cipher_getBlocksize_b(desc)+7)/8;
- ctx->in_block=malloc(ctx->blocksize_B);
- if(ctx->in_block==NULL){
- return 0x11;
- }
- if(size_b&7){
- return 0x12;
- }
- ctx->size_B = size_b/8;
- return bcal_cipher_init(desc, key, keysize_b, &(ctx->cctx));
+uint8_t bcal_cfb_B_init(const bcdesc_t *desc, const void *key,
+ uint16_t keysize_b, uint16_t size_b, bcal_cfb_B_ctx_t *ctx)
+{
+ ctx->desc = (bcdesc_t*) desc;
+ ctx->blocksize_B = (bcal_cipher_getBlocksize_b(desc) + 7) / 8;
+ ctx->in_block = malloc(ctx->blocksize_B);
+ if (ctx->in_block == NULL) {
+ return 0x11;
+ }
+ if (size_b & 7) {
+ return 0x12;
+ }
+ ctx->size_B = size_b / 8;
+ return bcal_cipher_init(desc, key, keysize_b, &(ctx->cctx));
}
-void bcal_cfb_B_free(bcal_cfb_B_ctx_t *ctx){
- free(ctx->in_block);
- bcal_cipher_free(&(ctx->cctx));
+void bcal_cfb_B_free(bcal_cfb_B_ctx_t *ctx)
+{
+ free(ctx->in_block);
+ bcal_cipher_free(&(ctx->cctx));
}
-void bcal_cfb_B_loadIV(const void *iv, bcal_cfb_B_ctx_t *ctx){
- if(iv){
- memcpy(ctx->in_block, iv, ctx->blocksize_B);
- }
+void bcal_cfb_B_loadIV(const void *iv, bcal_cfb_B_ctx_t *ctx)
+{
+ if (iv) {
+ memcpy(ctx->in_block, iv, ctx->blocksize_B);
+ }
}
-void bcal_cfb_B_encNext(void *block, bcal_cfb_B_ctx_t *ctx){
- uint8_t tmp[ctx->blocksize_B];
- memcpy(tmp, ctx->in_block, ctx->blocksize_B);
- bcal_cipher_enc(tmp, &(ctx->cctx));
- memxor(block, tmp, ctx->size_B);
- memmove(ctx->in_block, ctx->in_block+ctx->size_B, ctx->blocksize_B - ctx->size_B);
- memcpy(ctx->in_block+ctx->blocksize_B-ctx->size_B, block, ctx->size_B);
+void bcal_cfb_B_encNext(void *block, bcal_cfb_B_ctx_t *ctx)
+{
+ uint8_t tmp[ctx->blocksize_B];
+ memcpy(tmp, ctx->in_block, ctx->blocksize_B);
+ bcal_cipher_enc(tmp, &(ctx->cctx));
+ memxor(block, tmp, ctx->size_B);
+ memmove(ctx->in_block, ctx->in_block + ctx->size_B, ctx->blocksize_B
+ - ctx->size_B);
+ memcpy(ctx->in_block + ctx->blocksize_B - ctx->size_B, block, ctx->size_B);
}
-void bcal_cfb_B_decNext(void *block, bcal_cfb_B_ctx_t *ctx){
- uint8_t tmp[ctx->blocksize_B];
- uint8_t xblock[ctx->size_B];
- memcpy(xblock, block, ctx->size_B);
- memcpy(tmp, ctx->in_block, ctx->blocksize_B);
- bcal_cipher_enc(tmp, &(ctx->cctx));
- memxor(block, tmp, ctx->size_B);
- memmove(ctx->in_block, ctx->in_block+ctx->size_B, ctx->blocksize_B - ctx->size_B);
- memcpy(ctx->in_block+ctx->blocksize_B-ctx->size_B, xblock, ctx->size_B);
+void bcal_cfb_B_decNext(void *block, bcal_cfb_B_ctx_t *ctx)
+{
+ uint8_t tmp[ctx->blocksize_B];
+ uint8_t xblock[ctx->size_B];
+ memcpy(xblock, block, ctx->size_B);
+ memcpy(tmp, ctx->in_block, ctx->blocksize_B);
+ bcal_cipher_enc(tmp, &(ctx->cctx));
+ memxor(block, tmp, ctx->size_B);
+ memmove(ctx->in_block, ctx->in_block + ctx->size_B, ctx->blocksize_B
+ - ctx->size_B);
+ memcpy(ctx->in_block + ctx->blocksize_B - ctx->size_B, xblock, ctx->size_B);
}
-void bcal_cfb_B_encMsg(const void *iv, void *msg, uint16_t msg_blocks, bcal_cfb_B_ctx_t *ctx){
- bcal_cfb_B_loadIV(iv, ctx);
- while(msg_blocks--){
- bcal_cfb_B_encNext(msg, ctx);
- msg = (uint8_t*)msg+ctx->size_B;
- }
+void bcal_cfb_B_encMsg(const void *iv, void *msg, uint16_t msg_blocks,
+ bcal_cfb_B_ctx_t *ctx)
+{
+ bcal_cfb_B_loadIV(iv, ctx);
+ while (msg_blocks--) {
+ bcal_cfb_B_encNext(msg, ctx);
+ msg = (uint8_t*) msg + ctx->size_B;
+ }
}
-void bcal_cfb_B_decMsg(const void *iv, void *msg, uint16_t msg_blocks, bcal_cfb_B_ctx_t *ctx){
- bcal_cfb_B_loadIV(iv, ctx);
- while(msg_blocks--){
- bcal_cfb_B_decNext(msg, ctx);
- msg = (uint8_t*)msg+ctx->size_B;
- }
+void bcal_cfb_B_decMsg(const void *iv, void *msg, uint16_t msg_blocks,
+ bcal_cfb_B_ctx_t *ctx)
+{
+ bcal_cfb_B_loadIV(iv, ctx);
+ while (msg_blocks--) {
+ bcal_cfb_B_decNext(msg, ctx);
+ msg = (uint8_t*) msg + ctx->size_B;
+ }
}
/* bcal-cbc.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef BCALCFB_BYTE_H_
#define BCALCFB_BYTE_H_
#include "bcal-basic.h"
#include "blockcipher_descriptor.h"
-
-typedef struct{
- bcdesc_t* desc;
- bcgen_ctx_t cctx;
- uint8_t* in_block;
- uint8_t blocksize_B;
- uint8_t size_B;
+typedef struct {
+ bcdesc_t* desc;
+ bcgen_ctx_t cctx;
+ uint8_t* in_block;
+ uint8_t blocksize_B;
+ uint8_t size_B;
} bcal_cfb_B_ctx_t;
-
-uint8_t bcal_cfb_B_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b, uint16_t size_b, bcal_cfb_B_ctx_t *ctx);
+uint8_t bcal_cfb_B_init(const bcdesc_t *desc, const void *key,
+ uint16_t keysize_b, uint16_t size_b, bcal_cfb_B_ctx_t *ctx);
void bcal_cfb_B_free(bcal_cfb_B_ctx_t *ctx);
void bcal_cfb_B_loadIV(const void *iv, bcal_cfb_B_ctx_t *ctx);
void bcal_cfb_B_encNext(void *block, bcal_cfb_B_ctx_t *ctx);
void bcal_cfb_B_decNext(void *block, bcal_cfb_B_ctx_t *ctx);
-void bcal_cfb_B_encMsg(const void *iv, void *msg, uint16_t msg_blocks, bcal_cfb_B_ctx_t *ctx);
-void bcal_cfb_B_decMsg(const void *iv, void *msg, uint16_t msg_blocks, bcal_cfb_B_ctx_t *ctx);
-
+void bcal_cfb_B_encMsg(const void *iv, void *msg, uint16_t msg_blocks,
+ bcal_cfb_B_ctx_t *ctx);
+void bcal_cfb_B_decMsg(const void *iv, void *msg, uint16_t msg_blocks,
+ bcal_cfb_B_ctx_t *ctx);
#endif /* BCALCFB_BYTE_H_ */
/* bcal-omac.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include <stdint.h>
#include <string.h>
#include "bcal-cmac.h"
#include "memxor.h"
-
-static uint8_t left_shift_be_block(void *block, uint8_t blocksize_B){
- uint8_t c1=0, c2;
- do{
- --blocksize_B;
- c2 = (((uint8_t*)block)[blocksize_B])>>7;
- (((uint8_t*)block)[blocksize_B]) <<= 1;
- (((uint8_t*)block)[blocksize_B]) |= c1;
- c1 = c2;
- }while(blocksize_B);
- return c1;
+static uint8_t left_shift_be_block(void *block, uint8_t blocksize_B)
+{
+ uint8_t c1 = 0, c2;
+ do {
+ --blocksize_B;
+ c2 = (((uint8_t*) block)[blocksize_B]) >> 7;
+ (((uint8_t*) block)[blocksize_B]) <<= 1;
+ (((uint8_t*) block)[blocksize_B]) |= c1;
+ c1 = c2;
+ } while (blocksize_B);
+ return c1;
}
static const uint8_t const_128 = 0x87;
-static const uint8_t const_64 = 0x1b;
+static const uint8_t const_64 = 0x1b;
-uint8_t bcal_cmac_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b, bcal_cmac_ctx_t *ctx){
- uint8_t r;
- ctx->desc = (bcdesc_t*)desc;
- ctx->blocksize_B = bcal_cipher_getBlocksize_b(desc)/8;
- if (ctx->blocksize_B!=128/8 && ctx->blocksize_B!=64/8){
- return 0x13;
- }
- ctx->accu = malloc(ctx->blocksize_B);
- if(ctx->accu==NULL){
- return 0x14;
- }
- ctx->k1 = malloc(ctx->blocksize_B);
- if(ctx->k1==NULL){
- return 0x15;
- }
- ctx->k2 = malloc(ctx->blocksize_B);
- if(ctx->k2==NULL){
- return 0x16;
- }
- ctx->lastblock = malloc(ctx->blocksize_B);
- if(ctx->lastblock==NULL){
- return 0x17;
- }
- r = bcal_cipher_init(desc, key, keysize_b, &(ctx->cctx));
- if(r){
- return r;
- }
- if(ctx->blocksize_B==128/8){
- r = const_128;
- }else{
- r = const_64;
- }
- /* subkey computation */
- memset(ctx->accu, 0x00, ctx->blocksize_B);
- memset(ctx->k1, 0x00, ctx->blocksize_B);
- bcal_cipher_enc(ctx->k1, &(ctx->cctx));
- if(left_shift_be_block(ctx->k1, ctx->blocksize_B)){
- ctx->k1[ctx->blocksize_B-1] ^= r;
- }
- memcpy(ctx->k2, ctx->k1, ctx->blocksize_B);
- if(left_shift_be_block(ctx->k2, ctx->blocksize_B)){
- ctx->k2[ctx->blocksize_B-1] ^= r;
- }
- ctx->last_set=0;
- return 0;
+uint8_t bcal_cmac_init(const bcdesc_t *desc, const void *key,
+ uint16_t keysize_b, bcal_cmac_ctx_t *ctx)
+{
+ uint8_t r;
+ ctx->desc = (bcdesc_t*) desc;
+ ctx->blocksize_B = bcal_cipher_getBlocksize_b(desc) / 8;
+ if (ctx->blocksize_B != 128 / 8 && ctx->blocksize_B != 64 / 8) {
+ return 0x13;
+ }
+ ctx->accu = malloc(ctx->blocksize_B);
+ if (ctx->accu == NULL) {
+ return 0x14;
+ }
+ ctx->k1 = malloc(ctx->blocksize_B);
+ if (ctx->k1 == NULL) {
+ return 0x15;
+ }
+ ctx->k2 = malloc(ctx->blocksize_B);
+ if (ctx->k2 == NULL) {
+ return 0x16;
+ }
+ ctx->lastblock = malloc(ctx->blocksize_B);
+ if (ctx->lastblock == NULL) {
+ return 0x17;
+ }
+ r = bcal_cipher_init(desc, key, keysize_b, &(ctx->cctx));
+ if (r) {
+ return r;
+ }
+ if (ctx->blocksize_B == 128 / 8) {
+ r = const_128;
+ } else {
+ r = const_64;
+ }
+ /* subkey computation */
+ memset(ctx->accu, 0x00, ctx->blocksize_B);
+ memset(ctx->k1, 0x00, ctx->blocksize_B);
+ bcal_cipher_enc(ctx->k1, &(ctx->cctx));
+ if (left_shift_be_block(ctx->k1, ctx->blocksize_B)) {
+ ctx->k1[ctx->blocksize_B - 1] ^= r;
+ }
+ memcpy(ctx->k2, ctx->k1, ctx->blocksize_B);
+ if (left_shift_be_block(ctx->k2, ctx->blocksize_B)) {
+ ctx->k2[ctx->blocksize_B - 1] ^= r;
+ }
+ ctx->last_set = 0;
+ return 0;
}
-void bcal_cmac_free(bcal_cmac_ctx_t *ctx){
- free(ctx->accu);
- free(ctx->k1);
- free(ctx->k2);
- bcal_cipher_free(&(ctx->cctx));
+void bcal_cmac_free(bcal_cmac_ctx_t *ctx)
+{
+ free(ctx->accu);
+ free(ctx->k1);
+ free(ctx->k2);
+ bcal_cipher_free(&(ctx->cctx));
}
-void bcal_cmac_nextBlock (bcal_cmac_ctx_t *ctx, const void *block){
- if(ctx->last_set){
- memxor(ctx->accu, ctx->lastblock, ctx->blocksize_B);
- bcal_cipher_enc(ctx->accu, &(ctx->cctx));
- }
- memcpy(ctx->lastblock, block, ctx->blocksize_B);
- ctx->last_set=1;
+void bcal_cmac_nextBlock(bcal_cmac_ctx_t *ctx, const void *block)
+{
+ if (ctx->last_set) {
+ memxor(ctx->accu, ctx->lastblock, ctx->blocksize_B);
+ bcal_cipher_enc(ctx->accu, &(ctx->cctx));
+ }
+ memcpy(ctx->lastblock, block, ctx->blocksize_B);
+ ctx->last_set = 1;
}
-
-void bcal_cmac_lastBlock(bcal_cmac_ctx_t *ctx, const void *block, uint16_t length_b){
- uint16_t blocksize_b;
- blocksize_b = ctx->blocksize_B*8;
- while(length_b>=blocksize_b){
- bcal_cmac_nextBlock(ctx, block);
- block = (uint8_t*)block + ctx->blocksize_B;
- length_b -= blocksize_b;
- }
- if(ctx->last_set==0){
- memxor(ctx->accu, block, (length_b+7)/8);
- memxor(ctx->accu, ctx->k2, ctx->blocksize_B);
- ctx->accu[length_b/8] ^= 0x80>>(length_b&7);
- }else{
- if(length_b==0){
- memxor(ctx->accu, ctx->lastblock, ctx->blocksize_B);
- memxor(ctx->accu, ctx->k1, ctx->blocksize_B);
- }else{
- memxor(ctx->accu, ctx->lastblock, ctx->blocksize_B);
- bcal_cipher_enc(ctx->accu, &(ctx->cctx));
- memxor(ctx->accu, block, (length_b+7)/8);
- memxor(ctx->accu, ctx->k2, ctx->blocksize_B);
- ctx->accu[length_b/8] ^= 0x80>>(length_b&7);
- }
- }
- bcal_cipher_enc(ctx->accu, &(ctx->cctx));
+void bcal_cmac_lastBlock(bcal_cmac_ctx_t *ctx, const void *block,
+ uint16_t length_b)
+{
+ uint16_t blocksize_b;
+ blocksize_b = ctx->blocksize_B * 8;
+ while (length_b >= blocksize_b) {
+ bcal_cmac_nextBlock(ctx, block);
+ block = (uint8_t*) block + ctx->blocksize_B;
+ length_b -= blocksize_b;
+ }
+ if (ctx->last_set == 0) {
+ memxor(ctx->accu, block, (length_b + 7) / 8);
+ memxor(ctx->accu, ctx->k2, ctx->blocksize_B);
+ ctx->accu[length_b / 8] ^= 0x80 >> (length_b & 7);
+ } else {
+ if (length_b == 0) {
+ memxor(ctx->accu, ctx->lastblock, ctx->blocksize_B);
+ memxor(ctx->accu, ctx->k1, ctx->blocksize_B);
+ } else {
+ memxor(ctx->accu, ctx->lastblock, ctx->blocksize_B);
+ bcal_cipher_enc(ctx->accu, &(ctx->cctx));
+ memxor(ctx->accu, block, (length_b + 7) / 8);
+ memxor(ctx->accu, ctx->k2, ctx->blocksize_B);
+ ctx->accu[length_b / 8] ^= 0x80 >> (length_b & 7);
+ }
+ }
+ bcal_cipher_enc(ctx->accu, &(ctx->cctx));
}
-void bcal_cmac_ctx2mac(void *dest, uint16_t length_b, const bcal_cmac_ctx_t *ctx){
- memcpy(dest, ctx->accu, length_b/8);
- if(length_b&7){
- ((uint8_t*)dest)[length_b/8] &= 0xff>>(length_b&7);
- ((uint8_t*)dest)[length_b/8] |= (0xff00>>(length_b&7))&(ctx->accu[length_b/8]);
- }
+void bcal_cmac_ctx2mac(void *dest, uint16_t length_b,
+ const bcal_cmac_ctx_t *ctx)
+{
+ memcpy(dest, ctx->accu, length_b / 8);
+ if (length_b & 7) {
+ ((uint8_t*) dest)[length_b / 8] &= 0xff >> (length_b & 7);
+ ((uint8_t*) dest)[length_b / 8] |= (0xff00 >> (length_b & 7))
+ & (ctx->accu[length_b / 8]);
+ }
}
-void bcal_cmac(void *dest, uint16_t out_length_b, const void *block, uint32_t length_b, bcal_cmac_ctx_t *ctx){
- uint16_t blocksize_b;
- blocksize_b = ctx->blocksize_B*8;
- while(length_b>blocksize_b){
- bcal_cmac_nextBlock(ctx, block);
- block = (uint8_t*)block + ctx->blocksize_B;
- length_b -= blocksize_b;
- }
- bcal_cmac_lastBlock(ctx, block, length_b);
- bcal_cmac_ctx2mac(dest, out_length_b, ctx);
+void bcal_cmac(void *dest, uint16_t out_length_b, const void *block,
+ uint32_t length_b, bcal_cmac_ctx_t *ctx)
+{
+ uint16_t blocksize_b;
+ blocksize_b = ctx->blocksize_B * 8;
+ while (length_b > blocksize_b) {
+ bcal_cmac_nextBlock(ctx, block);
+ block = (uint8_t*) block + ctx->blocksize_B;
+ length_b -= blocksize_b;
+ }
+ bcal_cmac_lastBlock(ctx, block, length_b);
+ bcal_cmac_ctx2mac(dest, out_length_b, ctx);
}
/* bcal-cmac.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef BCALCMAC_H_
#define BCALCMAC_H_
#include "bcal-basic.h"
#include "blockcipher_descriptor.h"
-typedef struct{
- bcdesc_t* desc;
- bcgen_ctx_t cctx;
- uint8_t* accu;
- uint8_t* k1;
- uint8_t* k2;
- uint8_t* lastblock;
- uint8_t last_set;
- uint8_t blocksize_B;
+typedef struct {
+ bcdesc_t* desc;
+ bcgen_ctx_t cctx;
+ uint8_t* accu;
+ uint8_t* k1;
+ uint8_t* k2;
+ uint8_t* lastblock;
+ uint8_t last_set;
+ uint8_t blocksize_B;
} bcal_cmac_ctx_t;
-uint8_t bcal_cmac_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b, bcal_cmac_ctx_t *ctx);
+uint8_t bcal_cmac_init(const bcdesc_t *desc, const void *key,
+ uint16_t keysize_b, bcal_cmac_ctx_t *ctx);
void bcal_cmac_free(bcal_cmac_ctx_t *ctx);
void bcal_cmac_nextBlock(bcal_cmac_ctx_t *ctx, const void *block);
-void bcal_cmac_lastBlock(bcal_cmac_ctx_t *ctx, const void *block, uint16_t length_b);
-void bcal_cmac_ctx2mac(void *dest, uint16_t length_b, const bcal_cmac_ctx_t *ctx);
-void bcal_cmac(void *dest, uint16_t out_length_b, const void *block, uint32_t length_b, bcal_cmac_ctx_t *ctx);
+void bcal_cmac_lastBlock(bcal_cmac_ctx_t *ctx, const void *block,
+ uint16_t length_b);
+void bcal_cmac_ctx2mac(void *dest, uint16_t length_b,
+ const bcal_cmac_ctx_t *ctx);
+void bcal_cmac(void *dest, uint16_t out_length_b, const void *block,
+ uint32_t length_b, bcal_cmac_ctx_t *ctx);
#endif /* BCALCMAC_H_ */
/* bcal-ctr.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include <stdint.h>
#include <string.h>
#include "bcal-ctr.h"
#include "memxor.h"
-static void increment_be(void *block, uint8_t size_B){
- uint16_t c=1;
- do{
- --size_B;
- c += ((uint8_t*)block)[size_B];
- ((uint8_t*)block)[size_B] = (uint8_t)c;
- c>>=8;
- }while(size_B);
+static void increment_be(void *block, uint8_t size_B)
+{
+ uint16_t c = 1;
+ do {
+ --size_B;
+ c += ((uint8_t*) block)[size_B];
+ ((uint8_t*) block)[size_B] = (uint8_t) c;
+ c >>= 8;
+ } while (size_B);
}
-uint8_t bcal_ctr_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b, inc_fp_t inc_func, bcal_ctr_ctx_t *ctx){
- ctx->desc = (bcdesc_t*)desc;
- if(inc_func){
- ctx->inc_func = inc_func;
- }else{
- ctx->inc_func = increment_be;
- }
- ctx->blocksize_B = (bcal_cipher_getBlocksize_b(desc)+7)/8;
- ctx->in_block=malloc(ctx->blocksize_B);
- if(ctx->in_block==NULL){
- return 0x11;
- }
- return bcal_cipher_init(desc, key, keysize_b, &(ctx->cctx));
+uint8_t bcal_ctr_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b,
+ inc_fp_t inc_func, bcal_ctr_ctx_t *ctx)
+{
+ ctx->desc = (bcdesc_t*) desc;
+ if (inc_func) {
+ ctx->inc_func = inc_func;
+ } else {
+ ctx->inc_func = increment_be;
+ }
+ ctx->blocksize_B = (bcal_cipher_getBlocksize_b(desc) + 7) / 8;
+ ctx->in_block = malloc(ctx->blocksize_B);
+ if (ctx->in_block == NULL) {
+ return 0x11;
+ }
+ return bcal_cipher_init(desc, key, keysize_b, &(ctx->cctx));
}
-void bcal_ctr_free(bcal_ctr_ctx_t *ctx){
- free(ctx->in_block);
- bcal_cipher_free(&(ctx->cctx));
+void bcal_ctr_free(bcal_ctr_ctx_t *ctx)
+{
+ free(ctx->in_block);
+ bcal_cipher_free(&(ctx->cctx));
}
-void bcal_ctr_loadIV(const void *iv, bcal_ctr_ctx_t *ctx){
- if(iv){
- memcpy(ctx->in_block, iv, ctx->blocksize_B);
- }
+void bcal_ctr_loadIV(const void *iv, bcal_ctr_ctx_t *ctx)
+{
+ if (iv) {
+ memcpy(ctx->in_block, iv, ctx->blocksize_B);
+ }
}
-void bcal_ctr_encNext(void *block, bcal_ctr_ctx_t *ctx){
- uint8_t tmp[ctx->blocksize_B];
- memcpy(tmp, ctx->in_block, ctx->blocksize_B);
- bcal_cipher_enc(tmp, &(ctx->cctx));
- memxor(block, tmp, ctx->blocksize_B);
- ctx->inc_func(ctx->in_block, ctx->blocksize_B);
+void bcal_ctr_encNext(void *block, bcal_ctr_ctx_t *ctx)
+{
+ uint8_t tmp[ctx->blocksize_B];
+ memcpy(tmp, ctx->in_block, ctx->blocksize_B);
+ bcal_cipher_enc(tmp, &(ctx->cctx));
+ memxor(block, tmp, ctx->blocksize_B);
+ ctx->inc_func(ctx->in_block, ctx->blocksize_B);
}
-void bcal_ctr_decNext(void *block, bcal_ctr_ctx_t *ctx){
- bcal_ctr_encNext(block, ctx);
+void bcal_ctr_decNext(void *block, bcal_ctr_ctx_t *ctx)
+{
+ bcal_ctr_encNext(block, ctx);
}
-void bcal_ctr_encMsg(const void *iv, void *msg, uint32_t msg_len_b, bcal_ctr_ctx_t *ctx){
- bcal_ctr_loadIV(iv, ctx);
- uint16_t blocksize_b;
- blocksize_b = ctx->blocksize_B*8;
- while(msg_len_b>blocksize_b){
- bcal_ctr_encNext(msg, ctx);
- msg_len_b -= blocksize_b;
- msg = (uint8_t*)msg + ctx->blocksize_B;
- }
- uint8_t tmp[ctx->blocksize_B];
- memcpy(tmp, ctx->in_block, ctx->blocksize_B);
- bcal_cipher_enc(tmp, &(ctx->cctx));
- ctx->inc_func(ctx->in_block, ctx->blocksize_B);
- tmp[msg_len_b/8] = 0xff00>>(msg_len_b&7);
- memxor(msg, tmp, (msg_len_b+7)/8);
+void bcal_ctr_encMsg(const void *iv, void *msg, uint32_t msg_len_b,
+ bcal_ctr_ctx_t *ctx)
+{
+ bcal_ctr_loadIV(iv, ctx);
+ uint16_t blocksize_b;
+ blocksize_b = ctx->blocksize_B * 8;
+ while (msg_len_b > blocksize_b) {
+ bcal_ctr_encNext(msg, ctx);
+ msg_len_b -= blocksize_b;
+ msg = (uint8_t*) msg + ctx->blocksize_B;
+ }
+ uint8_t tmp[ctx->blocksize_B];
+ memcpy(tmp, ctx->in_block, ctx->blocksize_B);
+ bcal_cipher_enc(tmp, &(ctx->cctx));
+ ctx->inc_func(ctx->in_block, ctx->blocksize_B);
+ tmp[msg_len_b / 8] = 0xff00 >> (msg_len_b & 7);
+ memxor(msg, tmp, (msg_len_b + 7) / 8);
}
-void bcal_ctr_decMsg(const void *iv, void *msg, uint32_t msg_len_b, bcal_ctr_ctx_t *ctx){
- bcal_ctr_encMsg(iv, msg, msg_len_b, ctx);
+void bcal_ctr_decMsg(const void *iv, void *msg, uint32_t msg_len_b,
+ bcal_ctr_ctx_t *ctx)
+{
+ bcal_ctr_encMsg(iv, msg, msg_len_b, ctx);
}
/* bcal-ctr.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef BCALCTR_H_
#define BCALCTR_H_
#include "bcal-basic.h"
#include "blockcipher_descriptor.h"
-typedef void(*inc_fp_t)(void *block, uint8_t size_B);
+typedef void (*inc_fp_t)(void *block, uint8_t size_B);
-typedef struct{
- bcdesc_t* desc;
- bcgen_ctx_t cctx;
- uint8_t* in_block;
- inc_fp_t inc_func;
- uint8_t blocksize_B;
+typedef struct {
+ bcdesc_t* desc;
+ bcgen_ctx_t cctx;
+ uint8_t* in_block;
+ inc_fp_t inc_func;
+ uint8_t blocksize_B;
} bcal_ctr_ctx_t;
-uint8_t bcal_ctr_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b, inc_fp_t inc_func, bcal_ctr_ctx_t *ctx);
+uint8_t bcal_ctr_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b,
+ inc_fp_t inc_func, bcal_ctr_ctx_t *ctx);
void bcal_ctr_free(bcal_ctr_ctx_t *ctx);
void bcal_ctr_loadIV(const void *iv, bcal_ctr_ctx_t *ctx);
void bcal_ctr_encNext(void *block, bcal_ctr_ctx_t *ctx);
void bcal_ctr_decNext(void *block, bcal_ctr_ctx_t *ctx);
-void bcal_ctr_encMsg(const void *iv, void *msg, uint32_t msg_len_b, bcal_ctr_ctx_t *ctx);
-void bcal_ctr_decMsg(const void *iv, void *msg, uint32_t msg_len_b, bcal_ctr_ctx_t *ctx);
+void bcal_ctr_encMsg(const void *iv, void *msg, uint32_t msg_len_b,
+ bcal_ctr_ctx_t *ctx);
+void bcal_ctr_decMsg(const void *iv, void *msg, uint32_t msg_len_b,
+ bcal_ctr_ctx_t *ctx);
#endif /* BCALCTR_H_ */
/* bca-eax.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include <stdint.h>
#include "bcal-basic.h"
#include "bcal-eax.h"
#include "memxor.h"
-uint8_t bcal_eax_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b, bcal_eax_ctx_t *ctx){
- uint8_t r;
- ctx->blocksize_B = (bcal_cipher_getBlocksize_b(desc)+7)/8;
- ctx->nonce = malloc(ctx->blocksize_B);
- if(ctx->nonce==NULL){
- return 0x81;
- }
- r = bcal_cmac_init(desc, key, keysize_b, &(ctx->ctag));
- if(r){
- return r;
- }
- r = bcal_cmac_init(desc, key, keysize_b, &(ctx->htag));
- if(r){
- return (r|0x10);
- }
- r = bcal_cmac_init(desc, key, keysize_b, &(ctx->ntag));
- if(r){
- return (r|0x20);
- }
- r = bcal_ctr_init(desc, key, keysize_b, NULL, &(ctx->cipher));
- if(r){
- return (r|0x30);
- }
- ctx->header_set=0;
- uint8_t tmp[ctx->blocksize_B];
- memset(tmp, 0, ctx->blocksize_B);
- bcal_cmac_nextBlock(&(ctx->ntag), tmp);
- tmp[ctx->blocksize_B-1]=1;
- bcal_cmac_nextBlock(&(ctx->htag), tmp);
- tmp[ctx->blocksize_B-1]=2;
- bcal_cmac_nextBlock(&(ctx->ctag), tmp);
- return 0;
+uint8_t bcal_eax_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b,
+ bcal_eax_ctx_t *ctx)
+{
+ uint8_t r;
+ ctx->blocksize_B = (bcal_cipher_getBlocksize_b(desc) + 7) / 8;
+ ctx->nonce = malloc(ctx->blocksize_B);
+ if (ctx->nonce == NULL) {
+ return 0x81;
+ }
+ r = bcal_cmac_init(desc, key, keysize_b, &(ctx->ctag));
+ if (r) {
+ return r;
+ }
+ r = bcal_cmac_init(desc, key, keysize_b, &(ctx->htag));
+ if (r) {
+ return (r | 0x10);
+ }
+ r = bcal_cmac_init(desc, key, keysize_b, &(ctx->ntag));
+ if (r) {
+ return (r | 0x20);
+ }
+ r = bcal_ctr_init(desc, key, keysize_b, NULL, &(ctx->cipher));
+ if (r) {
+ return (r | 0x30);
+ }
+ ctx->header_set = 0;
+ uint8_t tmp[ctx->blocksize_B];
+ memset(tmp, 0, ctx->blocksize_B);
+ bcal_cmac_nextBlock(&(ctx->ntag), tmp);
+ tmp[ctx->blocksize_B - 1] = 1;
+ bcal_cmac_nextBlock(&(ctx->htag), tmp);
+ tmp[ctx->blocksize_B - 1] = 2;
+ bcal_cmac_nextBlock(&(ctx->ctag), tmp);
+ return 0;
}
-void bcal_eax_free(bcal_eax_ctx_t *ctx){
- bcal_ctr_free(&(ctx->cipher));
- bcal_cmac_free(&(ctx->ctag));
- bcal_cmac_free(&(ctx->htag));
- bcal_cmac_free(&(ctx->ntag));
- free(ctx->nonce);
+void bcal_eax_free(bcal_eax_ctx_t *ctx)
+{
+ bcal_ctr_free(&(ctx->cipher));
+ bcal_cmac_free(&(ctx->ctag));
+ bcal_cmac_free(&(ctx->htag));
+ bcal_cmac_free(&(ctx->ntag));
+ free(ctx->nonce);
}
-void bcal_eax_loadNonce(const void *nonce, uint16_t length_b, bcal_eax_ctx_t *ctx){
- bcal_cmac_lastBlock(&(ctx->ntag), nonce, length_b);
- bcal_cmac_ctx2mac(ctx->nonce, ctx->blocksize_B*8, &(ctx->ntag));
- bcal_ctr_loadIV(ctx->nonce, &(ctx->cipher));
+void bcal_eax_loadNonce(const void *nonce, uint16_t length_b,
+ bcal_eax_ctx_t *ctx)
+{
+ bcal_cmac_lastBlock(&(ctx->ntag), nonce, length_b);
+ bcal_cmac_ctx2mac(ctx->nonce, ctx->blocksize_B * 8, &(ctx->ntag));
+ bcal_ctr_loadIV(ctx->nonce, &(ctx->cipher));
}
-void bcal_eax_addNextHeader(const void *header, bcal_eax_ctx_t *ctx){
- bcal_cmac_nextBlock(&(ctx->htag), header);
+void bcal_eax_addNextHeader(const void *header, bcal_eax_ctx_t *ctx)
+{
+ bcal_cmac_nextBlock(&(ctx->htag), header);
}
-void bcal_eax_addLastHeader(const void *header, uint16_t length_b, bcal_eax_ctx_t *ctx){
- bcal_cmac_lastBlock(&(ctx->htag), header, length_b);
- ctx->header_set = 1;
+void bcal_eax_addLastHeader(const void *header, uint16_t length_b,
+ bcal_eax_ctx_t *ctx)
+{
+ bcal_cmac_lastBlock(&(ctx->htag), header, length_b);
+ ctx->header_set = 1;
}
-void bcal_eax_encNextBlock(void *block, bcal_eax_ctx_t *ctx){
- bcal_ctr_encNext(block, &(ctx->cipher));
- bcal_cmac_nextBlock(&(ctx->ctag), block);
+void bcal_eax_encNextBlock(void *block, bcal_eax_ctx_t *ctx)
+{
+ bcal_ctr_encNext(block, &(ctx->cipher));
+ bcal_cmac_nextBlock(&(ctx->ctag), block);
}
-void bcal_eax_encLastBlock(void *block, uint16_t length_b, bcal_eax_ctx_t *ctx){
- bcal_ctr_encMsg(NULL, block, length_b, &(ctx->cipher));
- bcal_cmac_lastBlock(&(ctx->ctag), block, length_b);
+void bcal_eax_encLastBlock(void *block, uint16_t length_b, bcal_eax_ctx_t *ctx)
+{
+ bcal_ctr_encMsg(NULL, block, length_b, &(ctx->cipher));
+ bcal_cmac_lastBlock(&(ctx->ctag), block, length_b);
}
-void bcal_eax_decNextBlock(void *block, bcal_eax_ctx_t *ctx){
- bcal_cmac_nextBlock(&(ctx->ctag), block);
- bcal_ctr_decNext(block, &(ctx->cipher));
+void bcal_eax_decNextBlock(void *block, bcal_eax_ctx_t *ctx)
+{
+ bcal_cmac_nextBlock(&(ctx->ctag), block);
+ bcal_ctr_decNext(block, &(ctx->cipher));
}
-void bcal_eax_decLastBlock(void *block, uint16_t length_b, bcal_eax_ctx_t *ctx){
- bcal_cmac_lastBlock(&(ctx->ctag), block, length_b);
- bcal_ctr_decMsg(NULL, block, length_b, &(ctx->cipher));
+void bcal_eax_decLastBlock(void *block, uint16_t length_b, bcal_eax_ctx_t *ctx)
+{
+ bcal_cmac_lastBlock(&(ctx->ctag), block, length_b);
+ bcal_ctr_decMsg(NULL, block, length_b, &(ctx->cipher));
}
-void bcal_eax_ctx2tag(void *dest, uint16_t length_b, bcal_eax_ctx_t *ctx){
- uint8_t tmp[ctx->blocksize_B];
- if(ctx->header_set==0){
- bcal_cmac_lastBlock(&(ctx->htag), NULL, 0);
- }
+void bcal_eax_ctx2tag(void *dest, uint16_t length_b, bcal_eax_ctx_t *ctx)
+{
+ uint8_t tmp[ctx->blocksize_B];
+ if (ctx->header_set == 0) {
+ bcal_cmac_lastBlock(&(ctx->htag), NULL, 0);
+ }
- bcal_cmac_ctx2mac(tmp, ctx->blocksize_B*8, &(ctx->htag));
- memxor(ctx->nonce, tmp, ctx->blocksize_B);
+ bcal_cmac_ctx2mac(tmp, ctx->blocksize_B * 8, &(ctx->htag));
+ memxor(ctx->nonce, tmp, ctx->blocksize_B);
- bcal_cmac_ctx2mac(tmp, ctx->blocksize_B*8, &(ctx->ctag));
- memxor(ctx->nonce, tmp, ctx->blocksize_B);
- memcpy(dest, ctx->nonce, (length_b+7)/8);
+ bcal_cmac_ctx2mac(tmp, ctx->blocksize_B * 8, &(ctx->ctag));
+ memxor(ctx->nonce, tmp, ctx->blocksize_B);
+ memcpy(dest, ctx->nonce, (length_b + 7) / 8);
}
/* bcal-eax.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef BCALEAX_H_
#define BCALEAX_H_
#include "bcal-cmac.h"
#include "bcal-ctr.h"
-typedef struct{
- uint8_t* nonce;
- bcal_cmac_ctx_t ntag;
- bcal_cmac_ctx_t ctag;
- bcal_cmac_ctx_t htag;
- bcal_ctr_ctx_t cipher;
- uint8_t blocksize_B;
- uint8_t header_set;
+typedef struct {
+ uint8_t* nonce;
+ bcal_cmac_ctx_t ntag;
+ bcal_cmac_ctx_t ctag;
+ bcal_cmac_ctx_t htag;
+ bcal_ctr_ctx_t cipher;
+ uint8_t blocksize_B;
+ uint8_t header_set;
} bcal_eax_ctx_t;
-uint8_t bcal_eax_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b, bcal_eax_ctx_t *ctx);
+uint8_t bcal_eax_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b,
+ bcal_eax_ctx_t *ctx);
void bcal_eax_free(bcal_eax_ctx_t *ctx);
-void bcal_eax_loadNonce(const void *nonce, uint16_t length_b, bcal_eax_ctx_t *ctx);
+void bcal_eax_loadNonce(const void *nonce, uint16_t length_b,
+ bcal_eax_ctx_t *ctx);
void bcal_eax_addNextHeader(const void *header, bcal_eax_ctx_t *ctx);
-void bcal_eax_addLastHeader(const void *header, uint16_t length_b, bcal_eax_ctx_t *ctx);
+void bcal_eax_addLastHeader(const void *header, uint16_t length_b,
+ bcal_eax_ctx_t *ctx);
void bcal_eax_encNextBlock(void *block, bcal_eax_ctx_t *ctx);
void bcal_eax_encLastBlock(void *block, uint16_t length_b, bcal_eax_ctx_t *ctx);
void bcal_eax_decNextBlock(void *block, bcal_eax_ctx_t *ctx);
/* bcal-nessie.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include "nessie_bc_test.h"
#include "blockcipher_descriptor.h"
#include <string.h>
#include <avr/pgmspace.h>
+void (*bcal_nessie_dummy_init_fpt)(const void *key, void *ctx) = NULL;
-void(*bcal_nessie_dummy_init_fpt)(const void *key, void *ctx)=NULL;
-
-void bcal_nessie_dummy_init(const void *key, uint16_t keysize, void *ctx){
- if(bcal_nessie_dummy_init_fpt){
- bcal_nessie_dummy_init_fpt(key, ctx);
- }else{
- memcpy(ctx, key, (keysize+7)/8);
- }
+void bcal_nessie_dummy_init(const void *key, uint16_t keysize, void *ctx)
+{
+ if (bcal_nessie_dummy_init_fpt) {
+ bcal_nessie_dummy_init_fpt(key, ctx);
+ } else {
+ memcpy(ctx, key, (keysize + 7) / 8);
+ }
}
-void bcal_nessie(const bcdesc_t *bcd){
- if(pgm_read_byte(&(bcd->type))!=BCDESC_TYPE_BLOCKCIPHER)
- return;
- char name[1+strlen_P((void*)pgm_read_word(&(bcd->name)))];
- strcpy_P(name, (void*)pgm_read_word(&(bcd->name)));
- nessie_bc_init();
+void bcal_nessie(const bcdesc_t *bcd)
+{
+ if (pgm_read_byte(&(bcd->type)) != BCDESC_TYPE_BLOCKCIPHER)
+ return;
+ char name[1 + strlen_P((void*) pgm_read_word(&(bcd->name)))];
+ strcpy_P(name, (void*) pgm_read_word(&(bcd->name)));
+ nessie_bc_init();
- nessie_bc_ctx.blocksize_B = (pgm_read_word(&(bcd->blocksize_b))+7)/8;
- nessie_bc_ctx.name = name;
- nessie_bc_ctx.ctx_size_B = pgm_read_word(&(bcd->ctxsize_B));
- nessie_bc_ctx.cipher_enc = (nessie_bc_enc_fpt)pgm_read_word(&(bcd->enc));
- nessie_bc_ctx.cipher_dec = (nessie_bc_dec_fpt)pgm_read_word(&(bcd->dec));
- nessie_bc_ctx.cipher_free = (nessie_bc_free_fpt)pgm_read_word(&(bcd->free));
- if((pgm_read_byte(&(bcd->flags))&BC_INIT_TYPE)==BC_INIT_TYPE_2){
- nessie_bc_ctx.cipher_genctx = (nessie_bc_gen_fpt)pgm_read_word(&(bcd->init));
- }else{
- bcal_nessie_dummy_init_fpt = (void(*)(const void*,void*))pgm_read_word(&(bcd->init));
- nessie_bc_ctx.cipher_genctx = (nessie_bc_gen_fpt)bcal_nessie_dummy_init;
- }
+ nessie_bc_ctx.blocksize_B = (pgm_read_word(&(bcd->blocksize_b)) + 7) / 8;
+ nessie_bc_ctx.name = name;
+ nessie_bc_ctx.ctx_size_B = pgm_read_word(&(bcd->ctxsize_B));
+ nessie_bc_ctx.cipher_enc = (nessie_bc_enc_fpt) pgm_read_word(&(bcd->enc));
+ nessie_bc_ctx.cipher_dec = (nessie_bc_dec_fpt) pgm_read_word(&(bcd->dec));
+ nessie_bc_ctx.cipher_free =
+ (nessie_bc_free_fpt) pgm_read_word(&(bcd->free));
+ if ((pgm_read_byte(&(bcd->flags)) & BC_INIT_TYPE) == BC_INIT_TYPE_2) {
+ nessie_bc_ctx.cipher_genctx =
+ (nessie_bc_gen_fpt) pgm_read_word(&(bcd->init));
+ } else {
+ bcal_nessie_dummy_init_fpt =
+ (void (*)(const void*, void*)) pgm_read_word(&(bcd->init));
+ nessie_bc_ctx.cipher_genctx =
+ (nessie_bc_gen_fpt) bcal_nessie_dummy_init;
+ }
- uint16_t *keysize_list=NULL;
- uint16_t items,i;
- items = get_keysizes((PGM_VOID_P)pgm_read_word(&(bcd->valid_keysize_desc)), &keysize_list);
- if(items){
- for(i=0; i<items; ++i){
- nessie_bc_ctx.keysize_b = keysize_list[i];
- nessie_bc_run();
- }
- free(keysize_list);
- }
+ uint16_t *keysize_list = NULL;
+ uint16_t items, i;
+ items =
+ get_keysizes((PGM_VOID_P) pgm_read_word(&(bcd->valid_keysize_desc)), &keysize_list);
+ if (items) {
+ for (i = 0; i < items; ++i) {
+ nessie_bc_ctx.keysize_b = keysize_list[i];
+ nessie_bc_run();
+ }
+ free(keysize_list);
+ }
}
-void bcal_nessie_multiple(const bcdesc_t *const *bcd_list){
- const bcdesc_t *bcd;
- for(;;){
- bcd = (void*)pgm_read_word(bcd_list);
- if(!bcd)
- return;
- bcal_nessie(bcd);
- bcd_list = (void*)((uint8_t*)bcd_list + 2);
- }
+void bcal_nessie_multiple(const bcdesc_t * const *bcd_list)
+{
+ const bcdesc_t *bcd;
+ for (;;) {
+ bcd = (void*) pgm_read_word(bcd_list);
+ if (!bcd)
+ return;
+ bcal_nessie(bcd);
+ bcd_list = (void*) ((uint8_t*) bcd_list + 2);
+ }
}
/* bcal-nessie.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/*
* \file bcal-nessie.h
* \author Daniel Otte
#include "blockcipher_descriptor.h"
void bcal_nessie(const bcdesc_t *bcd);
-void bcal_nessie_multiple(const bcdesc_t *const *bcd_list);
-
+void bcal_nessie_multiple(const bcdesc_t * const *bcd_list);
#endif /* BCALNESSIE_H_ */
/* bcal-ofb.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include <stdint.h>
#include <string.h>
#include "bcal-basic.h"
#include "memxor.h"
-
-uint8_t bcal_ofb_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b, bcal_ofb_ctx_t *ctx){
- ctx->desc = (bcdesc_t*)desc;
- ctx->blocksize_B = (bcal_cipher_getBlocksize_b(desc)+7)/8;
- ctx->in_block=malloc(ctx->blocksize_B);
- if(ctx->in_block==NULL){
- return 0x11;
- }
- return bcal_cipher_init(desc, key, keysize_b, &(ctx->cctx));
+uint8_t bcal_ofb_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b,
+ bcal_ofb_ctx_t *ctx)
+{
+ ctx->desc = (bcdesc_t*) desc;
+ ctx->blocksize_B = (bcal_cipher_getBlocksize_b(desc) + 7) / 8;
+ ctx->in_block = malloc(ctx->blocksize_B);
+ if (ctx->in_block == NULL) {
+ return 0x11;
+ }
+ return bcal_cipher_init(desc, key, keysize_b, &(ctx->cctx));
}
-void bcal_ofb_free(bcal_ofb_ctx_t *ctx){
- free(ctx->in_block);
- bcal_cipher_free(&(ctx->cctx));
+void bcal_ofb_free(bcal_ofb_ctx_t *ctx)
+{
+ free(ctx->in_block);
+ bcal_cipher_free(&(ctx->cctx));
}
-void bcal_ofb_loadIV(const void *iv, bcal_ofb_ctx_t *ctx){
- if(iv){
- memcpy(ctx->in_block, iv, ctx->blocksize_B);
- }
+void bcal_ofb_loadIV(const void *iv, bcal_ofb_ctx_t *ctx)
+{
+ if (iv) {
+ memcpy(ctx->in_block, iv, ctx->blocksize_B);
+ }
}
-void bcal_ofb_encNext(void *block, bcal_ofb_ctx_t *ctx){
- bcal_cipher_enc(ctx->in_block , &(ctx->cctx));
- memxor(block, ctx->in_block, ctx->blocksize_B);
+void bcal_ofb_encNext(void *block, bcal_ofb_ctx_t *ctx)
+{
+ bcal_cipher_enc(ctx->in_block, &(ctx->cctx));
+ memxor(block, ctx->in_block, ctx->blocksize_B);
}
-void bcal_ofb_decNext(void *block, bcal_ofb_ctx_t *ctx){
- bcal_cipher_enc(ctx->in_block , &(ctx->cctx));
- memxor(block, ctx->in_block, ctx->blocksize_B);
+void bcal_ofb_decNext(void *block, bcal_ofb_ctx_t *ctx)
+{
+ bcal_cipher_enc(ctx->in_block, &(ctx->cctx));
+ memxor(block, ctx->in_block, ctx->blocksize_B);
}
-
-void bcal_ofb_encMsg(const void *iv, void *msg, uint32_t msg_len_b, bcal_ofb_ctx_t *ctx){
- uint16_t block_len_b;
- block_len_b = ctx->blocksize_B*8;
- bcal_ofb_loadIV(iv, ctx);
- while(msg_len_b>block_len_b){
- bcal_ofb_encNext(msg, ctx);
- msg_len_b -= block_len_b;
- msg = (uint8_t*)msg + ctx->blocksize_B;
- }
- bcal_cipher_enc(ctx->in_block, &(ctx->cctx));
- ctx->in_block[msg_len_b/8] = 0xff00>>(msg_len_b&7);
- memxor(msg, ctx->in_block, (msg_len_b+7)/8);
+void bcal_ofb_encMsg(const void *iv, void *msg, uint32_t msg_len_b,
+ bcal_ofb_ctx_t *ctx)
+{
+ uint16_t block_len_b;
+ block_len_b = ctx->blocksize_B * 8;
+ bcal_ofb_loadIV(iv, ctx);
+ while (msg_len_b > block_len_b) {
+ bcal_ofb_encNext(msg, ctx);
+ msg_len_b -= block_len_b;
+ msg = (uint8_t*) msg + ctx->blocksize_B;
+ }
+ bcal_cipher_enc(ctx->in_block, &(ctx->cctx));
+ ctx->in_block[msg_len_b / 8] = 0xff00 >> (msg_len_b & 7);
+ memxor(msg, ctx->in_block, (msg_len_b + 7) / 8);
}
-void bcal_ofb_decMsg(const void *iv, void *msg, uint32_t msg_len_b, bcal_ofb_ctx_t *ctx){
- bcal_ofb_encMsg(iv, msg, msg_len_b, ctx);
+void bcal_ofb_decMsg(const void *iv, void *msg, uint32_t msg_len_b,
+ bcal_ofb_ctx_t *ctx)
+{
+ bcal_ofb_encMsg(iv, msg, msg_len_b, ctx);
}
/* bcal-ofb.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef BCALOFB_H_
#define BCALOFB_H_
#include "bcal-basic.h"
#include "blockcipher_descriptor.h"
-
-typedef struct{
- bcdesc_t* desc;
- bcgen_ctx_t cctx;
- uint8_t* in_block;
- uint8_t blocksize_B;
+typedef struct {
+ bcdesc_t* desc;
+ bcgen_ctx_t cctx;
+ uint8_t* in_block;
+ uint8_t blocksize_B;
} bcal_ofb_ctx_t;
-
-uint8_t bcal_ofb_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b, bcal_ofb_ctx_t *ctx);
+uint8_t bcal_ofb_init(const bcdesc_t *desc, const void *key, uint16_t keysize_b,
+ bcal_ofb_ctx_t *ctx);
void bcal_ofb_free(bcal_ofb_ctx_t *ctx);
void bcal_ofb_loadIV(const void *iv, bcal_ofb_ctx_t *ctx);
void bcal_ofb_encNext(void *block, bcal_ofb_ctx_t *ctx);
void bcal_ofb_decNext(void *block, bcal_ofb_ctx_t *ctx);
-void bcal_ofb_encMsg(const void *iv, void *msg, uint32_t msg_len_b, bcal_ofb_ctx_t *ctx);
-void bcal_ofb_decMsg(const void *iv, void *msg, uint32_t msg_len_b, bcal_ofb_ctx_t *ctx);
-
+void bcal_ofb_encMsg(const void *iv, void *msg, uint32_t msg_len_b,
+ bcal_ofb_ctx_t *ctx);
+void bcal_ofb_decMsg(const void *iv, void *msg, uint32_t msg_len_b,
+ bcal_ofb_ctx_t *ctx);
#endif /* BCALOFB_H_ */
/* bcal-performance.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/*
* \file bcal-performance.c
#define PATTERN_B 0x55
/*
-static
-void printvalue(unsigned long v){
- char str[20];
- int i;
- ultoa(v, str, 10);
- for(i = 0; i < 10 - strlen(str); ++i){
- cli_putc(' ');
- }
- cli_putstr(str);
-}
-*/
-
-void bcal_performance(const bcdesc_t *bcd){
- bcdesc_t bc;
- memcpy_P(&bc, bcd, sizeof(bcdesc_t));
- uint8_t ctx[bc.ctxsize_B];
- uint8_t data[(bc.blocksize_b + 7) / 8];
- uint16_t keysize = get_keysize(bc.valid_keysize_desc);
- uint8_t key[(keysize + 7) / 8];
- uint64_t t;
- uint8_t i;
-
- if(bc.type != BCDESC_TYPE_BLOCKCIPHER)
- return;
- calibrateTimer();
- print_overhead();
- printf_P(PSTR("\n\n === %S performance === \n"
- "\ttype: blockcipher\n"
- "\tkeysize (bits): %5"PRIu16"\n"
- "\tctxsize (bytes): %5"PRIu16"\n"
- "\tblocksize (bits): %5"PRIu16"\n"),
- bc.name, keysize, bc.ctxsize_B, bc.blocksize_b);
- uart0_flush();
- t = 0;
- if(bc.init.init1){
- if((bc.flags & BC_INIT_TYPE) == BC_INIT_TYPE_1){
- for(i = 0; i < 32; ++i){
- startTimer(1);
- START_TIMER;
- (bc.init.init1)(key, &ctx);
- STOP_TIMER;
- t += stopTimer();
- if(i!=31 && bc.free){
- bc.free(&ctx);
- }
- }
- } else {
- for(i = 0; i < 32; ++i){
- startTimer(1);
- START_TIMER;
- (bc.init.init2)(key, keysize, &ctx);
- STOP_TIMER;
- t += stopTimer();
- if(i!=31 && bc.free){
- bc.free(&ctx);
- }
- }
- }
- t >>= 5;
- printf_P(PSTR(" init (cycles): %5"PRIu16"\n"), t);
- }
+ static
+ void printvalue(unsigned long v){
+ char str[20];
+ int i;
+ ultoa(v, str, 10);
+ for(i = 0; i < 10 - strlen(str); ++i){
+ cli_putc(' ');
+ }
+ cli_putstr(str);
+ }
+ */
+
+void bcal_performance(const bcdesc_t *bcd)
+{
+ bcdesc_t bc;
+ memcpy_P(&bc, bcd, sizeof(bcdesc_t));
+ uint8_t ctx[bc.ctxsize_B];
+ uint8_t data[(bc.blocksize_b + 7) / 8];
+ uint16_t keysize = get_keysize(bc.valid_keysize_desc);
+ uint8_t key[(keysize + 7) / 8];
+ uint64_t t;
+ uint8_t i;
+
+ if (bc.type != BCDESC_TYPE_BLOCKCIPHER)
+ return;
+ calibrateTimer();
+ print_overhead();
+ printf_P(PSTR("\n\n === %S performance === \n"
+ "\ttype: blockcipher\n"
+ "\tkeysize (bits): %5"PRIu16"\n"
+ "\tctxsize (bytes): %5"PRIu16"\n"
+ "\tblocksize (bits): %5"PRIu16"\n"),
+ bc.name, keysize, bc.ctxsize_B, bc.blocksize_b);
+ uart0_flush();
+ t = 0;
+ if (bc.init.init1) {
+ if ((bc.flags & BC_INIT_TYPE) == BC_INIT_TYPE_1) {
+ for (i = 0; i < 32; ++i) {
+ startTimer(1);
+ START_TIMER;
+ (bc.init.init1)(key, &ctx);
+ STOP_TIMER;
+ t += stopTimer();
+ if (i != 31 && bc.free) {
+ bc.free(&ctx);
+ }
+ }
+ } else {
+ for (i = 0; i < 32; ++i) {
+ startTimer(1);
+ START_TIMER;
+ (bc.init.init2)(key, keysize, &ctx);
+ STOP_TIMER;
+ t += stopTimer();
+ if (i != 31 && bc.free) {
+ bc.free(&ctx);
+ }
+ }
+ }
+ t >>= 5;
+ printf_P(PSTR(" init (cycles): %5"PRIu16"\n"), t);
+ }
uart0_flush();
- t = 0;
- for(i = 0; i < 32; ++i){
- startTimer(0);
- START_TIMER;
- bc.enc.enc1(data, &ctx);
- STOP_TIMER;
- t += stopTimer();
- }
- t >>= 5;
- printf_P(PSTR(" encrypt (cycles): %5"PRIu16"\n"), t);
+ t = 0;
+ for (i = 0; i < 32; ++i) {
+ startTimer(0);
+ START_TIMER;
+ bc.enc.enc1(data, &ctx);
+ STOP_TIMER;
+ t += stopTimer();
+ }
+ t >>= 5;
+ printf_P(PSTR(" encrypt (cycles): %5"PRIu16"\n"), t);
uart0_flush();
- t = 0;
- for(i = 0; i < 32; ++i){
- startTimer(0);
- START_TIMER;
- bc.dec.dec1(data, &ctx);
- STOP_TIMER;
- t += stopTimer();
- }
- t >>= 5;
- printf_P(PSTR(" decrypt (cycles): %5"PRIu16"\n"), t);
+ t = 0;
+ for (i = 0; i < 32; ++i) {
+ startTimer(0);
+ START_TIMER;
+ bc.dec.dec1(data, &ctx);
+ STOP_TIMER;
+ t += stopTimer();
+ }
+ t >>= 5;
+ printf_P(PSTR(" decrypt (cycles): %5"PRIu16"\n"), t);
uart0_flush();
- if(bc.free){
- uart0_flush();
- bc.free(&ctx);
- }
+ if (bc.free) {
+ uart0_flush();
+ bc.free(&ctx);
+ }
}
-void bcal_stacksize(const bcdesc_t *bcd){
- bcdesc_t bc;
- stack_measuring_ctx_t smctx;
- memcpy_P(&bc, bcd, sizeof(bcdesc_t));
- uint8_t ctx[bc.ctxsize_B];
- uint8_t data[(bc.blocksize_b + 7) / 8];
- uint16_t keysize = get_keysize(bc.valid_keysize_desc);
- uint8_t key[(keysize + 7)/8];
- uint16_t t1 = 0, t2 = 0;
-
- if(bc.type != BCDESC_TYPE_BLOCKCIPHER)
- return;
- printf_P(PSTR("\n === %S stack-usage ===\n"),bc.name);
-
- uart0_flush();
-
- if(bc.init.init1){
- if((bc.flags & BC_INIT_TYPE) == BC_INIT_TYPE_1){
- cli();
- stack_measure_init(&smctx, PATTERN_A);
- bc.init.init1(&ctx, key);
- t1 = stack_measure_final(&smctx);
- stack_measure_init(&smctx, PATTERN_B);
- bc.init.init1(&ctx, key);
- t2 = stack_measure_final(&smctx);
- sei();
- } else {
- cli();
- stack_measure_init(&smctx, PATTERN_A);
- bc.init.init2(&ctx, keysize, key);
- t1 = stack_measure_final(&smctx);
- stack_measure_init(&smctx, PATTERN_B);
- bc.init.init2(&ctx, keysize, key);
+void bcal_stacksize(const bcdesc_t *bcd)
+{
+ bcdesc_t bc;
+ stack_measuring_ctx_t smctx;
+ memcpy_P(&bc, bcd, sizeof(bcdesc_t));
+ uint8_t ctx[bc.ctxsize_B];
+ uint8_t data[(bc.blocksize_b + 7) / 8];
+ uint16_t keysize = get_keysize(bc.valid_keysize_desc);
+ uint8_t key[(keysize + 7) / 8];
+ uint16_t t1 = 0, t2 = 0;
+
+ if (bc.type != BCDESC_TYPE_BLOCKCIPHER)
+ return;
+ printf_P(PSTR("\n === %S stack-usage ===\n"), bc.name);
+
+ uart0_flush();
+
+ if (bc.init.init1) {
+ if ((bc.flags & BC_INIT_TYPE) == BC_INIT_TYPE_1) {
+ cli();
+ stack_measure_init(&smctx, PATTERN_A);
+ bc.init.init1(&ctx, key);
+ t1 = stack_measure_final(&smctx);
+ stack_measure_init(&smctx, PATTERN_B);
+ bc.init.init1(&ctx, key);
+ t2 = stack_measure_final(&smctx);
+ sei();
+ } else {
+ cli();
+ stack_measure_init(&smctx, PATTERN_A);
+ bc.init.init2(&ctx, keysize, key);
+ t1 = stack_measure_final(&smctx);
+ stack_measure_init(&smctx, PATTERN_B);
+ bc.init.init2(&ctx, keysize, key);
t2 = stack_measure_final(&smctx);
sei();
}
- t1 = (t1 > t2) ? t1 : t2;
- printf_P(PSTR(" init (bytes): %5"PRIu16"\n"), t1);
- }
- cli();
- stack_measure_init(&smctx, PATTERN_A);
- bc.enc.enc1(data, &ctx);
- t1 = stack_measure_final(&smctx);
- stack_measure_init(&smctx, PATTERN_B);
- bc.enc.enc1(data, &ctx);
- t2 = stack_measure_final(&smctx);
- sei();
-
- t1 = (t1 > t2) ? t1 : t2;
- printf_P(PSTR(" encBlock (bytes): %5"PRIu16"\n"), t1);
-
- cli();
- stack_measure_init(&smctx, PATTERN_A);
- bc.dec.dec1(data, &ctx);
- t1 = stack_measure_final(&smctx);
- stack_measure_init(&smctx, PATTERN_B);
- bc.dec.dec1(data, &ctx);
- t2 = stack_measure_final(&smctx);
- sei();
-
- t1 = (t1 > t2) ? t1 : t2;
- printf_P(PSTR(" decBlock (bytes): %5"PRIu16"\n"), t1);
-
- if(bc.free){
- bc.free(&ctx);
- }
+ t1 = (t1 > t2) ? t1 : t2;
+ printf_P(PSTR(" init (bytes): %5"PRIu16"\n"), t1);
+ }
+ cli();
+ stack_measure_init(&smctx, PATTERN_A);
+ bc.enc.enc1(data, &ctx);
+ t1 = stack_measure_final(&smctx);
+ stack_measure_init(&smctx, PATTERN_B);
+ bc.enc.enc1(data, &ctx);
+ t2 = stack_measure_final(&smctx);
+ sei();
+
+ t1 = (t1 > t2) ? t1 : t2;
+ printf_P(PSTR(" encBlock (bytes): %5"PRIu16"\n"), t1);
+
+ cli();
+ stack_measure_init(&smctx, PATTERN_A);
+ bc.dec.dec1(data, &ctx);
+ t1 = stack_measure_final(&smctx);
+ stack_measure_init(&smctx, PATTERN_B);
+ bc.dec.dec1(data, &ctx);
+ t2 = stack_measure_final(&smctx);
+ sei();
+
+ t1 = (t1 > t2) ? t1 : t2;
+ printf_P(PSTR(" decBlock (bytes): %5"PRIu16"\n"), t1);
+
+ if (bc.free) {
+ bc.free(&ctx);
+ }
}
-void bcal_performance_multiple(const bcdesc_t *const *bcd_list){
- const bcdesc_t *bcd;
- for(;;){
- bcd = (void*)pgm_read_word(bcd_list);
- if(!bcd){
- puts_P(PSTR("\n End of performance figures\n"));
- return;
- }
- bcal_performance(bcd);
- bcal_stacksize(bcd);
- bcd_list = (void*)((uint8_t*)bcd_list + 2);
- }
+void bcal_performance_multiple(const bcdesc_t * const *bcd_list)
+{
+ const bcdesc_t *bcd;
+ for (;;) {
+ bcd = (void*) pgm_read_word(bcd_list);
+ if (!bcd) {
+ puts_P(PSTR("\n End of performance figures\n"));
+ return;
+ }
+ bcal_performance(bcd);
+ bcal_stacksize(bcd);
+ bcd_list = (void*) ((uint8_t*) bcd_list + 2);
+ }
}
/* bcal-performance.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/*
* \file bcal-performance.h
#include "blockcipher_descriptor.h"
void bcal_performance(const bcdesc_t *hd);
-void bcal_performance_multiple(const bcdesc_t *const *hd_list);
-
+void bcal_performance_multiple(const bcdesc_t * const *hd_list);
#endif /* BCAL_PERFORMANCE_H_ */
/* bcal_aes128.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_aes128.c
* \email daniel.otte@rub.de
#include "aes_keyschedule.h"
#include "keysize_descriptor.h"
-const char aes128_str[] PROGMEM = "AES-128";
+const char aes128_str[] PROGMEM = "AES-128";
-const uint8_t aes128_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(128),
- KS_TYPE_TERMINATOR };
+const uint8_t aes128_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(128),
+KS_TYPE_TERMINATOR };
const bcdesc_t aes128_desc PROGMEM = {
- BCDESC_TYPE_BLOCKCIPHER,
- BC_INIT_TYPE_1,
- aes128_str,
- sizeof(aes128_ctx_t),
- 128,
- {(void_fpt)aes128_init},
- {(void_fpt)aes128_enc},
- {(void_fpt)aes128_dec},
- (bc_free_fpt)NULL,
- aes128_keysize_desc
+BCDESC_TYPE_BLOCKCIPHER,
+BC_INIT_TYPE_1,
+ aes128_str,
+ sizeof(aes128_ctx_t),
+ 128,
+ { (void_fpt) aes128_init },
+ { (void_fpt) aes128_enc },
+ { (void_fpt) aes128_dec },
+ (bc_free_fpt) NULL,
+ aes128_keysize_desc
};
-
/* bcal_aes128.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_aes128.h
* \email daniel.otte@rub.de
/* bcal_aes192.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_aes192.c
* \email daniel.otte@rub.de
#include "aes_keyschedule.h"
#include "keysize_descriptor.h"
-const char aes192_str[] PROGMEM = "AES-192";
+const char aes192_str[] PROGMEM = "AES-192";
-const uint8_t aes192_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(192),
- KS_TYPE_TERMINATOR };
+const uint8_t aes192_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(192),
+KS_TYPE_TERMINATOR };
const bcdesc_t aes192_desc PROGMEM = {
- BCDESC_TYPE_BLOCKCIPHER,
- BC_INIT_TYPE_1,
- aes192_str,
- sizeof(aes192_ctx_t),
- 128,
- {(void_fpt)aes192_init},
- {(void_fpt)aes192_enc},
- {(void_fpt)aes192_dec},
- (bc_free_fpt)NULL,
- aes192_keysize_desc
+BCDESC_TYPE_BLOCKCIPHER,
+BC_INIT_TYPE_1,
+ aes192_str,
+ sizeof(aes192_ctx_t),
+ 128,
+ { (void_fpt) aes192_init },
+ { (void_fpt) aes192_enc },
+ { (void_fpt) aes192_dec },
+ (bc_free_fpt) NULL,
+ aes192_keysize_desc
};
-
/* bcal_aes192.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_aes192.h
* \email daniel.otte@rub.de
/* bcal_aes256.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_aes256.c
* \email daniel.otte@rub.de
#include "aes_keyschedule.h"
#include "keysize_descriptor.h"
-const char aes256_str[] PROGMEM = "AES-256";
+const char aes256_str[] PROGMEM = "AES-256";
-const uint8_t aes256_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(256),
- KS_TYPE_TERMINATOR };
+const uint8_t aes256_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(256),
+KS_TYPE_TERMINATOR };
const bcdesc_t aes256_desc PROGMEM = {
- BCDESC_TYPE_BLOCKCIPHER,
- BC_INIT_TYPE_1,
- aes256_str,
- sizeof(aes256_ctx_t),
- 128,
- {(void_fpt)aes256_init},
- {(void_fpt)aes256_enc},
- {(void_fpt)aes256_dec},
- (bc_free_fpt)NULL,
- aes256_keysize_desc
+BCDESC_TYPE_BLOCKCIPHER,
+BC_INIT_TYPE_1,
+ aes256_str,
+ sizeof(aes256_ctx_t),
+ 128,
+ { (void_fpt) aes256_init },
+ { (void_fpt) aes256_enc },
+ { (void_fpt) aes256_dec },
+ (bc_free_fpt) NULL,
+ aes256_keysize_desc
};
-
/* bcal_aes256.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_aes256.h
* \email daniel.otte@rub.de
/* bcal_camellia128.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_camellia128.c
* \email daniel.otte@rub.de
#include "camellia.h"
#include "keysize_descriptor.h"
-const char camellia128_str[] PROGMEM = "Camellia-128";
+const char camellia128_str[] PROGMEM = "Camellia-128";
-const uint8_t camellia128_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(128),
- KS_TYPE_TERMINATOR };
+const uint8_t camellia128_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1,
+ KS_INT(128),
+ KS_TYPE_TERMINATOR };
const bcdesc_t camellia128_desc PROGMEM = {
- BCDESC_TYPE_BLOCKCIPHER,
- BC_INIT_TYPE_1,
- camellia128_str,
- sizeof(camellia128_ctx_t),
- 128,
- {(void_fpt)camellia128_init},
- {(void_fpt)camellia128_enc},
- {(void_fpt)camellia128_dec},
- (bc_free_fpt)NULL,
- camellia128_keysize_desc
+BCDESC_TYPE_BLOCKCIPHER,
+BC_INIT_TYPE_1,
+ camellia128_str,
+ sizeof(camellia128_ctx_t),
+ 128,
+ { (void_fpt) camellia128_init },
+ { (void_fpt) camellia128_enc },
+ { (void_fpt) camellia128_dec },
+ (bc_free_fpt) NULL,
+ camellia128_keysize_desc
};
-
/* bcal_camellia128.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_camellia128.h
* \email daniel.otte@rub.de
/* bcal_cast5.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_cast5.c
* \email daniel.otte@rub.de
#include "cast5.h"
#include "keysize_descriptor.h"
-const char cast5_str[] PROGMEM = "CAST5";
+const char cast5_str[] PROGMEM = "CAST5";
-const uint8_t cast5_keysize_desc[] PROGMEM = { KS_TYPE_RANGE, KS_INT(0), KS_INT(128),
- KS_TYPE_TERMINATOR };
+const uint8_t cast5_keysize_desc[] PROGMEM = { KS_TYPE_RANGE, KS_INT(0),
+ KS_INT(128),
+ KS_TYPE_TERMINATOR };
const bcdesc_t cast5_desc PROGMEM = {
- BCDESC_TYPE_BLOCKCIPHER,
- BC_INIT_TYPE_2,
- cast5_str,
- sizeof(cast5_ctx_t),
- 64,
- {(void_fpt)cast5_init},
- {(void_fpt)cast5_enc},
- {(void_fpt)cast5_dec},
- (bc_free_fpt)NULL,
- cast5_keysize_desc
+BCDESC_TYPE_BLOCKCIPHER,
+BC_INIT_TYPE_2,
+ cast5_str,
+ sizeof(cast5_ctx_t),
+ 64,
+ { (void_fpt) cast5_init },
+ { (void_fpt) cast5_enc },
+ { (void_fpt) cast5_dec },
+ (bc_free_fpt) NULL,
+ cast5_keysize_desc
};
-
/* bcal_cast5.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_cast5.h
* \email daniel.otte@rub.de
/* bcal_cast6.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_cast6.c
* \email daniel.otte@rub.de
#include "cast6.h"
#include "keysize_descriptor.h"
-const char cast6_str[] PROGMEM = "CAST-256";
+const char cast6_str[] PROGMEM = "CAST-256";
-const uint8_t cast6_keysize_desc[] PROGMEM = { KS_TYPE_RANGE, KS_INT(0), KS_INT(256),
- KS_TYPE_TERMINATOR };
+const uint8_t cast6_keysize_desc[] PROGMEM = { KS_TYPE_RANGE, KS_INT(0),
+ KS_INT(256),
+ KS_TYPE_TERMINATOR };
const bcdesc_t cast6_desc PROGMEM = {
- BCDESC_TYPE_BLOCKCIPHER,
- BC_INIT_TYPE_2,
- cast6_str,
- sizeof(cast6_ctx_t),
- 128,
- {(void_fpt)cast6_init},
- {(void_fpt)cast6_enc},
- {(void_fpt)cast6_dec},
- (bc_free_fpt)NULL,
- cast6_keysize_desc
+BCDESC_TYPE_BLOCKCIPHER,
+BC_INIT_TYPE_2,
+ cast6_str,
+ sizeof(cast6_ctx_t),
+ 128,
+ { (void_fpt) cast6_init },
+ { (void_fpt) cast6_enc },
+ { (void_fpt) cast6_dec },
+ (bc_free_fpt) NULL,
+ cast6_keysize_desc
};
-
/* bcal_cast6.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_cast6.h
* \email daniel.otte@rub.de
/* bcal_cscipher.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_cscipher.c
* \email daniel.otte@rub.de
#include "cscipher.h"
#include "keysize_descriptor.h"
-
-const char cscipher_str[] PROGMEM = "CS-Cipher";
+const char cscipher_str[] PROGMEM = "CS-Cipher";
const uint8_t cscipher_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(128),
- KS_TYPE_TERMINATOR };
+KS_TYPE_TERMINATOR };
const bcdesc_t cscipher_desc PROGMEM = {
- BCDESC_TYPE_BLOCKCIPHER,
- BC_INIT_TYPE_1,
- cscipher_str,
- sizeof(cscipher_ctx_t),
- 64,
- {(void_fpt)cscipher_init},
- {(void_fpt)cscipher_enc},
- {(void_fpt)cscipher_dec},
- (bc_free_fpt)NULL,
- cscipher_keysize_desc
+BCDESC_TYPE_BLOCKCIPHER,
+BC_INIT_TYPE_1,
+ cscipher_str,
+ sizeof(cscipher_ctx_t),
+ 64,
+ { (void_fpt) cscipher_init },
+ { (void_fpt) cscipher_enc },
+ { (void_fpt) cscipher_dec },
+ (bc_free_fpt) NULL,
+ cscipher_keysize_desc
};
-
/* bcal_cscipher.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_cscipher.h
* \email daniel.otte@rub.de
/* bcal_des.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_des.c
* \email daniel.otte@rub.de
#include "des.h"
#include "keysize_descriptor.h"
-const char des_str[] PROGMEM = "DES";
+const char des_str[] PROGMEM = "DES";
-const uint8_t des_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(64),
- KS_TYPE_TERMINATOR };
+const uint8_t des_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(64),
+KS_TYPE_TERMINATOR };
static
-void des_dummy_enc(void *block, void *key){
- des_enc(block, block, key);
+void des_dummy_enc(void *block, void *key)
+{
+ des_enc(block, block, key);
}
static
-void des_dummy_dec(void *block, void *key){
- des_dec(block, block, key);
+void des_dummy_dec(void *block, void *key)
+{
+ des_dec(block, block, key);
}
const bcdesc_t des_desc PROGMEM = {
- BCDESC_TYPE_BLOCKCIPHER,
- BC_INIT_TYPE_1,
- des_str,
- 8,
- 64,
- {(void_fpt)NULL},
- {(void_fpt)des_dummy_enc},
- {(void_fpt)des_dummy_dec},
- (bc_free_fpt)NULL,
- des_keysize_desc
+BCDESC_TYPE_BLOCKCIPHER,
+BC_INIT_TYPE_1,
+ des_str,
+ 8,
+ 64,
+ { (void_fpt) NULL },
+ { (void_fpt) des_dummy_enc },
+ { (void_fpt) des_dummy_dec },
+ (bc_free_fpt) NULL,
+ des_keysize_desc
};
-
/* bcal_des.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_des.h
* \email daniel.otte@rub.de
/* bcal_khazad.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2011 Daniel Otte (daniel.otte@rub.de)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2011 Daniel Otte (daniel.otte@rub.de)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_khazad.c
* \email daniel.otte@rub.de
#include "khazad.h"
#include "keysize_descriptor.h"
-const char khazad_str[] PROGMEM = "Khazad";
+const char khazad_str[] PROGMEM = "Khazad";
const uint8_t khazad_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(128),
- KS_TYPE_TERMINATOR };
-
+KS_TYPE_TERMINATOR };
const bcdesc_t khazad_desc PROGMEM = {
- BCDESC_TYPE_BLOCKCIPHER,
- BC_INIT_TYPE_1,
- khazad_str,
- sizeof(khazad_ctx_t),
- 64,
- {(void_fpt)khazad_init},
- {(void_fpt)khazad_enc},
- {(void_fpt)khazad_dec},
- (bc_free_fpt)NULL,
- khazad_keysize_desc
+BCDESC_TYPE_BLOCKCIPHER,
+BC_INIT_TYPE_1,
+ khazad_str,
+ sizeof(khazad_ctx_t),
+ 64,
+ { (void_fpt) khazad_init },
+ { (void_fpt) khazad_enc },
+ { (void_fpt) khazad_dec },
+ (bc_free_fpt) NULL,
+ khazad_keysize_desc
};
-
/* bcal_khazad.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_khazad.h
* \email daniel.otte@rub.de
#include "noekeon.h"
#include "keysize_descriptor.h"
-const char noekeon_direct_str[] PROGMEM = "Noekeon-Direct";
-const char noekeon_indirect_str[] PROGMEM = "Noekeon-Indirect";
+const char noekeon_direct_str[] PROGMEM = "Noekeon-Direct";
+const char noekeon_indirect_str[] PROGMEM = "Noekeon-Indirect";
-const uint8_t noekeon_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(128),
- KS_TYPE_TERMINATOR };
+const uint8_t noekeon_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(128),
+KS_TYPE_TERMINATOR };
const bcdesc_t noekeon_direct_desc PROGMEM = {
- BCDESC_TYPE_BLOCKCIPHER,
- BC_ENC_TYPE_1,
- noekeon_direct_str,
- 16,
- 128,
- {(void_fpt)NULL},
- {(void_fpt)noekeon_enc},
- {(void_fpt)noekeon_dec},
- (bc_free_fpt)NULL,
- noekeon_keysize_desc
+BCDESC_TYPE_BLOCKCIPHER,
+BC_ENC_TYPE_1,
+ noekeon_direct_str,
+ 16,
+ 128,
+ { (void_fpt) NULL },
+ { (void_fpt) noekeon_enc },
+ { (void_fpt) noekeon_dec },
+ (bc_free_fpt) NULL,
+ noekeon_keysize_desc
};
const bcdesc_t noekeon_indirect_desc PROGMEM = {
- BCDESC_TYPE_BLOCKCIPHER,
- BC_INIT_TYPE_1 | BC_ENC_TYPE_1,
- noekeon_indirect_str,
- 16,
- 128,
- {(void_fpt)noekeon_init},
- {(void_fpt)noekeon_enc},
- {(void_fpt)noekeon_dec},
- (bc_free_fpt)NULL,
- noekeon_keysize_desc
+BCDESC_TYPE_BLOCKCIPHER,
+BC_INIT_TYPE_1 | BC_ENC_TYPE_1,
+ noekeon_indirect_str,
+ 16,
+ 128,
+ { (void_fpt) noekeon_init },
+ { (void_fpt) noekeon_enc },
+ { (void_fpt) noekeon_dec },
+ (bc_free_fpt) NULL,
+ noekeon_keysize_desc
};
-
/* bcal_present.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_present.c
* \email daniel.otte@rub.de
#include "present128.h"
#include "keysize_descriptor.h"
-const char present128_str[] PROGMEM = "Present128";
+const char present128_str[] PROGMEM = "Present128";
-const uint8_t present128_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(128),
- KS_TYPE_TERMINATOR };
+const uint8_t present128_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1,
+ KS_INT(128),
+ KS_TYPE_TERMINATOR };
const bcdesc_t present128_desc PROGMEM = {
- BCDESC_TYPE_BLOCKCIPHER,
- BC_INIT_TYPE_2,
- present128_str,
- sizeof(present128_ctx_t),
- 64,
- {(void_fpt)present128_init},
- {(void_fpt)present128_enc},
- {(void_fpt)present128_dec},
- (bc_free_fpt)NULL,
- present128_keysize_desc
+BCDESC_TYPE_BLOCKCIPHER,
+BC_INIT_TYPE_2,
+ present128_str,
+ sizeof(present128_ctx_t),
+ 64,
+ { (void_fpt) present128_init },
+ { (void_fpt) present128_enc },
+ { (void_fpt) present128_dec },
+ (bc_free_fpt) NULL,
+ present128_keysize_desc
};
/* bcal_present.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_present.h
* \email daniel.otte@rub.de
/* bcal_present.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_present.c
* \email daniel.otte@rub.de
#include "present80.h"
#include "keysize_descriptor.h"
-const char present80_str[] PROGMEM = "Present80";
+const char present80_str[] PROGMEM = "Present80";
const uint8_t present80_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(80),
- KS_TYPE_TERMINATOR };
+KS_TYPE_TERMINATOR };
const bcdesc_t present80_desc PROGMEM = {
- BCDESC_TYPE_BLOCKCIPHER,
- BC_INIT_TYPE_2,
- present80_str,
- sizeof(present80_ctx_t),
- 64,
- {(void_fpt)present80_init},
- {(void_fpt)present80_enc},
- {(void_fpt)present80_dec},
- (bc_free_fpt)NULL,
- present80_keysize_desc
+BCDESC_TYPE_BLOCKCIPHER,
+BC_INIT_TYPE_2,
+ present80_str,
+ sizeof(present80_ctx_t),
+ 64,
+ { (void_fpt) present80_init },
+ { (void_fpt) present80_enc },
+ { (void_fpt) present80_dec },
+ (bc_free_fpt) NULL,
+ present80_keysize_desc
};
-
/* bcal_present.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_present.h
* \email daniel.otte@rub.de
/* bcal_rc5.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_rc5.c
* \email daniel.otte@rub.de
#define RC5_ROUNDS 12
-const char rc5_str[] PROGMEM = "RC5";
+const char rc5_str[] PROGMEM = "RC5";
-const uint8_t rc5_keysize_desc[] PROGMEM = { KS_TYPE_RANGE, KS_INT(1), KS_INT(2040),
- KS_TYPE_TERMINATOR };
+const uint8_t rc5_keysize_desc[] PROGMEM = { KS_TYPE_RANGE, KS_INT(1),
+ KS_INT(2040),
+ KS_TYPE_TERMINATOR };
static
-void rc5_dummy_init(void *key, uint16_t keysize_b, void *ctx){
- rc5_init(key, keysize_b, RC5_ROUNDS, ctx);
+void rc5_dummy_init(void *key, uint16_t keysize_b, void *ctx)
+{
+ rc5_init(key, keysize_b, RC5_ROUNDS, ctx);
}
const bcdesc_t rc5_desc PROGMEM = {
- BCDESC_TYPE_BLOCKCIPHER,
- BC_INIT_TYPE_2,
- rc5_str,
- sizeof(rc5_ctx_t),
- 128,
- {(void_fpt)rc5_dummy_init},
- {(void_fpt)rc5_enc},
- {(void_fpt)rc5_dec},
- (bc_free_fpt)rc5_free,
- rc5_keysize_desc
+BCDESC_TYPE_BLOCKCIPHER,
+BC_INIT_TYPE_2,
+ rc5_str,
+ sizeof(rc5_ctx_t),
+ 128,
+ { (void_fpt) rc5_dummy_init },
+ { (void_fpt) rc5_enc },
+ { (void_fpt) rc5_dec },
+ (bc_free_fpt) rc5_free,
+ rc5_keysize_desc
};
-
/* bcal_rc5.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_rc5.h
* \email daniel.otte@rub.de
/* bcal_rc6.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_rc6.c
* \email daniel.otte@rub.de
#include "rc6.h"
#include "keysize_descriptor.h"
-const char rc6_str[] PROGMEM = "RC6";
+const char rc6_str[] PROGMEM = "RC6";
-const uint8_t rc6_keysize_desc[] PROGMEM = { KS_TYPE_RANGE, KS_INT(1), KS_INT(2040),
- KS_TYPE_TERMINATOR };
+const uint8_t rc6_keysize_desc[] PROGMEM = { KS_TYPE_RANGE, KS_INT(1),
+ KS_INT(2040),
+ KS_TYPE_TERMINATOR };
const bcdesc_t rc6_desc PROGMEM = {
- BCDESC_TYPE_BLOCKCIPHER,
- BC_INIT_TYPE_2,
- rc6_str,
- sizeof(rc6_ctx_t),
- 128,
- {(void_fpt)rc6_init},
- {(void_fpt)rc6_enc},
- {(void_fpt)rc6_dec},
- (bc_free_fpt)rc6_free,
- rc6_keysize_desc
+BCDESC_TYPE_BLOCKCIPHER,
+BC_INIT_TYPE_2,
+ rc6_str,
+ sizeof(rc6_ctx_t),
+ 128,
+ { (void_fpt) rc6_init },
+ { (void_fpt) rc6_enc },
+ { (void_fpt) rc6_dec },
+ (bc_free_fpt) rc6_free,
+ rc6_keysize_desc
};
-
/* bcal_rc6.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_rc6.h
* \email daniel.otte@rub.de
/* bcal_seed.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_seed.c
* \email daniel.otte@rub.de
#include "seed.h"
#include "keysize_descriptor.h"
-const char seed_str[] PROGMEM = "SEED";
+const char seed_str[] PROGMEM = "SEED";
-const uint8_t seed_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(128),
- KS_TYPE_TERMINATOR };
+const uint8_t seed_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(128),
+KS_TYPE_TERMINATOR };
const bcdesc_t seed_desc PROGMEM = {
- BCDESC_TYPE_BLOCKCIPHER,
- BC_INIT_TYPE_1,
- seed_str,
- sizeof(seed_ctx_t),
- 128,
- {(void_fpt)seed_init},
- {(void_fpt)seed_enc},
- {(void_fpt)seed_dec},
- (bc_free_fpt)NULL,
- seed_keysize_desc
+BCDESC_TYPE_BLOCKCIPHER,
+BC_INIT_TYPE_1,
+ seed_str,
+ sizeof(seed_ctx_t),
+ 128,
+ { (void_fpt) seed_init },
+ { (void_fpt) seed_enc },
+ { (void_fpt) seed_dec },
+ (bc_free_fpt) NULL,
+ seed_keysize_desc
};
-
/* bcal_seed.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_seed.h
* \email daniel.otte@rub.de
/* bcal_serpent.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_serpent.c
* \email daniel.otte@rub.de
#include "serpent.h"
#include "keysize_descriptor.h"
-const char serpent_str[] PROGMEM = "serpent";
+const char serpent_str[] PROGMEM = "serpent";
/*
-const uint8_t serpent_keysize_desc[] PROGMEM = { KS_TYPE_RANGE, KS_INT(1), KS_INT(256),
- KS_TYPE_TERMINATOR };
+ const uint8_t serpent_keysize_desc[] PROGMEM = { KS_TYPE_RANGE, KS_INT(1), KS_INT(256),
+ KS_TYPE_TERMINATOR };
-*/
-const uint8_t serpent_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 3, KS_INT(128), KS_INT(192), KS_INT(256),
- KS_TYPE_TERMINATOR };
+ */
+const uint8_t serpent_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 3, KS_INT(128),
+ KS_INT(192), KS_INT(256),
+ KS_TYPE_TERMINATOR };
const bcdesc_t serpent_desc PROGMEM = {
- BCDESC_TYPE_BLOCKCIPHER,
- BC_INIT_TYPE_2,
- serpent_str,
- sizeof(serpent_ctx_t),
- 128,
- {(void_fpt)serpent_init},
- {(void_fpt)serpent_enc},
- {(void_fpt)serpent_dec},
- (bc_free_fpt)NULL,
- serpent_keysize_desc
+BCDESC_TYPE_BLOCKCIPHER,
+BC_INIT_TYPE_2,
+ serpent_str,
+ sizeof(serpent_ctx_t),
+ 128,
+ { (void_fpt) serpent_init },
+ { (void_fpt) serpent_enc },
+ { (void_fpt) serpent_dec },
+ (bc_free_fpt) NULL,
+ serpent_keysize_desc
};
-
/* bcal_serpent.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_serpent.h
* \email daniel.otte@rub.de
/* bcal_skipjack.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_skipjack.c
* \email daniel.otte@rub.de
#include "skipjack.h"
#include "keysize_descriptor.h"
-const char skipjack_str[] PROGMEM = "Skipjack";
+const char skipjack_str[] PROGMEM = "Skipjack";
-const uint8_t skipjack_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(80),
- KS_TYPE_TERMINATOR };
+const uint8_t skipjack_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(80),
+KS_TYPE_TERMINATOR };
const bcdesc_t skipjack_desc PROGMEM = {
- BCDESC_TYPE_BLOCKCIPHER,
- BC_INIT_TYPE_1,
- skipjack_str,
- 10,
- 64,
- {(void_fpt)NULL},
- {(void_fpt)skipjack_enc},
- {(void_fpt)skipjack_dec},
- (bc_free_fpt)NULL,
- skipjack_keysize_desc
+BCDESC_TYPE_BLOCKCIPHER,
+BC_INIT_TYPE_1,
+ skipjack_str,
+ 10,
+ 64,
+ { (void_fpt) NULL },
+ { (void_fpt) skipjack_enc },
+ { (void_fpt) skipjack_dec },
+ (bc_free_fpt) NULL,
+ skipjack_keysize_desc
};
-
/* bcal_skipjack.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_skipjack.h
* \email daniel.otte@rub.de
/* bcal_tdes.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_tdes.c
* \email daniel.otte@rub.de
#include "des.h"
#include "keysize_descriptor.h"
-const char tdes_str[] PROGMEM = "TDES";
+const char tdes_str[] PROGMEM = "TDES";
-const uint8_t tdes_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(192),
- KS_TYPE_TERMINATOR };
+const uint8_t tdes_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(192),
+KS_TYPE_TERMINATOR };
static
-void tdes_dummy_enc(void *block, void *key){
- tdes_enc(block, block, key);
+void tdes_dummy_enc(void *block, void *key)
+{
+ tdes_enc(block, block, key);
}
static
-void tdes_dummy_dec(void *block, void *key){
- tdes_dec(block, block, key);
+void tdes_dummy_dec(void *block, void *key)
+{
+ tdes_dec(block, block, key);
}
const bcdesc_t tdes_desc PROGMEM = {
- BCDESC_TYPE_BLOCKCIPHER,
- BC_INIT_TYPE_1,
- tdes_str,
- 24,
- 64,
- {(void_fpt)NULL},
- {(void_fpt)tdes_dummy_enc},
- {(void_fpt)tdes_dummy_dec},
- (bc_free_fpt)NULL,
- tdes_keysize_desc
+BCDESC_TYPE_BLOCKCIPHER,
+BC_INIT_TYPE_1,
+ tdes_str,
+ 24,
+ 64,
+ { (void_fpt) NULL },
+ { (void_fpt) tdes_dummy_enc },
+ { (void_fpt) tdes_dummy_dec },
+ (bc_free_fpt) NULL,
+ tdes_keysize_desc
};
-
/* bcal_tdes.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_tdes.h
* \email daniel.otte@rub.de
/* bcal_tdes2.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_tdes.c
* \email daniel.otte@rub.de
#include "des.h"
#include "keysize_descriptor.h"
-const char tdes2_str[] PROGMEM = "TDES-2";
+const char tdes2_str[] PROGMEM = "TDES-2";
const uint8_t tdes2_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(128),
- KS_TYPE_TERMINATOR };
+KS_TYPE_TERMINATOR };
static
-void tdes_dummy_enc(void *block, void *key){
- tdes_enc(block, block, key);
+void tdes_dummy_enc(void *block, void *key)
+{
+ tdes_enc(block, block, key);
}
static
-void tdes_dummy_dec(void *block, void *key){
- tdes_dec(block, block, key);
+void tdes_dummy_dec(void *block, void *key)
+{
+ tdes_dec(block, block, key);
}
static
-void tdes2_init(void *key, void *ctx){
- memcpy(ctx, key, 16);
- memcpy((uint8_t*)ctx+16, key, 8);
+void tdes2_init(void *key, void *ctx)
+{
+ memcpy(ctx, key, 16);
+ memcpy((uint8_t*) ctx + 16, key, 8);
}
-
-
const bcdesc_t tdes2_desc PROGMEM = {
- BCDESC_TYPE_BLOCKCIPHER,
- BC_INIT_TYPE_1,
- tdes2_str,
- 24,
- 64,
- {(void_fpt)tdes2_init},
- {(void_fpt)tdes_dummy_enc},
- {(void_fpt)tdes_dummy_dec},
- (bc_free_fpt)NULL,
- tdes2_keysize_desc
+BCDESC_TYPE_BLOCKCIPHER,
+BC_INIT_TYPE_1,
+ tdes2_str,
+ 24,
+ 64,
+ { (void_fpt) tdes2_init },
+ { (void_fpt) tdes_dummy_enc },
+ { (void_fpt) tdes_dummy_dec },
+ (bc_free_fpt) NULL,
+ tdes2_keysize_desc
};
-
/* bcal_tdes2.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_tdes.h
* \email daniel.otte@rub.de
/* bcal_threefish1024.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_threefish1024.c
* \email daniel.otte@rub.de
#include "threefish.h"
#include "keysize_descriptor.h"
-const char threefish1024_str[] PROGMEM = "Threefish-1024";
+const char threefish1024_str[] PROGMEM = "Threefish-1024";
-const uint8_t threefish1024_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(1024),
- KS_TYPE_TERMINATOR };
+const uint8_t threefish1024_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1,
+ KS_INT(1024),
+ KS_TYPE_TERMINATOR };
-static void threefish1024_dummy_init(void *key, void *ctx){
- threefish1024_init(key, NULL, ctx);
+static void threefish1024_dummy_init(void *key, void *ctx)
+{
+ threefish1024_init(key, NULL, ctx);
}
const bcdesc_t threefish1024_desc PROGMEM = {
- BCDESC_TYPE_BLOCKCIPHER,
- BC_INIT_TYPE_1,
- threefish1024_str,
- sizeof(threefish1024_ctx_t),
- 1024,
- {(void_fpt)threefish1024_dummy_init},
- {(void_fpt)threefish1024_enc},
- {(void_fpt)threefish1024_dec},
- (bc_free_fpt)NULL,
- threefish1024_keysize_desc
+BCDESC_TYPE_BLOCKCIPHER,
+BC_INIT_TYPE_1,
+ threefish1024_str,
+ sizeof(threefish1024_ctx_t),
+ 1024,
+ { (void_fpt) threefish1024_dummy_init },
+ { (void_fpt) threefish1024_enc },
+ { (void_fpt) threefish1024_dec },
+ (bc_free_fpt) NULL,
+ threefish1024_keysize_desc
};
-
/* bcal_threefis1024.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_threefish1024.h
* \email daniel.otte@rub.de
/* bcal_threefish256.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_threefish256.c
* \email daniel.otte@rub.de
#include "threefish.h"
#include "keysize_descriptor.h"
-const char threefish256_str[] PROGMEM = "Threefish-256";
+const char threefish256_str[] PROGMEM = "Threefish-256";
-const uint8_t threefish256_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(256),
- KS_TYPE_TERMINATOR };
+const uint8_t threefish256_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1,
+ KS_INT(256),
+ KS_TYPE_TERMINATOR };
-static void threefish256_dummy_init(void *key, void *ctx){
- threefish256_init(key, NULL, ctx);
+static void threefish256_dummy_init(void *key, void *ctx)
+{
+ threefish256_init(key, NULL, ctx);
}
const bcdesc_t threefish256_desc PROGMEM = {
- BCDESC_TYPE_BLOCKCIPHER,
- BC_INIT_TYPE_1,
- threefish256_str,
- sizeof(threefish256_ctx_t),
- 256,
- {(void_fpt)threefish256_dummy_init},
- {(void_fpt)threefish256_enc},
- {(void_fpt)threefish256_dec},
- (bc_free_fpt)NULL,
- threefish256_keysize_desc
+BCDESC_TYPE_BLOCKCIPHER,
+BC_INIT_TYPE_1,
+ threefish256_str,
+ sizeof(threefish256_ctx_t),
+ 256,
+ { (void_fpt) threefish256_dummy_init },
+ { (void_fpt) threefish256_enc },
+ { (void_fpt) threefish256_dec },
+ (bc_free_fpt) NULL,
+ threefish256_keysize_desc
};
-
/* bcal_threefis256.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_threefish256.h
* \email daniel.otte@rub.de
/* bcal_threefish512.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_threefish512.c
* \email daniel.otte@rub.de
#include "threefish.h"
#include "keysize_descriptor.h"
-const char threefish512_str[] PROGMEM = "Threefish-512";
+const char threefish512_str[] PROGMEM = "Threefish-512";
-const uint8_t threefish512_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(512),
- KS_TYPE_TERMINATOR };
+const uint8_t threefish512_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1,
+ KS_INT(512),
+ KS_TYPE_TERMINATOR };
-static void threefish512_dummy_init(void *key, void *ctx){
- threefish512_init(key, NULL, ctx);
+static void threefish512_dummy_init(void *key, void *ctx)
+{
+ threefish512_init(key, NULL, ctx);
}
const bcdesc_t threefish512_desc PROGMEM = {
- BCDESC_TYPE_BLOCKCIPHER,
- BC_INIT_TYPE_1,
- threefish512_str,
- sizeof(threefish512_ctx_t),
- 512,
- {(void_fpt)threefish512_dummy_init},
- {(void_fpt)threefish512_enc},
- {(void_fpt)threefish512_dec},
- (bc_free_fpt)NULL,
- threefish512_keysize_desc
+BCDESC_TYPE_BLOCKCIPHER,
+BC_INIT_TYPE_1,
+ threefish512_str,
+ sizeof(threefish512_ctx_t),
+ 512,
+ { (void_fpt) threefish512_dummy_init },
+ { (void_fpt) threefish512_enc },
+ { (void_fpt) threefish512_dec },
+ (bc_free_fpt) NULL,
+ threefish512_keysize_desc
};
-
/* bcal_threefis512.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_threefish512.h
* \email daniel.otte@rub.de
/* bcal_xtea.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_xtea.c
* \email daniel.otte@rub.de
#include "xtea.h"
#include "keysize_descriptor.h"
-const char xtea_str[] PROGMEM = "XTEA";
+const char xtea_str[] PROGMEM = "XTEA";
-const uint8_t xtea_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(128),
- KS_TYPE_TERMINATOR };
+const uint8_t xtea_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(128),
+KS_TYPE_TERMINATOR };
static
-void xtea_dummy_enc(void *block, void *key){
- xtea_enc(block, block, key);
+void xtea_dummy_enc(void *block, void *key)
+{
+ xtea_enc(block, block, key);
}
static
-void xtea_dummy_dec(void *block, void *key){
- xtea_dec(block, block, key);
+void xtea_dummy_dec(void *block, void *key)
+{
+ xtea_dec(block, block, key);
}
const bcdesc_t xtea_desc PROGMEM = {
- BCDESC_TYPE_BLOCKCIPHER,
- BC_INIT_TYPE_1,
- xtea_str,
- 16,
- 64,
- {(void_fpt)NULL},
- {(void_fpt)xtea_dummy_enc},
- {(void_fpt)xtea_dummy_dec},
- (bc_free_fpt)NULL,
- xtea_keysize_desc
+BCDESC_TYPE_BLOCKCIPHER,
+BC_INIT_TYPE_1,
+ xtea_str,
+ 16,
+ 64,
+ { (void_fpt) NULL },
+ { (void_fpt) xtea_dummy_enc },
+ { (void_fpt) xtea_dummy_dec },
+ (bc_free_fpt) NULL,
+ xtea_keysize_desc
};
-
/* bcal_xtea.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bcal_xtea.h
* \email daniel.otte@rub.de
/* bigint.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file bigint.c
* \author Daniel Otte
* \license GPLv3 or later
*
*/
-
#define STRING2(x) #x
#define STRING(x) STRING2(x)
#include "bigint.h"
#include <string.h>
/*
-#include "cli.h"
-#include "bigint_io.h"
-*/
+ #include "cli.h"
+ #include "bigint_io.h"
+ */
#ifndef MAX
- #define MAX(a,b) (((a)>(b))?(a):(b))
+#define MAX(a,b) (((a)>(b))?(a):(b))
#endif
#ifndef MIN
- #define MIN(a,b) (((a)<(b))?(a):(b))
+#define MIN(a,b) (((a)<(b))?(a):(b))
#endif
#define SET_FBS(a, v) do{(a)->info &=0xF8; (a)->info |= (v);}while(0)
#define GET_SIGN(a) ((a)->info&BIGINT_NEG_MASK)
-
/******************************************************************************/
/*
-void bigint_copy(bigint_t *dest, const bigint_t *src){
- memcpy(dest->wordv, src->wordv, src->length_W);
- dest->length_W = src->length_W;
- dest->info = src->info;
-}
-*/
+ void bigint_copy(bigint_t *dest, const bigint_t *src){
+ memcpy(dest->wordv, src->wordv, src->length_W);
+ dest->length_W = src->length_W;
+ dest->info = src->info;
+ }
+ */
/******************************************************************************/
/* this should be implemented in assembly */
/*
-void bigint_add_u(bigint_t *dest, const bigint_t *a, const bigint_t *b){
- uint16_t t=0, i;
- if(a->length_W < b->length_W){
- XCHG_PTR(a,b);
- }
- for(i=0; i<b->length_W; ++i){
- t = a->wordv[i] + b->wordv[i] + t;
- dest->wordv[i] = (uint8_t)t;
- t>>=8;
- }
- for(; i<a->length_W; ++i){
- t = a->wordv[i] + t;
- dest->wordv[i] = (uint8_t)t;
- t>>=8;
- }
- dest->wordv[i++] = t;
- dest->length_W = i;
- bigint_adjust(dest);
-}
-*/
+ void bigint_add_u(bigint_t *dest, const bigint_t *a, const bigint_t *b){
+ uint16_t t=0, i;
+ if(a->length_W < b->length_W){
+ XCHG_PTR(a,b);
+ }
+ for(i=0; i<b->length_W; ++i){
+ t = a->wordv[i] + b->wordv[i] + t;
+ dest->wordv[i] = (uint8_t)t;
+ t>>=8;
+ }
+ for(; i<a->length_W; ++i){
+ t = a->wordv[i] + t;
+ dest->wordv[i] = (uint8_t)t;
+ t>>=8;
+ }
+ dest->wordv[i++] = t;
+ dest->length_W = i;
+ bigint_adjust(dest);
+ }
+ */
/******************************************************************************/
/* this should be implemented in assembly */
/*
-void bigint_add_scale_u(bigint_t *dest, const bigint_t *a, uint16_t scale){
- uint16_t i,j=0;
- uint16_t t=0;
- if(scale>dest->length_W)
- memset(dest->wordv+dest->length_W, 0, scale-dest->length_W);
- for(i=scale; i<a->length_W+scale; ++i,++j){
- t = a->wordv[j] + t;
- if(dest->length_W>i){
- t += dest->wordv[i];
- }
- dest->wordv[i] = (uint8_t)t;
- t>>=8;
- }
- while(t){
- if(dest->length_W>i){
- t = dest->wordv[i] + t;
- }
- dest->wordv[i] = (uint8_t)t;
- t>>=8;
- ++i;
- }
- if(dest->length_W < i){
- dest->length_W = i;
- }
- bigint_adjust(dest);
-}
-*/
+ void bigint_add_scale_u(bigint_t *dest, const bigint_t *a, uint16_t scale){
+ uint16_t i,j=0;
+ uint16_t t=0;
+ if(scale>dest->length_W)
+ memset(dest->wordv+dest->length_W, 0, scale-dest->length_W);
+ for(i=scale; i<a->length_W+scale; ++i,++j){
+ t = a->wordv[j] + t;
+ if(dest->length_W>i){
+ t += dest->wordv[i];
+ }
+ dest->wordv[i] = (uint8_t)t;
+ t>>=8;
+ }
+ while(t){
+ if(dest->length_W>i){
+ t = dest->wordv[i] + t;
+ }
+ dest->wordv[i] = (uint8_t)t;
+ t>>=8;
+ ++i;
+ }
+ if(dest->length_W < i){
+ dest->length_W = i;
+ }
+ bigint_adjust(dest);
+ }
+ */
/******************************************************************************/
/* this should be implemented in assembly */
-void bigint_sub_u(bigint_t *dest, const bigint_t *a, const bigint_t *b){
- int8_t borrow=0;
- int8_t r;
- int16_t t;
- uint16_t i, min, max;
- min = MIN(a->length_W, b->length_W);
- max = MAX(a->length_W, b->length_W);
- r = bigint_cmp_u(a,b);
- if(r==0){
- dest->length_W = 0;
- dest->wordv[0] = 0;
- bigint_adjust(dest);
- return;
- }
- if(b->length_W==0){
- dest->length_W = a->length_W;
- memcpy(dest->wordv, a->wordv, a->length_W);
- dest->info = a->info;
- SET_POS(dest);
- return;
- }
- if(a->length_W==0){
- dest->length_W = b->length_W;
- memcpy(dest->wordv, b->wordv, b->length_W);
- dest->info = b->info;
- SET_NEG(dest);
- return;
- }
- if(r<0){
- bigint_sub_u(dest, b, a);
- SET_NEG(dest);
- }else{
- for(i=0; i<min; ++i){
- t = a->wordv[i] - b->wordv[i] - borrow;
- if(t<0){
- borrow = 1;
- dest->wordv[i]=(uint8_t)t;
- }else{
- borrow = 0;
- dest->wordv[i]=(uint8_t)t;
- }
- }
- for(;i<max; ++i){
- t = a->wordv[i] - borrow;
- if(t<0){
- borrow = 1;
- dest->wordv[i]=(uint8_t)t;
- }else{
- borrow = 0;
- dest->wordv[i]=(uint8_t)t;
- }
-
- }
- SET_POS(dest);
- dest->length_W = i;
- bigint_adjust(dest);
- }
+void bigint_sub_u(bigint_t *dest, const bigint_t *a, const bigint_t *b)
+{
+ int8_t borrow = 0;
+ int8_t r;
+ int16_t t;
+ uint16_t i, min, max;
+ min = MIN(a->length_W, b->length_W);
+ max = MAX(a->length_W, b->length_W);
+ r = bigint_cmp_u(a, b);
+ if (r == 0) {
+ dest->length_W = 0;
+ dest->wordv[0] = 0;
+ bigint_adjust(dest);
+ return;
+ }
+ if (b->length_W == 0) {
+ dest->length_W = a->length_W;
+ memcpy(dest->wordv, a->wordv, a->length_W);
+ dest->info = a->info;
+ SET_POS(dest);
+ return;
+ }
+ if (a->length_W == 0) {
+ dest->length_W = b->length_W;
+ memcpy(dest->wordv, b->wordv, b->length_W);
+ dest->info = b->info;
+ SET_NEG(dest);
+ return;
+ }
+ if (r < 0) {
+ bigint_sub_u(dest, b, a);
+ SET_NEG(dest);
+ } else {
+ for (i = 0; i < min; ++i) {
+ t = a->wordv[i] - b->wordv[i] - borrow;
+ if (t < 0) {
+ borrow = 1;
+ dest->wordv[i] = (uint8_t) t;
+ } else {
+ borrow = 0;
+ dest->wordv[i] = (uint8_t) t;
+ }
+ }
+ for (; i < max; ++i) {
+ t = a->wordv[i] - borrow;
+ if (t < 0) {
+ borrow = 1;
+ dest->wordv[i] = (uint8_t) t;
+ } else {
+ borrow = 0;
+ dest->wordv[i] = (uint8_t) t;
+ }
+
+ }
+ SET_POS(dest);
+ dest->length_W = i;
+ bigint_adjust(dest);
+ }
}
/******************************************************************************/
-int8_t bigint_cmp_u(const bigint_t *a, const bigint_t *b){
- if(a->length_W > b->length_W){
- return 1;
- }
- if(a->length_W < b->length_W){
- return -1;
- }
- if(a->length_W==0){
- return 0;
- }
- uint16_t i;
- i = a->length_W-1;
- do{
- if(a->wordv[i]!=b->wordv[i]){
- if(a->wordv[i]>b->wordv[i]){
- return 1;
- }else{
- return -1;
- }
- }
- }while(i--);
- return 0;
+int8_t bigint_cmp_u(const bigint_t *a, const bigint_t *b)
+{
+ if (a->length_W > b->length_W) {
+ return 1;
+ }
+ if (a->length_W < b->length_W) {
+ return -1;
+ }
+ if (a->length_W == 0) {
+ return 0;
+ }
+ uint16_t i;
+ i = a->length_W - 1;
+ do {
+ if (a->wordv[i] != b->wordv[i]) {
+ if (a->wordv[i] > b->wordv[i]) {
+ return 1;
+ } else {
+ return -1;
+ }
+ }
+ } while (i--);
+ return 0;
}
/******************************************************************************/
-void bigint_add_s(bigint_t *dest, const bigint_t *a, const bigint_t *b){
- uint8_t s;
- s = GET_SIGN(a)?2:0;
- s |= GET_SIGN(b)?1:0;
- switch(s){
- case 0: /* both positive */
- bigint_add_u(dest, a,b);
- SET_POS(dest);
- break;
- case 1: /* a positive, b negative */
- bigint_sub_u(dest, a, b);
- break;
- case 2: /* a negative, b positive */
- bigint_sub_u(dest, b, a);
- break;
- case 3: /* both negative */
- bigint_add_u(dest, a, b);
- SET_NEG(dest);
- break;
- default: /* how can this happen?*/
- break;
- }
+void bigint_add_s(bigint_t *dest, const bigint_t *a, const bigint_t *b)
+{
+ uint8_t s;
+ s = GET_SIGN(a) ? 2 : 0;
+ s |= GET_SIGN(b) ? 1 : 0;
+ switch (s) {
+ case 0: /* both positive */
+ bigint_add_u(dest, a, b);
+ SET_POS(dest);
+ break;
+ case 1: /* a positive, b negative */
+ bigint_sub_u(dest, a, b);
+ break;
+ case 2: /* a negative, b positive */
+ bigint_sub_u(dest, b, a);
+ break;
+ case 3: /* both negative */
+ bigint_add_u(dest, a, b);
+ SET_NEG(dest);
+ break;
+ default: /* how can this happen?*/
+ break;
+ }
}
/******************************************************************************/
-void bigint_sub_s(bigint_t *dest, const bigint_t *a, const bigint_t *b){
- uint8_t s;
- s = GET_SIGN(a)?2:0;
- s |= GET_SIGN(b)?1:0;
- switch(s){
- case 0: /* both positive */
- bigint_sub_u(dest, a,b);
- break;
- case 1: /* a positive, b negative */
- bigint_add_u(dest, a, b);
- SET_POS(dest);
- break;
- case 2: /* a negative, b positive */
- bigint_add_u(dest, a, b);
- SET_NEG(dest);
- break;
- case 3: /* both negative */
- bigint_sub_u(dest, b, a);
- break;
- default: /* how can this happen?*/
- break;
- }
+void bigint_sub_s(bigint_t *dest, const bigint_t *a, const bigint_t *b)
+{
+ uint8_t s;
+ s = GET_SIGN(a) ? 2 : 0;
+ s |= GET_SIGN(b) ? 1 : 0;
+ switch (s) {
+ case 0: /* both positive */
+ bigint_sub_u(dest, a, b);
+ break;
+ case 1: /* a positive, b negative */
+ bigint_add_u(dest, a, b);
+ SET_POS(dest);
+ break;
+ case 2: /* a negative, b positive */
+ bigint_add_u(dest, a, b);
+ SET_NEG(dest);
+ break;
+ case 3: /* both negative */
+ bigint_sub_u(dest, b, a);
+ break;
+ default: /* how can this happen?*/
+ break;
+ }
}
/******************************************************************************/
-int8_t bigint_cmp_s(const bigint_t *a, const bigint_t *b){
- uint8_t s;
- if(a->length_W==0 && b->length_W==0){
- return 0;
- }
- s = GET_SIGN(a)?2:0;
- s |= GET_SIGN(b)?1:0;
- switch(s){
- case 0: /* both positive */
- return bigint_cmp_u(a, b);
- break;
- case 1: /* a positive, b negative */
- return 1;
- break;
- case 2: /* a negative, b positive */
- return -1;
- break;
- case 3: /* both negative */
- return bigint_cmp_u(b, a);
- break;
- default: /* how can this happen?*/
- break;
- }
- return 0; /* just to satisfy the compiler */
+int8_t bigint_cmp_s(const bigint_t *a, const bigint_t *b)
+{
+ uint8_t s;
+ if (a->length_W == 0 && b->length_W == 0) {
+ return 0;
+ }
+ s = GET_SIGN(a) ? 2 : 0;
+ s |= GET_SIGN(b) ? 1 : 0;
+ switch (s) {
+ case 0: /* both positive */
+ return bigint_cmp_u(a, b);
+ break;
+ case 1: /* a positive, b negative */
+ return 1;
+ break;
+ case 2: /* a negative, b positive */
+ return -1;
+ break;
+ case 3: /* both negative */
+ return bigint_cmp_u(b, a);
+ break;
+ default: /* how can this happen?*/
+ break;
+ }
+ return 0; /* just to satisfy the compiler */
}
/******************************************************************************/
-void bigint_shiftleft(bigint_t *a, uint16_t shift){
- uint16_t byteshift;
- uint16_t i;
- uint8_t bitshift;
- uint16_t t=0;
- byteshift = (shift+3)/8;
- bitshift = shift&7;
- memmove(a->wordv+byteshift, a->wordv, a->length_W);
- memset(a->wordv, 0, byteshift);
- if(bitshift!=0){
- if(bitshift<=4){ /* shift to the left */
- for(i=byteshift; i<a->length_W+byteshift; ++i){
- t |= (a->wordv[i])<<bitshift;
- a->wordv[i] = (uint8_t)t;
- t >>= 8;
- }
- a->wordv[i] = (uint8_t)t;
- byteshift++;
- }else{ /* shift to the right */
- for(i=a->length_W+byteshift-1; i>byteshift-1; --i){
- t |= (a->wordv[i])<<(bitshift);
- a->wordv[i] = (uint8_t)(t>>8);
- t <<= 8;
- }
- t |= (a->wordv[i])<<(bitshift);
- a->wordv[i] = (uint8_t)(t>>8);
- }
- }
- a->length_W += byteshift;
- bigint_adjust(a);
+void bigint_shiftleft(bigint_t *a, uint16_t shift)
+{
+ uint16_t byteshift;
+ uint16_t i;
+ uint8_t bitshift;
+ uint16_t t = 0;
+ byteshift = (shift + 3) / 8;
+ bitshift = shift & 7;
+ memmove(a->wordv + byteshift, a->wordv, a->length_W);
+ memset(a->wordv, 0, byteshift);
+ if (bitshift != 0) {
+ if (bitshift <= 4) { /* shift to the left */
+ for (i = byteshift; i < a->length_W + byteshift; ++i) {
+ t |= (a->wordv[i]) << bitshift;
+ a->wordv[i] = (uint8_t) t;
+ t >>= 8;
+ }
+ a->wordv[i] = (uint8_t) t;
+ byteshift++;
+ } else { /* shift to the right */
+ for (i = a->length_W + byteshift - 1; i > byteshift - 1; --i) {
+ t |= (a->wordv[i]) << (bitshift);
+ a->wordv[i] = (uint8_t) (t >> 8);
+ t <<= 8;
+ }
+ t |= (a->wordv[i]) << (bitshift);
+ a->wordv[i] = (uint8_t) (t >> 8);
+ }
+ }
+ a->length_W += byteshift;
+ bigint_adjust(a);
}
/******************************************************************************/
-void bigint_shiftright(bigint_t *a, uint16_t shift){
- uint16_t byteshift;
- uint16_t i;
- uint8_t bitshift;
- uint16_t t=0;
- byteshift = shift/8;
- bitshift = shift&7;
- if(byteshift >= a->length_W){ /* we would shift out more than we have */
- bigint_set_zero(a);
- return;
- }
- if(byteshift == a->length_W-1 && bitshift>GET_FBS(a)){
- bigint_set_zero(a);
- return;
- }
- if(byteshift){
- memmove(a->wordv, a->wordv+byteshift, a->length_W-byteshift);
- memset(a->wordv+a->length_W-byteshift, 0, byteshift);
- }
- if(bitshift!=0){
- /* shift to the right */
- for(i=a->length_W-byteshift-1; i>0; --i){
- t |= (a->wordv[i])<<(8-bitshift);
- a->wordv[i] = (uint8_t)(t>>8);
- t <<= 8;
- }
- t |= (a->wordv[0])<<(8-bitshift);
- a->wordv[0] = (uint8_t)(t>>8);
- }
- a->length_W -= byteshift;
- bigint_adjust(a);
+void bigint_shiftright(bigint_t *a, uint16_t shift)
+{
+ uint16_t byteshift;
+ uint16_t i;
+ uint8_t bitshift;
+ uint16_t t = 0;
+ byteshift = shift / 8;
+ bitshift = shift & 7;
+ if (byteshift >= a->length_W) { /* we would shift out more than we have */
+ bigint_set_zero(a);
+ return;
+ }
+ if (byteshift == a->length_W - 1 && bitshift > GET_FBS(a)) {
+ bigint_set_zero(a);
+ return;
+ }
+ if (byteshift) {
+ memmove(a->wordv, a->wordv + byteshift, a->length_W - byteshift);
+ memset(a->wordv + a->length_W - byteshift, 0, byteshift);
+ }
+ if (bitshift != 0) {
+ /* shift to the right */
+ for (i = a->length_W - byteshift - 1; i > 0; --i) {
+ t |= (a->wordv[i]) << (8 - bitshift);
+ a->wordv[i] = (uint8_t) (t >> 8);
+ t <<= 8;
+ }
+ t |= (a->wordv[0]) << (8 - bitshift);
+ a->wordv[0] = (uint8_t) (t >> 8);
+ }
+ a->length_W -= byteshift;
+ bigint_adjust(a);
}
/******************************************************************************/
-void bigint_xor(bigint_t *dest, const bigint_t *a){
- uint16_t i;
- for(i=0; i<a->length_W; ++i){
- dest->wordv[i] ^= a->wordv[i];
- }
- bigint_adjust(dest);
+void bigint_xor(bigint_t *dest, const bigint_t *a)
+{
+ uint16_t i;
+ for (i = 0; i < a->length_W; ++i) {
+ dest->wordv[i] ^= a->wordv[i];
+ }
+ bigint_adjust(dest);
}
/******************************************************************************/
-void bigint_set_zero(bigint_t *a){
- a->length_W=0;
+void bigint_set_zero(bigint_t *a)
+{
+ a->length_W = 0;
}
/******************************************************************************/
/* using the Karatsuba-Algorithm */
/* x*y = (xh*yh)*b**2n + ((xh+xl)*(yh+yl) - xh*yh - xl*yl)*b**n + yh*yl */
-void bigint_mul_u(bigint_t *dest, const bigint_t *a, const bigint_t *b){
- if(a->length_W==0 || b->length_W==0){
- bigint_set_zero(dest);
- return;
- }
- if(dest==a || dest==b){
- bigint_t d;
- uint8_t d_b[a->length_W+b->length_W];
- d.wordv = d_b;
- bigint_mul_u(&d, a, b);
- bigint_copy(dest, &d);
- return;
- }
- if(a->length_W==1 || b->length_W==1){
- if(a->length_W!=1){
- XCHG_PTR(a,b);
- }
- uint16_t i, t=0;
- uint8_t x = a->wordv[0];
- for(i=0; i<b->length_W; ++i){
- t += b->wordv[i]*x;
- dest->wordv[i] = (uint8_t)t;
- t>>=8;
- }
- dest->wordv[i] = (uint8_t)t;
- dest->length_W=i+1;
- bigint_adjust(dest);
- return;
- }
- if(a->length_W<=4 && b->length_W<=4){
- uint32_t p=0, q=0;
- uint64_t r;
- memcpy(&p, a->wordv, a->length_W);
- memcpy(&q, b->wordv, b->length_W);
- r = (uint64_t)p*(uint64_t)q;
- memcpy(dest->wordv, &r, a->length_W+b->length_W);
- dest->length_W = a->length_W+b->length_W;
- bigint_adjust(dest);
- return;
- }
- bigint_set_zero(dest);
- /* split a in xh & xl; split b in yh & yl */
- uint16_t n;
- n=(MAX(a->length_W, b->length_W)+1)/2;
- bigint_t xl, xh, yl, yh;
- xl.wordv = a->wordv;
- yl.wordv = b->wordv;
- if(a->length_W<=n){
- xh.info=0;
- xh.length_W = 0;
- xl.length_W = a->length_W;
- xl.info = 0;
- }else{
- xl.length_W=n;
- xl.info = 0;
- bigint_adjust(&xl);
- xh.wordv = a->wordv+n;
- xh.length_W = a->length_W-n;
- xh.info = 0;
- }
- if(b->length_W<=n){
- yh.info=0;
- yh.length_W = 0;
- yl.length_W = b->length_W;
- yl.info = b->info;
- }else{
- yl.length_W=n;
- yl.info = 0;
- bigint_adjust(&yl);
- yh.wordv = b->wordv+n;
- yh.length_W = b->length_W-n;
- yh.info = 0;
- }
- /* now we have split up a and b */
- uint8_t tmp_b[2*n+2], m_b[2*(n+1)];
- bigint_t tmp, tmp2, m;
- tmp.wordv = tmp_b;
- tmp2.wordv = tmp_b+n+1;
- m.wordv = m_b;
-
- bigint_mul_u(dest, &xl, &yl); /* dest <= xl*yl */
- bigint_add_u(&tmp2, &xh, &xl); /* tmp2 <= xh+xl */
- bigint_add_u(&tmp, &yh, &yl); /* tmp <= yh+yl */
- bigint_mul_u(&m, &tmp2, &tmp); /* m <= tmp2*tmp */
- bigint_mul_u(&tmp, &xh, &yh); /* h <= xh*yh */
- bigint_sub_u(&m, &m, dest); /* m <= m-dest */
- bigint_sub_u(&m, &m, &tmp); /* m <= m-h */
- bigint_add_scale_u(dest, &m, n);
- bigint_add_scale_u(dest, &tmp, 2*n);
+void bigint_mul_u(bigint_t *dest, const bigint_t *a, const bigint_t *b)
+{
+ if (a->length_W == 0 || b->length_W == 0) {
+ bigint_set_zero(dest);
+ return;
+ }
+ if (dest == a || dest == b) {
+ bigint_t d;
+ uint8_t d_b[a->length_W + b->length_W];
+ d.wordv = d_b;
+ bigint_mul_u(&d, a, b);
+ bigint_copy(dest, &d);
+ return;
+ }
+ if (a->length_W == 1 || b->length_W == 1) {
+ if (a->length_W != 1) {
+ XCHG_PTR(a, b);
+ }
+ uint16_t i, t = 0;
+ uint8_t x = a->wordv[0];
+ for (i = 0; i < b->length_W; ++i) {
+ t += b->wordv[i] * x;
+ dest->wordv[i] = (uint8_t) t;
+ t >>= 8;
+ }
+ dest->wordv[i] = (uint8_t) t;
+ dest->length_W = i + 1;
+ bigint_adjust(dest);
+ return;
+ }
+ if (a->length_W <= 4 && b->length_W <= 4) {
+ uint32_t p = 0, q = 0;
+ uint64_t r;
+ memcpy(&p, a->wordv, a->length_W);
+ memcpy(&q, b->wordv, b->length_W);
+ r = (uint64_t) p * (uint64_t) q;
+ memcpy(dest->wordv, &r, a->length_W + b->length_W);
+ dest->length_W = a->length_W + b->length_W;
+ bigint_adjust(dest);
+ return;
+ }
+ bigint_set_zero(dest);
+ /* split a in xh & xl; split b in yh & yl */
+ uint16_t n;
+ n = (MAX(a->length_W, b->length_W) + 1) / 2;
+ bigint_t xl, xh, yl, yh;
+ xl.wordv = a->wordv;
+ yl.wordv = b->wordv;
+ if (a->length_W <= n) {
+ xh.info = 0;
+ xh.length_W = 0;
+ xl.length_W = a->length_W;
+ xl.info = 0;
+ } else {
+ xl.length_W = n;
+ xl.info = 0;
+ bigint_adjust(&xl);
+ xh.wordv = a->wordv + n;
+ xh.length_W = a->length_W - n;
+ xh.info = 0;
+ }
+ if (b->length_W <= n) {
+ yh.info = 0;
+ yh.length_W = 0;
+ yl.length_W = b->length_W;
+ yl.info = b->info;
+ } else {
+ yl.length_W = n;
+ yl.info = 0;
+ bigint_adjust(&yl);
+ yh.wordv = b->wordv + n;
+ yh.length_W = b->length_W - n;
+ yh.info = 0;
+ }
+ /* now we have split up a and b */
+ uint8_t tmp_b[2 * n + 2], m_b[2 * (n + 1)];
+ bigint_t tmp, tmp2, m;
+ tmp.wordv = tmp_b;
+ tmp2.wordv = tmp_b + n + 1;
+ m.wordv = m_b;
+
+ bigint_mul_u(dest, &xl, &yl); /* dest <= xl*yl */
+ bigint_add_u(&tmp2, &xh, &xl); /* tmp2 <= xh+xl */
+ bigint_add_u(&tmp, &yh, &yl); /* tmp <= yh+yl */
+ bigint_mul_u(&m, &tmp2, &tmp); /* m <= tmp2*tmp */
+ bigint_mul_u(&tmp, &xh, &yh); /* h <= xh*yh */
+ bigint_sub_u(&m, &m, dest); /* m <= m-dest */
+ bigint_sub_u(&m, &m, &tmp); /* m <= m-h */
+ bigint_add_scale_u(dest, &m, n);
+ bigint_add_scale_u(dest, &tmp, 2 * n);
}
/******************************************************************************/
-void bigint_mul_s(bigint_t *dest, const bigint_t *a, const bigint_t *b){
- uint8_t s;
- s = GET_SIGN(a)?2:0;
- s |= GET_SIGN(b)?1:0;
- switch(s){
- case 0: /* both positive */
- bigint_mul_u(dest, a,b);
- SET_POS(dest);
- break;
- case 1: /* a positive, b negative */
- bigint_mul_u(dest, a,b);
- SET_NEG(dest);
- break;
- case 2: /* a negative, b positive */
- bigint_mul_u(dest, a,b);
- SET_NEG(dest);
- break;
- case 3: /* both negative */
- bigint_mul_u(dest, a,b);
- SET_POS(dest);
- break;
- default: /* how can this happen?*/
- break;
- }
+void bigint_mul_s(bigint_t *dest, const bigint_t *a, const bigint_t *b)
+{
+ uint8_t s;
+ s = GET_SIGN(a) ? 2 : 0;
+ s |= GET_SIGN(b) ? 1 : 0;
+ switch (s) {
+ case 0: /* both positive */
+ bigint_mul_u(dest, a, b);
+ SET_POS(dest);
+ break;
+ case 1: /* a positive, b negative */
+ bigint_mul_u(dest, a, b);
+ SET_NEG(dest);
+ break;
+ case 2: /* a negative, b positive */
+ bigint_mul_u(dest, a, b);
+ SET_NEG(dest);
+ break;
+ case 3: /* both negative */
+ bigint_mul_u(dest, a, b);
+ SET_POS(dest);
+ break;
+ default: /* how can this happen?*/
+ break;
+ }
}
/******************************************************************************/
/* square */
/* (xh*b^n+xl)^2 = xh^2*b^2n + 2*xh*xl*b^n + xl^2 */
-void bigint_square(bigint_t *dest, const bigint_t *a){
- if(a->length_W<=4){
- uint64_t r=0;
- memcpy(&r, a->wordv, a->length_W);
- r = r*r;
- memcpy(dest->wordv, &r, 2*a->length_W);
- SET_POS(dest);
- dest->length_W=2*a->length_W;
- bigint_adjust(dest);
- return;
- }
- if(dest==a){
- bigint_t d;
- uint8_t d_b[a->length_W*2];
- d.wordv = d_b;
- bigint_square(&d, a);
- bigint_copy(dest, &d);
- return;
- }
- uint16_t n;
- n=(a->length_W+1)/2;
- bigint_t xh, xl, tmp; /* x-high, x-low, temp */
- uint8_t buffer[2*n+1];
- xl.wordv = a->wordv;
- xl.length_W = n;
- xh.wordv = a->wordv+n;
- xh.length_W = a->length_W-n;
- tmp.wordv = buffer;
- bigint_square(dest, &xl);
- bigint_square(&tmp, &xh);
- bigint_add_scale_u(dest, &tmp, 2*n);
- bigint_mul_u(&tmp, &xl, &xh);
- bigint_shiftleft(&tmp, 1);
- bigint_add_scale_u(dest, &tmp, n);
+void bigint_square(bigint_t *dest, const bigint_t *a)
+{
+ if (a->length_W <= 4) {
+ uint64_t r = 0;
+ memcpy(&r, a->wordv, a->length_W);
+ r = r * r;
+ memcpy(dest->wordv, &r, 2 * a->length_W);
+ SET_POS(dest);
+ dest->length_W = 2 * a->length_W;
+ bigint_adjust(dest);
+ return;
+ }
+ if (dest == a) {
+ bigint_t d;
+ uint8_t d_b[a->length_W * 2];
+ d.wordv = d_b;
+ bigint_square(&d, a);
+ bigint_copy(dest, &d);
+ return;
+ }
+ uint16_t n;
+ n = (a->length_W + 1) / 2;
+ bigint_t xh, xl, tmp; /* x-high, x-low, temp */
+ uint8_t buffer[2 * n + 1];
+ xl.wordv = a->wordv;
+ xl.length_W = n;
+ xh.wordv = a->wordv + n;
+ xh.length_W = a->length_W - n;
+ tmp.wordv = buffer;
+ bigint_square(dest, &xl);
+ bigint_square(&tmp, &xh);
+ bigint_add_scale_u(dest, &tmp, 2 * n);
+ bigint_mul_u(&tmp, &xl, &xh);
+ bigint_shiftleft(&tmp, 1);
+ bigint_add_scale_u(dest, &tmp, n);
}
/******************************************************************************/
-void bigint_sub_u_bitscale(bigint_t *a, const bigint_t *b, uint16_t bitscale){
- bigint_t tmp;
- uint8_t tmp_b[b->length_W+1];
- uint16_t i,j,byteshift=bitscale/8;
- uint8_t borrow=0;
- int16_t t;
-
- if(a->length_W < b->length_W+byteshift){
- bigint_set_zero(a);
- return;
- }
-
- tmp.wordv = tmp_b;
- bigint_copy(&tmp, b);
- bigint_shiftleft(&tmp, bitscale&7);
-
- for(j=0,i=byteshift; i<tmp.length_W+byteshift; ++i, ++j){
- t = a->wordv[i] - tmp.wordv[j] - borrow;
- a->wordv[i] = (uint8_t)t;
- if(t<0){
- borrow = 1;
- }else{
- borrow = 0;
- }
- }
- while(borrow){
- if(i+1 > a->length_W){
- bigint_set_zero(a);
- return;
- }
- a->wordv[i] -= borrow;
- if(a->wordv[i]!=0xff){
- borrow=0;
- }
- ++i;
- }
- bigint_adjust(a);
+void bigint_sub_u_bitscale(bigint_t *a, const bigint_t *b, uint16_t bitscale)
+{
+ bigint_t tmp;
+ uint8_t tmp_b[b->length_W + 1];
+ uint16_t i, j, byteshift = bitscale / 8;
+ uint8_t borrow = 0;
+ int16_t t;
+
+ if (a->length_W < b->length_W + byteshift) {
+ bigint_set_zero(a);
+ return;
+ }
+
+ tmp.wordv = tmp_b;
+ bigint_copy(&tmp, b);
+ bigint_shiftleft(&tmp, bitscale & 7);
+
+ for (j = 0, i = byteshift; i < tmp.length_W + byteshift; ++i, ++j) {
+ t = a->wordv[i] - tmp.wordv[j] - borrow;
+ a->wordv[i] = (uint8_t) t;
+ if (t < 0) {
+ borrow = 1;
+ } else {
+ borrow = 0;
+ }
+ }
+ while (borrow) {
+ if (i + 1 > a->length_W) {
+ bigint_set_zero(a);
+ return;
+ }
+ a->wordv[i] -= borrow;
+ if (a->wordv[i] != 0xff) {
+ borrow = 0;
+ }
+ ++i;
+ }
+ bigint_adjust(a);
}
/******************************************************************************/
-void bigint_reduce(bigint_t *a, const bigint_t *r){
+void bigint_reduce(bigint_t *a, const bigint_t *r)
+{
// bigint_adjust(r);
- uint8_t rfbs = GET_FBS(r);
-
- if(r->length_W==0 || a->length_W==0){
- return;
- }
- while(a->length_W > r->length_W){
- bigint_sub_u_bitscale(a, r, (a->length_W-r->length_W)*8+GET_FBS(a)-rfbs-1);
- }
- while((GET_FBS(a) > rfbs+1) && (a->length_W == r->length_W)){
- bigint_sub_u_bitscale(a, r, GET_FBS(a)-rfbs-1);
- }
- while(bigint_cmp_u(a,r)>=0){
- bigint_sub_u(a,a,r);
- }
- bigint_adjust(a);
+ uint8_t rfbs = GET_FBS(r);
+
+ if (r->length_W == 0 || a->length_W == 0) {
+ return;
+ }
+ while (a->length_W > r->length_W) {
+ bigint_sub_u_bitscale(a, r, (a->length_W - r->length_W) * 8 + GET_FBS(a)
+ - rfbs - 1);
+ }
+ while ((GET_FBS(a) > rfbs + 1) && (a->length_W == r->length_W)) {
+ bigint_sub_u_bitscale(a, r, GET_FBS(a) - rfbs - 1);
+ }
+ while (bigint_cmp_u(a, r) >= 0) {
+ bigint_sub_u(a, a, r);
+ }
+ bigint_adjust(a);
}
/******************************************************************************/
/* calculate dest = a**exp % r */
/* using square&multiply */
-void bigint_expmod_u(bigint_t *dest, const bigint_t *a, const bigint_t *exp, const bigint_t *r){
- if(a->length_W==0 || r->length_W==0){
- return;
- }
-
- bigint_t res, base;
- uint8_t base_b[MAX(a->length_W,r->length_W*2)], res_b[r->length_W*2];
- uint16_t i;
- uint8_t j, t;
- res.wordv = res_b;
- base.wordv = base_b;
- bigint_copy(&base, a);
- bigint_reduce(&base, r);
- res.wordv[0]=1;
- res.length_W=1;
- res.info = 0;
- bigint_adjust(&res);
- for(i=0; i+1<exp->length_W; ++i){
- t=exp->wordv[i];
- for(j=0; j<8; ++j){
- if(t&1){
- bigint_mul_u(&res, &res, &base);
- bigint_reduce(&res, r);
- }
- bigint_square(&base, &base);
- bigint_reduce(&base, r);
- t>>=1;
- }
- }
- t=exp->wordv[i];
- while(t){
- if(t&1){
- bigint_mul_u(&res, &res, &base);
- bigint_reduce(&res, r);
- }
- bigint_square(&base, &base);
- bigint_reduce(&base, r);
- t>>=1;
- }
- SET_POS(&res);
- bigint_copy(dest, &res);
+void bigint_expmod_u(bigint_t *dest, const bigint_t *a, const bigint_t *exp,
+ const bigint_t *r)
+{
+ if (a->length_W == 0 || r->length_W == 0) {
+ return;
+ }
+
+ bigint_t res, base;
+ uint8_t base_b[MAX(a->length_W, r->length_W * 2)], res_b[r->length_W * 2];
+ uint16_t i;
+ uint8_t j, t;
+ res.wordv = res_b;
+ base.wordv = base_b;
+ bigint_copy(&base, a);
+ bigint_reduce(&base, r);
+ res.wordv[0] = 1;
+ res.length_W = 1;
+ res.info = 0;
+ bigint_adjust(&res);
+ for (i = 0; i + 1 < exp->length_W; ++i) {
+ t = exp->wordv[i];
+ for (j = 0; j < 8; ++j) {
+ if (t & 1) {
+ bigint_mul_u(&res, &res, &base);
+ bigint_reduce(&res, r);
+ }
+ bigint_square(&base, &base);
+ bigint_reduce(&base, r);
+ t >>= 1;
+ }
+ }
+ t = exp->wordv[i];
+ while (t) {
+ if (t & 1) {
+ bigint_mul_u(&res, &res, &base);
+ bigint_reduce(&res, r);
+ }
+ bigint_square(&base, &base);
+ bigint_reduce(&base, r);
+ t >>= 1;
+ }
+ SET_POS(&res);
+ bigint_copy(dest, &res);
}
/******************************************************************************/
/* gcd <-- gcd(x,y) a*x+b*y=gcd */
-void bigint_gcdext(bigint_t *gcd, bigint_t *a, bigint_t *b, const bigint_t *x, const bigint_t *y){
- bigint_t g, x_, y_, u, v, a_, b_, c_, d_;
- volatile uint16_t i=0;
- if(x->length_W==0 || y->length_W==0){
- return;
- }
- while(x->wordv[i]==0 && y->wordv[i]==0){
- ++i;
- }
- uint8_t g_b[i+2], x_b[x->length_W-i], y_b[y->length_W-i];
- uint8_t u_b[x->length_W-i], v_b[y->length_W-i];
- uint8_t a_b[y->length_W+2], c_b[y->length_W+2];
- uint8_t b_b[x->length_W+2], d_b[x->length_W+2];
-
- g.wordv = g_b;
- x_.wordv = x_b;
- y_.wordv = y_b;
- memset(g_b, 0, i);
- g_b[i]=1;
- g.length_W = i+1;
- g.info=0;
- x_.info = y_.info = 0;
- x_.length_W = x->length_W-i;
- y_.length_W = y->length_W-i;
- memcpy(x_.wordv, x->wordv+i, x_.length_W);
- memcpy(y_.wordv, y->wordv+i, y_.length_W);
- for(i=0; (x_.wordv[0]&(1<<i))==0 && (y_.wordv[0]&(1<<i))==0; ++i){
- }
-
- bigint_adjust(&x_);
- bigint_adjust(&y_);
-
- if(i){
- bigint_shiftleft(&g, i);
- bigint_shiftright(&x_, i);
- bigint_shiftright(&y_, i);
- }
- u.wordv = u_b;
- v.wordv = v_b;
- a_.wordv = a_b;
- b_.wordv = b_b;
- c_.wordv = c_b;
- d_.wordv = d_b;
-
- bigint_copy(&u, &x_);
- bigint_copy(&v, &y_);
- a_.wordv[0] = 1;
- a_.length_W = 1;
- a_.info = 0;
- d_.wordv[0] = 1;
- d_.length_W = 1;
- d_.info = 0;
- bigint_set_zero(&b_);
- bigint_set_zero(&c_);
- do{
- while((u.wordv[0]&1)==0){
- bigint_shiftright(&u, 1);
- if((a_.wordv[0]&1) || (b_.wordv[0]&1)){
- bigint_add_s(&a_, &a_, &y_);
- bigint_sub_s(&b_, &b_, &x_);
- }
- bigint_shiftright(&a_, 1);
- bigint_shiftright(&b_, 1);
- }
- while((v.wordv[0]&1)==0){
- bigint_shiftright(&v, 1);
- if((c_.wordv[0]&1) || (d_.wordv[0]&1)){
- bigint_add_s(&c_, &c_, &y_);
- bigint_sub_s(&d_, &d_, &x_);
- }
- bigint_shiftright(&c_, 1);
- bigint_shiftright(&d_, 1);
-
- }
- if(bigint_cmp_u(&u, &v)>=0){
- bigint_sub_u(&u, &u, &v);
- bigint_sub_s(&a_, &a_, &c_);
- bigint_sub_s(&b_, &b_, &d_);
- }else{
- bigint_sub_u(&v, &v, &u);
- bigint_sub_s(&c_, &c_, &a_);
- bigint_sub_s(&d_, &d_, &b_);
- }
- }while(u.length_W);
- if(gcd){
- bigint_mul_s(gcd, &v, &g);
- }
- if(a){
- bigint_copy(a, &c_);
- }
- if(b){
- bigint_copy(b, &d_);
- }
+void bigint_gcdext(bigint_t *gcd, bigint_t *a, bigint_t *b, const bigint_t *x,
+ const bigint_t *y)
+{
+ bigint_t g, x_, y_, u, v, a_, b_, c_, d_;
+ volatile uint16_t i = 0;
+ if (x->length_W == 0 || y->length_W == 0) {
+ return;
+ }
+ while (x->wordv[i] == 0 && y->wordv[i] == 0) {
+ ++i;
+ }
+ uint8_t g_b[i + 2], x_b[x->length_W - i], y_b[y->length_W - i];
+ uint8_t u_b[x->length_W - i], v_b[y->length_W - i];
+ uint8_t a_b[y->length_W + 2], c_b[y->length_W + 2];
+ uint8_t b_b[x->length_W + 2], d_b[x->length_W + 2];
+
+ g.wordv = g_b;
+ x_.wordv = x_b;
+ y_.wordv = y_b;
+ memset(g_b, 0, i);
+ g_b[i] = 1;
+ g.length_W = i + 1;
+ g.info = 0;
+ x_.info = y_.info = 0;
+ x_.length_W = x->length_W - i;
+ y_.length_W = y->length_W - i;
+ memcpy(x_.wordv, x->wordv + i, x_.length_W);
+ memcpy(y_.wordv, y->wordv + i, y_.length_W);
+ for (i = 0; (x_.wordv[0] & (1 << i)) == 0 && (y_.wordv[0] & (1 << i)) == 0;
+ ++i) {
+ }
+
+ bigint_adjust(&x_);
+ bigint_adjust(&y_);
+
+ if (i) {
+ bigint_shiftleft(&g, i);
+ bigint_shiftright(&x_, i);
+ bigint_shiftright(&y_, i);
+ }
+ u.wordv = u_b;
+ v.wordv = v_b;
+ a_.wordv = a_b;
+ b_.wordv = b_b;
+ c_.wordv = c_b;
+ d_.wordv = d_b;
+
+ bigint_copy(&u, &x_);
+ bigint_copy(&v, &y_);
+ a_.wordv[0] = 1;
+ a_.length_W = 1;
+ a_.info = 0;
+ d_.wordv[0] = 1;
+ d_.length_W = 1;
+ d_.info = 0;
+ bigint_set_zero(&b_);
+ bigint_set_zero(&c_);
+ do {
+ while ((u.wordv[0] & 1) == 0) {
+ bigint_shiftright(&u, 1);
+ if ((a_.wordv[0] & 1) || (b_.wordv[0] & 1)) {
+ bigint_add_s(&a_, &a_, &y_);
+ bigint_sub_s(&b_, &b_, &x_);
+ }
+ bigint_shiftright(&a_, 1);
+ bigint_shiftright(&b_, 1);
+ }
+ while ((v.wordv[0] & 1) == 0) {
+ bigint_shiftright(&v, 1);
+ if ((c_.wordv[0] & 1) || (d_.wordv[0] & 1)) {
+ bigint_add_s(&c_, &c_, &y_);
+ bigint_sub_s(&d_, &d_, &x_);
+ }
+ bigint_shiftright(&c_, 1);
+ bigint_shiftright(&d_, 1);
+
+ }
+ if (bigint_cmp_u(&u, &v) >= 0) {
+ bigint_sub_u(&u, &u, &v);
+ bigint_sub_s(&a_, &a_, &c_);
+ bigint_sub_s(&b_, &b_, &d_);
+ } else {
+ bigint_sub_u(&v, &v, &u);
+ bigint_sub_s(&c_, &c_, &a_);
+ bigint_sub_s(&d_, &d_, &b_);
+ }
+ } while (u.length_W);
+ if (gcd) {
+ bigint_mul_s(gcd, &v, &g);
+ }
+ if (a) {
+ bigint_copy(a, &c_);
+ }
+ if (b) {
+ bigint_copy(b, &d_);
+ }
}
/******************************************************************************/
-void bigint_inverse(bigint_t *dest, const bigint_t *a, const bigint_t *m){
- bigint_gcdext(NULL, dest, NULL, a, m);
- while(dest->info&BIGINT_NEG_MASK){
- bigint_add_s(dest, dest, m);
- }
+void bigint_inverse(bigint_t *dest, const bigint_t *a, const bigint_t *m)
+{
+ bigint_gcdext(NULL, dest, NULL, a, m);
+ while (dest->info & BIGINT_NEG_MASK) {
+ bigint_add_s(dest, dest, m);
+ }
}
/******************************************************************************/
-void bigint_changeendianess(bigint_t *a){
- uint8_t t, *p, *q;
- p = a->wordv;
- q = p+a->length_W-1;
- while(p<q){
- t = *p;
- *p = *q;
- *q = t;
- ++p; --q;
- }
+void bigint_changeendianess(bigint_t *a)
+{
+ uint8_t t, *p, *q;
+ p = a->wordv;
+ q = p + a->length_W - 1;
+ while (p < q) {
+ t = *p;
+ *p = *q;
+ *q = t;
+ ++p;
+ --q;
+ }
}
/******************************************************************************/
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
if(b){
bigint_copy(b, &d_);
}
+
+ FREE(d_w);
+ FREE(b_w);
+ FREE(c_w);
+ FREE(a_w);
+ FREE(v_w);
+ FREE(u_w);
+ FREE(y_w);
+ FREE(x_w);
+ FREE(g_w);
}
/******************************************************************************/
#include <stdint.h>
#include <limits.h>
-#define BIGINT_WORD_SIZE 32
+#define BIGINT_WORD_SIZE 8
#if BIGINT_WORD_SIZE == 8
typedef uint8_t bigint_word_t;
/* blake_common.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2009 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2009 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/*
* \file blake_common.c
* \author Daniel Otte
#include <avr/pgmspace.h>
const uint8_t blake_sigma[] PROGMEM = {
- 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
- 0xEA, 0x48, 0x9F, 0xD6, 0x1C, 0x02, 0xB7, 0x53,
- 0xB8, 0xC0, 0x52, 0xFD, 0xAE, 0x36, 0x71, 0x94,
- 0x79, 0x31, 0xDC, 0xBE, 0x26, 0x5A, 0x40, 0xF8,
- 0x90, 0x57, 0x24, 0xAF, 0xE1, 0xBC, 0x68, 0x3D,
- 0x2C, 0x6A, 0x0B, 0x83, 0x4D, 0x75, 0xFE, 0x19,
- 0xC5, 0x1F, 0xED, 0x4A, 0x07, 0x63, 0x92, 0x8B,
- 0xDB, 0x7E, 0xC1, 0x39, 0x50, 0xF4, 0x86, 0x2A,
- 0x6F, 0xE9, 0xB3, 0x08, 0xC2, 0xD7, 0x14, 0xA5,
- 0xA2, 0x84, 0x76, 0x15, 0xFB, 0x9E, 0x3C, 0xD0,
+ 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
+ 0xEA, 0x48, 0x9F, 0xD6, 0x1C, 0x02, 0xB7, 0x53,
+ 0xB8, 0xC0, 0x52, 0xFD, 0xAE, 0x36, 0x71, 0x94,
+ 0x79, 0x31, 0xDC, 0xBE, 0x26, 0x5A, 0x40, 0xF8,
+ 0x90, 0x57, 0x24, 0xAF, 0xE1, 0xBC, 0x68, 0x3D,
+ 0x2C, 0x6A, 0x0B, 0x83, 0x4D, 0x75, 0xFE, 0x19,
+ 0xC5, 0x1F, 0xED, 0x4A, 0x07, 0x63, 0x92, 0x8B,
+ 0xDB, 0x7E, 0xC1, 0x39, 0x50, 0xF4, 0x86, 0x2A,
+ 0x6F, 0xE9, 0xB3, 0x08, 0xC2, 0xD7, 0x14, 0xA5,
+ 0xA2, 0x84, 0x76, 0x15, 0xFB, 0x9E, 0x3C, 0xD0,
};
const uint8_t blake_index_lut[] PROGMEM = {
- 0x0, 0x4, 0x8, 0xC,
- 0x1, 0x5, 0x9, 0xD,
- 0x2, 0x6, 0xA, 0xE,
- 0x3, 0x7, 0xB, 0xF,
- 0x0, 0x5, 0xA, 0xF,
- 0x1, 0x6, 0xB, 0xC,
- 0x2, 0x7, 0x8, 0xD,
- 0x3, 0x4, 0x9, 0xE
+ 0x0, 0x4, 0x8, 0xC,
+ 0x1, 0x5, 0x9, 0xD,
+ 0x2, 0x6, 0xA, 0xE,
+ 0x3, 0x7, 0xB, 0xF,
+ 0x0, 0x5, 0xA, 0xF,
+ 0x1, 0x6, 0xB, 0xC,
+ 0x2, 0x7, 0x8, 0xD,
+ 0x3, 0x4, 0x9, 0xE
};
-
/* blake_common.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2009 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2009 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/*
* \file blake_common.h
* \author Daniel Otte
*
*/
-
#ifndef BLAKE_COMMON_H_
#define BLAKE_COMMON_H_
/* blake_large.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2009 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2009 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/*
* \file blake_large.c
* \author Daniel Otte
#include "blake_large.h"
#include "blake_common.h"
-static
-uint64_t pgm_read_qword(const void *p){
- union{
- uint64_t v64;
- uint32_t v32[2];
- }r;
- r.v32[0] = pgm_read_dword(p);
- r.v32[1] = pgm_read_dword((uint8_t*)p+4);
- return r.v64;
+static uint64_t pgm_read_qword(const void *p)
+{
+ union {
+ uint64_t v64;
+ uint32_t v32[2];
+ } r;
+ r.v32[0] = pgm_read_dword(p);
+ r.v32[1] = pgm_read_dword((uint8_t* )p + 4);
+ return r.v64;
}
-static
-const uint64_t blake_c[] PROGMEM = {
- 0x243F6A8885A308D3LL, 0x13198A2E03707344LL,
- 0xA4093822299F31D0LL, 0x082EFA98EC4E6C89LL,
- 0x452821E638D01377LL, 0xBE5466CF34E90C6CLL,
- 0xC0AC29B7C97C50DDLL, 0x3F84D5B5B5470917LL,
- 0x9216D5D98979FB1BLL, 0xD1310BA698DFB5ACLL,
- 0x2FFD72DBD01ADFB7LL, 0xB8E1AFED6A267E96LL,
- 0xBA7C9045F12C7F99LL, 0x24A19947B3916CF7LL,
- 0x0801F2E2858EFC16LL, 0x636920D871574E69LL
+static const uint64_t blake_c[] PROGMEM = {
+ 0x243F6A8885A308D3LL, 0x13198A2E03707344LL,
+ 0xA4093822299F31D0LL, 0x082EFA98EC4E6C89LL,
+ 0x452821E638D01377LL, 0xBE5466CF34E90C6CLL,
+ 0xC0AC29B7C97C50DDLL, 0x3F84D5B5B5470917LL,
+ 0x9216D5D98979FB1BLL, 0xD1310BA698DFB5ACLL,
+ 0x2FFD72DBD01ADFB7LL, 0xB8E1AFED6A267E96LL,
+ 0xBA7C9045F12C7F99LL, 0x24A19947B3916CF7LL,
+ 0x0801F2E2858EFC16LL, 0x636920D871574E69LL
};
-
-
#define ROTL64(a, n) (((a)<<(n))|((a)>>(64-(n))))
#define ROTR64(a, n) (((a)>>(n))|((a)<<(64-(n))))
#define CHANGE_ENDIAN32(a) (((a)<<24)| \
(a)>>24 )
static
-void blake_large_expand(uint64_t *v, const blake_large_ctx_t *ctx){
- uint8_t i;
- memcpy(v, ctx->h, 8*8);
- for(i=0; i<8; ++i){
- v[8+i] = pgm_read_qword(&(blake_c[i]));
- }
- memxor((uint8_t*)v+8, ctx->s, 4*8);
+void blake_large_expand(uint64_t *v, const blake_large_ctx_t *ctx)
+{
+ uint8_t i;
+ memcpy(v, ctx->h, 8 * 8);
+ for (i = 0; i < 8; ++i) {
+ v[8 + i] = pgm_read_qword(&(blake_c[i]));
+ }
+ memxor((uint8_t*) v + 8, ctx->s, 4 * 8);
}
static
-void blake_large_changeendian(void *dest, const void *src){
- uint8_t i;
- uint32_t tmp;
- for(i=0; i<32; i+=2){
- tmp = CHANGE_ENDIAN32(((uint32_t*)src)[i]);
- ((uint32_t*)dest)[i] = CHANGE_ENDIAN32(((uint32_t*)src)[i+1]);
- ((uint32_t*)dest)[i+1] = tmp;
- }
+void blake_large_changeendian(void *dest, const void *src)
+{
+ uint8_t i;
+ uint32_t tmp;
+ for (i = 0; i < 32; i += 2) {
+ tmp = CHANGE_ENDIAN32(((uint32_t* )src)[i]);
+ ((uint32_t*) dest)[i] = CHANGE_ENDIAN32(((uint32_t* )src)[i + 1]);
+ ((uint32_t*) dest)[i + 1] = tmp;
+ }
}
static
-void blake_large_compress(uint64_t *v,const void *m){
- uint8_t r,i;
- uint8_t a,b,c,d, s0, s1, sigma_idx=0;
- for(r=0; r<16; ++r){
- for(i=0; i<8; ++i){
- a = pgm_read_byte(blake_index_lut+4*i+0);
- b = pgm_read_byte(blake_index_lut+4*i+1);
- c = pgm_read_byte(blake_index_lut+4*i+2);
- d = pgm_read_byte(blake_index_lut+4*i+3);
- s0 = pgm_read_byte(blake_sigma+sigma_idx);
- s1 = s0&0x0f;
- s0 >>= 4;
- ++sigma_idx;
- if(sigma_idx>=80){
- sigma_idx-=80;
- }
- v[a] += v[b] + (((uint64_t*)m)[s0] ^ pgm_read_qword(&(blake_c[s1])));
- v[d] = ROTR64(v[d]^v[a], 32);
- v[c] += v[d];
- v[b] = ROTR64(v[b]^v[c], 25);
- v[a] += v[b] + (((uint64_t*)m)[s1] ^ pgm_read_qword(&(blake_c[s0])));
- v[d] = ROTR64(v[d]^v[a], 16);
- v[c] += v[d];
- v[b] = ROTR64(v[b]^v[c], 11);
- }
- }
+void blake_large_compress(uint64_t *v, const void *m)
+{
+ uint8_t r, i;
+ uint8_t a, b, c, d, s0, s1, sigma_idx = 0;
+ for (r = 0; r < 16; ++r) {
+ for (i = 0; i < 8; ++i) {
+ a = pgm_read_byte(blake_index_lut + 4 * i + 0);
+ b = pgm_read_byte(blake_index_lut + 4 * i + 1);
+ c = pgm_read_byte(blake_index_lut + 4 * i + 2);
+ d = pgm_read_byte(blake_index_lut + 4 * i + 3);
+ s0 = pgm_read_byte(blake_sigma + sigma_idx);
+ s1 = s0 & 0x0f;
+ s0 >>= 4;
+ ++sigma_idx;
+ if (sigma_idx >= 80) {
+ sigma_idx -= 80;
+ }
+ v[a] += v[b]
+ + (((uint64_t*) m)[s0] ^ pgm_read_qword(&(blake_c[s1])));
+ v[d] = ROTR64(v[d] ^ v[a], 32);
+ v[c] += v[d];
+ v[b] = ROTR64(v[b] ^ v[c], 25);
+ v[a] += v[b]
+ + (((uint64_t*) m)[s1] ^ pgm_read_qword(&(blake_c[s0])));
+ v[d] = ROTR64(v[d] ^ v[a], 16);
+ v[c] += v[d];
+ v[b] = ROTR64(v[b] ^ v[c], 11);
+ }
+ }
}
static
-void blake_large_collapse(blake_large_ctx_t *ctx, uint64_t *v){
- uint8_t i;
- for(i=0; i<8; ++i){
- ctx->h[i] ^= ctx->s[i%4] ^ v[i] ^ v[8+i];
- }
+void blake_large_collapse(blake_large_ctx_t *ctx, uint64_t *v)
+{
+ uint8_t i;
+ for (i = 0; i < 8; ++i) {
+ ctx->h[i] ^= ctx->s[i % 4] ^ v[i] ^ v[8 + i];
+ }
}
-void blake_large_nextBlock(blake_large_ctx_t *ctx, const void *msg){
- uint64_t v[16];
- uint64_t m[16];
- union {
- uint64_t v64;
- uint32_t v32[2];
- }ctr;
- blake_large_expand(v,ctx);
- ctx->counter++;
- ctr.v64 = ctx->counter*1024;
- v[12] ^= ctr.v64;
- v[13] ^= ctr.v64;
- blake_large_changeendian(m, msg);
- blake_large_compress(v, m);
- blake_large_collapse(ctx, v);
+void blake_large_nextBlock(blake_large_ctx_t *ctx, const void *msg)
+{
+ uint64_t v[16];
+ uint64_t m[16];
+ union {
+ uint64_t v64;
+ uint32_t v32[2];
+ } ctr;
+ blake_large_expand(v, ctx);
+ ctx->counter++;
+ ctr.v64 = ctx->counter * 1024;
+ v[12] ^= ctr.v64;
+ v[13] ^= ctr.v64;
+ blake_large_changeendian(m, msg);
+ blake_large_compress(v, m);
+ blake_large_collapse(ctx, v);
}
-void blake_large_lastBlock(blake_large_ctx_t *ctx, const void *msg, uint16_t length_b){
- while(length_b>=BLAKE_LARGE_BLOCKSIZE){
- blake_large_nextBlock(ctx, msg);
- msg = (uint8_t*)msg + BLAKE_LARGE_BLOCKSIZE_B;
- length_b -= BLAKE_LARGE_BLOCKSIZE;
- }
- union {
- uint8_t v8[128];
- uint64_t v64[ 16];
- } buffer;
- uint64_t v[16];
- uint64_t ctr;
- ctr = ctx->counter*1024+length_b;
- memset(buffer.v8, 0, 128);
- memcpy(buffer.v8, msg, (length_b+7)/8);
- buffer.v8[length_b/8] |= 0x80 >> (length_b&0x7);
- blake_large_changeendian(buffer.v8, buffer.v8);
- blake_large_expand(v, ctx);
- if(length_b>1024-128-2){
- v[12] ^= ctr;
- v[13] ^= ctr;
- blake_large_compress(v, buffer.v8);
- blake_large_collapse(ctx, v);
- memset(buffer.v8, 0, 128-8);
- blake_large_expand(v, ctx);
- } else {
- if(length_b){
- v[12] ^= ctr;
- v[13] ^= ctr;
- }
- }
- if(ctx->appendone)
- buffer.v8[128-16-8] |= 0x01;
- buffer.v64[15] = ctr;
- blake_large_compress(v, buffer.v8);
- blake_large_collapse(ctx, v);
+void blake_large_lastBlock(blake_large_ctx_t *ctx, const void *msg,
+ uint16_t length_b)
+{
+ while (length_b >= BLAKE_LARGE_BLOCKSIZE) {
+ blake_large_nextBlock(ctx, msg);
+ msg = (uint8_t*) msg + BLAKE_LARGE_BLOCKSIZE_B;
+ length_b -= BLAKE_LARGE_BLOCKSIZE;
+ }
+ union {
+ uint8_t v8[128];
+ uint64_t v64[16];
+ } buffer;
+ uint64_t v[16];
+ uint64_t ctr;
+ ctr = ctx->counter * 1024 + length_b;
+ memset(buffer.v8, 0, 128);
+ memcpy(buffer.v8, msg, (length_b + 7) / 8);
+ buffer.v8[length_b / 8] |= 0x80 >> (length_b & 0x7);
+ blake_large_changeendian(buffer.v8, buffer.v8);
+ blake_large_expand(v, ctx);
+ if (length_b > 1024 - 128 - 2) {
+ v[12] ^= ctr;
+ v[13] ^= ctr;
+ blake_large_compress(v, buffer.v8);
+ blake_large_collapse(ctx, v);
+ memset(buffer.v8, 0, 128 - 8);
+ blake_large_expand(v, ctx);
+ } else {
+ if (length_b) {
+ v[12] ^= ctr;
+ v[13] ^= ctr;
+ }
+ }
+ if (ctx->appendone)
+ buffer.v8[128 - 16 - 8] |= 0x01;
+ buffer.v64[15] = ctr;
+ blake_large_compress(v, buffer.v8);
+ blake_large_collapse(ctx, v);
}
const uint64_t blake512_iv[] PROGMEM = {
- 0x6A09E667F3BCC908LL, 0xBB67AE8584CAA73BLL,
- 0x3C6EF372FE94F82BLL, 0xA54FF53A5F1D36F1LL,
- 0x510E527FADE682D1LL, 0x9B05688C2B3E6C1FLL,
- 0x1F83D9ABFB41BD6BLL, 0x5BE0CD19137E2179LL
+ 0x6A09E667F3BCC908LL, 0xBB67AE8584CAA73BLL,
+ 0x3C6EF372FE94F82BLL, 0xA54FF53A5F1D36F1LL,
+ 0x510E527FADE682D1LL, 0x9B05688C2B3E6C1FLL,
+ 0x1F83D9ABFB41BD6BLL, 0x5BE0CD19137E2179LL
};
-void blake512_init(blake512_ctx_t *ctx){
- uint8_t i;
- for(i=0; i<8; ++i){
- ctx->h[i] = pgm_read_qword(&(blake512_iv[i]));
- }
- memset(ctx->s, 0, 4*8);
- ctx->counter = 0;
- ctx->appendone = 1;
+void blake512_init(blake512_ctx_t *ctx)
+{
+ uint8_t i;
+ for (i = 0; i < 8; ++i) {
+ ctx->h[i] = pgm_read_qword(&(blake512_iv[i]));
+ }
+ memset(ctx->s, 0, 4 * 8);
+ ctx->counter = 0;
+ ctx->appendone = 1;
}
const uint64_t blake384_iv[] PROGMEM = {
- 0xCBBB9D5DC1059ED8LL, 0x629A292A367CD507LL,
- 0x9159015A3070DD17LL, 0x152FECD8F70E5939LL,
- 0x67332667FFC00B31LL, 0x8EB44A8768581511LL,
- 0xDB0C2E0D64F98FA7LL, 0x47B5481DBEFA4FA4LL
+ 0xCBBB9D5DC1059ED8LL, 0x629A292A367CD507LL,
+ 0x9159015A3070DD17LL, 0x152FECD8F70E5939LL,
+ 0x67332667FFC00B31LL, 0x8EB44A8768581511LL,
+ 0xDB0C2E0D64F98FA7LL, 0x47B5481DBEFA4FA4LL
};
-void blake384_init(blake384_ctx_t *ctx){
- uint8_t i;
- for(i=0; i<8; ++i){
- ctx->h[i] = pgm_read_qword(&(blake384_iv[i]));
- }
- memset(ctx->s, 0, 4*8);
- ctx->counter = 0;
- ctx->appendone = 0;
+void blake384_init(blake384_ctx_t *ctx)
+{
+ uint8_t i;
+ for (i = 0; i < 8; ++i) {
+ ctx->h[i] = pgm_read_qword(&(blake384_iv[i]));
+ }
+ memset(ctx->s, 0, 4 * 8);
+ ctx->counter = 0;
+ ctx->appendone = 0;
}
-void blake512_ctx2hash(void *dest, const blake512_ctx_t *ctx){
- uint8_t i;
- for(i=0; i<8; ++i){
- ((uint32_t*)dest)[2*i+0] = CHANGE_ENDIAN32((ctx->h[i])>>32);
- ((uint32_t*)dest)[2*i+1] = CHANGE_ENDIAN32((uint32_t)ctx->h[i]);
- }
+void blake512_ctx2hash(void *dest, const blake512_ctx_t *ctx)
+{
+ uint8_t i;
+ for (i = 0; i < 8; ++i) {
+ ((uint32_t*) dest)[2 * i + 0] = CHANGE_ENDIAN32((ctx->h[i]) >> 32);
+ ((uint32_t*) dest)[2 * i + 1] = CHANGE_ENDIAN32((uint32_t )ctx->h[i]);
+ }
}
-void blake384_ctx2hash(void *dest, const blake384_ctx_t *ctx){
- uint8_t i;
- for(i=0; i<6; ++i){
- ((uint32_t*)dest)[2*i+0] = CHANGE_ENDIAN32((ctx->h[i])>>32);
- ((uint32_t*)dest)[2*i+1] = CHANGE_ENDIAN32((uint32_t)ctx->h[i]);
- }
+void blake384_ctx2hash(void *dest, const blake384_ctx_t *ctx)
+{
+ uint8_t i;
+ for (i = 0; i < 6; ++i) {
+ ((uint32_t*) dest)[2 * i + 0] = CHANGE_ENDIAN32((ctx->h[i]) >> 32);
+ ((uint32_t*) dest)[2 * i + 1] = CHANGE_ENDIAN32((uint32_t )ctx->h[i]);
+ }
}
-void blake512_nextBlock(blake512_ctx_t *ctx, const void *block){
- blake_large_nextBlock(ctx, block);
+void blake512_nextBlock(blake512_ctx_t *ctx, const void *block)
+{
+ blake_large_nextBlock(ctx, block);
}
-void blake384_nextBlock(blake384_ctx_t *ctx, const void *block){
- blake_large_nextBlock(ctx, block);
+void blake384_nextBlock(blake384_ctx_t *ctx, const void *block)
+{
+ blake_large_nextBlock(ctx, block);
}
-void blake512_lastBlock(blake512_ctx_t *ctx, const void *block, uint16_t length_b){
- blake_large_lastBlock(ctx, block, length_b);
+void blake512_lastBlock(blake512_ctx_t *ctx, const void *block,
+ uint16_t length_b)
+{
+ blake_large_lastBlock(ctx, block, length_b);
}
-void blake384_lastBlock(blake384_ctx_t *ctx, const void *block, uint16_t length_b){
- blake_large_lastBlock(ctx, block, length_b);
+void blake384_lastBlock(blake384_ctx_t *ctx, const void *block,
+ uint16_t length_b)
+{
+ blake_large_lastBlock(ctx, block, length_b);
}
-void blake512(void *dest, const void *msg, uint32_t length_b){
- blake_large_ctx_t ctx;
- blake512_init(&ctx);
- while(length_b>=BLAKE_LARGE_BLOCKSIZE){
- blake_large_nextBlock(&ctx, msg);
- msg = (uint8_t*)msg + BLAKE_LARGE_BLOCKSIZE_B;
- length_b -= BLAKE_LARGE_BLOCKSIZE;
- }
- blake_large_lastBlock(&ctx, msg, length_b);
- blake512_ctx2hash(dest, &ctx);
+void blake512(void *dest, const void *msg, uint32_t length_b)
+{
+ blake_large_ctx_t ctx;
+ blake512_init(&ctx);
+ while (length_b >= BLAKE_LARGE_BLOCKSIZE) {
+ blake_large_nextBlock(&ctx, msg);
+ msg = (uint8_t*) msg + BLAKE_LARGE_BLOCKSIZE_B;
+ length_b -= BLAKE_LARGE_BLOCKSIZE;
+ }
+ blake_large_lastBlock(&ctx, msg, length_b);
+ blake512_ctx2hash(dest, &ctx);
}
-void blake384(void *dest, const void *msg, uint32_t length_b){
- blake_large_ctx_t ctx;
- blake384_init(&ctx);
- while(length_b>=BLAKE_LARGE_BLOCKSIZE){
- blake_large_nextBlock(&ctx, msg);
- msg = (uint8_t*)msg + BLAKE_LARGE_BLOCKSIZE_B;
- length_b -= BLAKE_LARGE_BLOCKSIZE;
- }
- blake_large_lastBlock(&ctx, msg, length_b);
- blake384_ctx2hash(dest, &ctx);
+void blake384(void *dest, const void *msg, uint32_t length_b)
+{
+ blake_large_ctx_t ctx;
+ blake384_init(&ctx);
+ while (length_b >= BLAKE_LARGE_BLOCKSIZE) {
+ blake_large_nextBlock(&ctx, msg);
+ msg = (uint8_t*) msg + BLAKE_LARGE_BLOCKSIZE_B;
+ length_b -= BLAKE_LARGE_BLOCKSIZE;
+ }
+ blake_large_lastBlock(&ctx, msg, length_b);
+ blake384_ctx2hash(dest, &ctx);
}
/* blake_large.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2009 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2009 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/*
* \file blake_large.h
* \author Daniel Otte
#define BLAKE512_BLOCKSIZE_B BLAKE_LARGE_BLOCKSIZE_B
typedef struct {
- uint64_t h[8];
- uint64_t s[4];
- uint32_t counter;
- uint8_t appendone;
+ uint64_t h[8];
+ uint64_t s[4];
+ uint32_t counter;
+ uint8_t appendone;
} blake_large_ctx_t;
typedef blake_large_ctx_t blake384_ctx_t;
void blake512_init(blake512_ctx_t *ctx);
void blake_large_nextBlock(blake_large_ctx_t *ctx, const void *block);
-void blake_large_lastBlock(blake_large_ctx_t *ctx, const void *block, uint16_t length_b);
+void blake_large_lastBlock(blake_large_ctx_t *ctx, const void *block,
+ uint16_t length_b);
void blake384_nextBlock(blake384_ctx_t *ctx, const void *block);
-void blake384_lastBlock(blake384_ctx_t *ctx, const void *block, uint16_t length_b);
+void blake384_lastBlock(blake384_ctx_t *ctx, const void *block,
+ uint16_t length_b);
void blake512_nextBlock(blake512_ctx_t *ctx, const void *block);
-void blake512_lastBlock(blake512_ctx_t *ctx, const void *block, uint16_t length_b);
+void blake512_lastBlock(blake512_ctx_t *ctx, const void *block,
+ uint16_t length_b);
void blake384_ctx2hash(void *dest, const blake384_ctx_t *ctx);
void blake512_ctx2hash(void *dest, const blake512_ctx_t *ctx);
/* blake_small.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2009 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2009 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/*
* \file blake_small.c
* \author Daniel Otte
#include "blake_small.h"
#include "blake_common.h"
-static
-const uint32_t blake_c[] PROGMEM = {
- 0x243F6A88, 0x85A308D3,
- 0x13198A2E, 0x03707344,
- 0xA4093822, 0x299F31D0,
- 0x082EFA98, 0xEC4E6C89,
- 0x452821E6, 0x38D01377,
- 0xBE5466CF, 0x34E90C6C,
- 0xC0AC29B7, 0xC97C50DD,
- 0x3F84D5B5, 0xB5470917
+static const uint32_t blake_c[] PROGMEM = {
+ 0x243F6A88, 0x85A308D3,
+ 0x13198A2E, 0x03707344,
+ 0xA4093822, 0x299F31D0,
+ 0x082EFA98, 0xEC4E6C89,
+ 0x452821E6, 0x38D01377,
+ 0xBE5466CF, 0x34E90C6C,
+ 0xC0AC29B7, 0xC97C50DD,
+ 0x3F84D5B5, 0xB5470917
};
#define ROTL32(a, n) (((a)<<(n))|((a)>>(32-(n))))
((0x00ff0000&(a))>>8)| \
(a)>>24 )
static
-void blake_small_expand(uint32_t *v, const blake_small_ctx_t *ctx){
- uint8_t i;
- memcpy(v, ctx->h, 8*4);
- for(i=0; i<8; ++i){
- v[8+i] = pgm_read_dword(&(blake_c[i]));
- }
- memxor((uint8_t*)v+8, ctx->s, 4*4);
+void blake_small_expand(uint32_t *v, const blake_small_ctx_t *ctx)
+{
+ uint8_t i;
+ memcpy(v, ctx->h, 8 * 4);
+ for (i = 0; i < 8; ++i) {
+ v[8 + i] = pgm_read_dword(&(blake_c[i]));
+ }
+ memxor((uint8_t*) v + 8, ctx->s, 4 * 4);
}
static
-void blake_small_changeendian(void *dest, const void *src){
- uint8_t i;
- for(i=0; i<16; ++i){
- ((uint32_t*)dest)[i] = CHANGE_ENDIAN32(((uint32_t*)src)[i]);
- }
+void blake_small_changeendian(void *dest, const void *src)
+{
+ uint8_t i;
+ for (i = 0; i < 16; ++i) {
+ ((uint32_t*) dest)[i] = CHANGE_ENDIAN32(((uint32_t* )src)[i]);
+ }
}
static
-void blake_small_compress(uint32_t *v,const void *m){
- uint8_t r,i;
- uint8_t a,b,c,d, s0, s1, sigma_idx=0;
- uint32_t lv[4];
- for(r=0; r<14; ++r){
- for(i=0; i<8; ++i){
- a = pgm_read_byte(blake_index_lut+4*i+0);
- b = pgm_read_byte(blake_index_lut+4*i+1);
- c = pgm_read_byte(blake_index_lut+4*i+2);
- d = pgm_read_byte(blake_index_lut+4*i+3);
- s0 = pgm_read_byte(blake_sigma+sigma_idx);
- s1 = s0&0xf;
- s0 >>= 4;++sigma_idx;
- if(sigma_idx>=80){
- sigma_idx-=80;
- }
- lv[0] = v[a];
- lv[1] = v[b];
- lv[2] = v[c];
- lv[3] = v[d];
+void blake_small_compress(uint32_t *v, const void *m)
+{
+ uint8_t r, i;
+ uint8_t a, b, c, d, s0, s1, sigma_idx = 0;
+ uint32_t lv[4];
+ for (r = 0; r < 14; ++r) {
+ for (i = 0; i < 8; ++i) {
+ a = pgm_read_byte(blake_index_lut + 4 * i + 0);
+ b = pgm_read_byte(blake_index_lut + 4 * i + 1);
+ c = pgm_read_byte(blake_index_lut + 4 * i + 2);
+ d = pgm_read_byte(blake_index_lut + 4 * i + 3);
+ s0 = pgm_read_byte(blake_sigma + sigma_idx);
+ s1 = s0 & 0xf;
+ s0 >>= 4;
+ ++sigma_idx;
+ if (sigma_idx >= 80) {
+ sigma_idx -= 80;
+ }
+ lv[0] = v[a];
+ lv[1] = v[b];
+ lv[2] = v[c];
+ lv[3] = v[d];
- lv[0] += lv[1] + (((uint32_t*)m)[s0] ^ pgm_read_dword(&(blake_c[s1])));
- lv[3] = ROTR32(lv[3]^lv[0], 16);
- lv[2] += lv[3];
- lv[1] = ROTR32(lv[1]^lv[2], 12);
- lv[0] += lv[1] + (((uint32_t*)m)[s1] ^ pgm_read_dword(&(blake_c[s0])));
- lv[3] = ROTR32(lv[3]^lv[0], 8);
- lv[2] += lv[3];
- lv[1] = ROTR32(lv[1]^lv[2], 7);
+ lv[0] += lv[1]
+ + (((uint32_t*) m)[s0] ^ pgm_read_dword(&(blake_c[s1])));
+ lv[3] = ROTR32(lv[3] ^ lv[0], 16);
+ lv[2] += lv[3];
+ lv[1] = ROTR32(lv[1] ^ lv[2], 12);
+ lv[0] += lv[1]
+ + (((uint32_t*) m)[s1] ^ pgm_read_dword(&(blake_c[s0])));
+ lv[3] = ROTR32(lv[3] ^ lv[0], 8);
+ lv[2] += lv[3];
+ lv[1] = ROTR32(lv[1] ^ lv[2], 7);
- v[a] = lv[0];
- v[b] = lv[1];
- v[c] = lv[2];
- v[d] = lv[3];
- }
- }
+ v[a] = lv[0];
+ v[b] = lv[1];
+ v[c] = lv[2];
+ v[d] = lv[3];
+ }
+ }
}
static
-void blake_small_collapse(blake_small_ctx_t *ctx, uint32_t *v){
- uint8_t i;
- for(i=0; i<8; ++i){
- ctx->h[i] ^= ctx->s[i%4] ^ v[i] ^ v[8+i];
- }
+void blake_small_collapse(blake_small_ctx_t *ctx, uint32_t *v)
+{
+ uint8_t i;
+ for (i = 0; i < 8; ++i) {
+ ctx->h[i] ^= ctx->s[i % 4] ^ v[i] ^ v[8 + i];
+ }
}
-void blake_small_nextBlock(blake_small_ctx_t *ctx, const void *msg){
- uint32_t v[16];
- uint32_t m[16];
- union {
- uint64_t v64;
- uint32_t v32[2];
- }ctr;
- blake_small_expand(v,ctx);
- ctx->counter++;
- ctr.v64 = ctx->counter*512;
- v[12] ^= ctr.v32[0];
- v[13] ^= ctr.v32[0];
- v[14] ^= ctr.v32[1];
- v[15] ^= ctr.v32[1];
- blake_small_changeendian(m, msg);
- blake_small_compress(v, m);
- blake_small_collapse(ctx, v);
+void blake_small_nextBlock(blake_small_ctx_t *ctx, const void *msg)
+{
+ uint32_t v[16];
+ uint32_t m[16];
+ union {
+ uint64_t v64;
+ uint32_t v32[2];
+ } ctr;
+ blake_small_expand(v, ctx);
+ ctx->counter++;
+ ctr.v64 = ctx->counter * 512;
+ v[12] ^= ctr.v32[0];
+ v[13] ^= ctr.v32[0];
+ v[14] ^= ctr.v32[1];
+ v[15] ^= ctr.v32[1];
+ blake_small_changeendian(m, msg);
+ blake_small_compress(v, m);
+ blake_small_collapse(ctx, v);
}
-void blake_small_lastBlock(blake_small_ctx_t *ctx, const void *msg, uint16_t length_b){
- while(length_b>=BLAKE_SMALL_BLOCKSIZE){
- blake_small_nextBlock(ctx, msg);
- msg = (uint8_t*)msg + BLAKE_SMALL_BLOCKSIZE_B;
- length_b -= BLAKE_SMALL_BLOCKSIZE;
- }
- union {
- uint8_t v8[64];
- uint32_t v32[16];
- } buffer;
- uint32_t v[16];
- union {
- uint64_t v64;
- uint32_t v32[2];
- }ctr;
- ctr.v64 = ctx->counter*512+length_b;
- memset(buffer.v8, 0, 64);
- memcpy(buffer.v8, msg, (length_b+7)/8);
- buffer.v8[length_b/8] |= 0x80 >> (length_b&0x7);
- blake_small_changeendian(buffer.v8, buffer.v8);
- blake_small_expand(v, ctx);
- if(length_b>512-64-2){
- v[12] ^= ctr.v32[0];
- v[13] ^= ctr.v32[0];
- v[14] ^= ctr.v32[1];
- v[15] ^= ctr.v32[1];
- blake_small_compress(v, buffer.v8);
- blake_small_collapse(ctx, v);
- memset(buffer.v8, 0, 64-8);
- blake_small_expand(v, ctx);
- }else{
- if(length_b){
- v[12] ^= ctr.v32[0];
- v[13] ^= ctr.v32[0];
- v[14] ^= ctr.v32[1];
- v[15] ^= ctr.v32[1];
- }
- }
- if(ctx->appendone)
- buffer.v8[64-8-4] |= 0x01;
- buffer.v32[14] = ctr.v32[1];
- buffer.v32[15] = ctr.v32[0];
- blake_small_compress(v, buffer.v8);
- blake_small_collapse(ctx, v);
+void blake_small_lastBlock(blake_small_ctx_t *ctx, const void *msg,
+ uint16_t length_b)
+{
+ while (length_b >= BLAKE_SMALL_BLOCKSIZE) {
+ blake_small_nextBlock(ctx, msg);
+ msg = (uint8_t*) msg + BLAKE_SMALL_BLOCKSIZE_B;
+ length_b -= BLAKE_SMALL_BLOCKSIZE;
+ }
+ union {
+ uint8_t v8[64];
+ uint32_t v32[16];
+ } buffer;
+ uint32_t v[16];
+ union {
+ uint64_t v64;
+ uint32_t v32[2];
+ } ctr;
+ ctr.v64 = ctx->counter * 512 + length_b;
+ memset(buffer.v8, 0, 64);
+ memcpy(buffer.v8, msg, (length_b + 7) / 8);
+ buffer.v8[length_b / 8] |= 0x80 >> (length_b & 0x7);
+ blake_small_changeendian(buffer.v8, buffer.v8);
+ blake_small_expand(v, ctx);
+ if (length_b > 512 - 64 - 2) {
+ v[12] ^= ctr.v32[0];
+ v[13] ^= ctr.v32[0];
+ v[14] ^= ctr.v32[1];
+ v[15] ^= ctr.v32[1];
+ blake_small_compress(v, buffer.v8);
+ blake_small_collapse(ctx, v);
+ memset(buffer.v8, 0, 64 - 8);
+ blake_small_expand(v, ctx);
+ } else {
+ if (length_b) {
+ v[12] ^= ctr.v32[0];
+ v[13] ^= ctr.v32[0];
+ v[14] ^= ctr.v32[1];
+ v[15] ^= ctr.v32[1];
+ }
+ }
+ if (ctx->appendone)
+ buffer.v8[64 - 8 - 4] |= 0x01;
+ buffer.v32[14] = ctr.v32[1];
+ buffer.v32[15] = ctr.v32[0];
+ blake_small_compress(v, buffer.v8);
+ blake_small_collapse(ctx, v);
}
const uint32_t blake256_iv[] PROGMEM = {
- 0x6A09E667L, 0xBB67AE85,
- 0x3C6EF372L, 0xA54FF53A,
- 0x510E527FL, 0x9B05688C,
- 0x1F83D9ABL, 0x5BE0CD19
+ 0x6A09E667L, 0xBB67AE85,
+ 0x3C6EF372L, 0xA54FF53A,
+ 0x510E527FL, 0x9B05688C,
+ 0x1F83D9ABL, 0x5BE0CD19
};
-void blake256_init(blake256_ctx_t *ctx){
- uint8_t i;
- for(i=0; i<8; ++i){
- ctx->h[i] = pgm_read_dword(&(blake256_iv[i]));
- }
- memset(ctx->s, 0, 4*4);
- ctx->counter = 0;
- ctx->appendone = 1;
+void blake256_init(blake256_ctx_t *ctx)
+{
+ uint8_t i;
+ for (i = 0; i < 8; ++i) {
+ ctx->h[i] = pgm_read_dword(&(blake256_iv[i]));
+ }
+ memset(ctx->s, 0, 4 * 4);
+ ctx->counter = 0;
+ ctx->appendone = 1;
}
const uint32_t blake224_iv[] PROGMEM = {
- 0xC1059ED8, 0x367CD507,
- 0x3070DD17, 0xF70E5939,
- 0xFFC00B31, 0x68581511,
- 0x64F98FA7, 0xBEFA4FA4
+ 0xC1059ED8, 0x367CD507,
+ 0x3070DD17, 0xF70E5939,
+ 0xFFC00B31, 0x68581511,
+ 0x64F98FA7, 0xBEFA4FA4
};
-void blake224_init(blake224_ctx_t *ctx){
- uint8_t i;
- for(i=0; i<8; ++i){
- ctx->h[i] = pgm_read_dword(&(blake224_iv[i]));
- }
- memset(ctx->s, 0, 4*4);
- ctx->counter = 0;
- ctx->appendone = 0;
+void blake224_init(blake224_ctx_t *ctx)
+{
+ uint8_t i;
+ for (i = 0; i < 8; ++i) {
+ ctx->h[i] = pgm_read_dword(&(blake224_iv[i]));
+ }
+ memset(ctx->s, 0, 4 * 4);
+ ctx->counter = 0;
+ ctx->appendone = 0;
}
-void blake256_ctx2hash(void *dest, const blake256_ctx_t *ctx){
- uint8_t i;
- for(i=0; i<8; ++i){
- ((uint32_t*)dest)[i] = CHANGE_ENDIAN32(ctx->h[i]);
- }
+void blake256_ctx2hash(void *dest, const blake256_ctx_t *ctx)
+{
+ uint8_t i;
+ for (i = 0; i < 8; ++i) {
+ ((uint32_t*) dest)[i] = CHANGE_ENDIAN32(ctx->h[i]);
+ }
}
-void blake224_ctx2hash(void *dest, const blake224_ctx_t *ctx){
- uint8_t i;
- for(i=0; i<7; ++i){
- ((uint32_t*)dest)[i] = CHANGE_ENDIAN32(ctx->h[i]);
- }
+void blake224_ctx2hash(void *dest, const blake224_ctx_t *ctx)
+{
+ uint8_t i;
+ for (i = 0; i < 7; ++i) {
+ ((uint32_t*) dest)[i] = CHANGE_ENDIAN32(ctx->h[i]);
+ }
}
-void blake256_nextBlock(blake256_ctx_t *ctx, const void *block){
- blake_small_nextBlock(ctx, block);
+void blake256_nextBlock(blake256_ctx_t *ctx, const void *block)
+{
+ blake_small_nextBlock(ctx, block);
}
-void blake224_nextBlock(blake224_ctx_t *ctx, const void *block){
- blake_small_nextBlock(ctx, block);
+void blake224_nextBlock(blake224_ctx_t *ctx, const void *block)
+{
+ blake_small_nextBlock(ctx, block);
}
-void blake256_lastBlock(blake256_ctx_t *ctx, const void *block, uint16_t length_b){
- blake_small_lastBlock(ctx, block, length_b);
+void blake256_lastBlock(blake256_ctx_t *ctx, const void *block,
+ uint16_t length_b)
+{
+ blake_small_lastBlock(ctx, block, length_b);
}
-void blake224_lastBlock(blake224_ctx_t *ctx, const void *block, uint16_t length_b){
- blake_small_lastBlock(ctx, block, length_b);
+void blake224_lastBlock(blake224_ctx_t *ctx, const void *block,
+ uint16_t length_b)
+{
+ blake_small_lastBlock(ctx, block, length_b);
}
-void blake256(void *dest, const void *msg, uint32_t length_b){
- blake_small_ctx_t ctx;
- blake256_init(&ctx);
- while(length_b>=BLAKE_SMALL_BLOCKSIZE){
- blake_small_nextBlock(&ctx, msg);
- msg = (uint8_t*)msg + BLAKE_SMALL_BLOCKSIZE_B;
- length_b -= BLAKE_SMALL_BLOCKSIZE;
- }
- blake_small_lastBlock(&ctx, msg, length_b);
- blake256_ctx2hash(dest, &ctx);
+void blake256(void *dest, const void *msg, uint32_t length_b)
+{
+ blake_small_ctx_t ctx;
+ blake256_init(&ctx);
+ while (length_b >= BLAKE_SMALL_BLOCKSIZE) {
+ blake_small_nextBlock(&ctx, msg);
+ msg = (uint8_t*) msg + BLAKE_SMALL_BLOCKSIZE_B;
+ length_b -= BLAKE_SMALL_BLOCKSIZE;
+ }
+ blake_small_lastBlock(&ctx, msg, length_b);
+ blake256_ctx2hash(dest, &ctx);
}
-void blake224(void *dest, const void *msg, uint32_t length_b){
- blake_small_ctx_t ctx;
- blake224_init(&ctx);
- while(length_b>=BLAKE_SMALL_BLOCKSIZE){
- blake_small_nextBlock(&ctx, msg);
- msg = (uint8_t*)msg + BLAKE_SMALL_BLOCKSIZE_B;
- length_b -= BLAKE_SMALL_BLOCKSIZE;
- }
- blake_small_lastBlock(&ctx, msg, length_b);
- blake224_ctx2hash(dest, &ctx);
+void blake224(void *dest, const void *msg, uint32_t length_b)
+{
+ blake_small_ctx_t ctx;
+ blake224_init(&ctx);
+ while (length_b >= BLAKE_SMALL_BLOCKSIZE) {
+ blake_small_nextBlock(&ctx, msg);
+ msg = (uint8_t*) msg + BLAKE_SMALL_BLOCKSIZE_B;
+ length_b -= BLAKE_SMALL_BLOCKSIZE;
+ }
+ blake_small_lastBlock(&ctx, msg, length_b);
+ blake224_ctx2hash(dest, &ctx);
}
/* blake_small.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2009 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2009 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/*
* \file blake_small.h
* \author Daniel Otte
#define BLAKE256_BLOCKSIZE_B BLAKE_SMALL_BLOCKSIZE_B
typedef struct {
- uint32_t h[8];
- uint32_t s[4];
- uint32_t counter;
- uint8_t appendone;
+ uint32_t h[8];
+ uint32_t s[4];
+ uint32_t counter;
+ uint8_t appendone;
} blake_small_ctx_t;
typedef blake_small_ctx_t blake224_ctx_t;
void blake256_init(blake256_ctx_t *ctx);
void blake_small_nextBlock(blake_small_ctx_t *ctx, const void *block);
-void blake_small_lastBlock(blake_small_ctx_t *ctx, const void *block, uint16_t length_b);
+void blake_small_lastBlock(blake_small_ctx_t *ctx, const void *block,
+ uint16_t length_b);
void blake224_nextBlock(blake224_ctx_t *ctx, const void *block);
-void blake224_lastBlock(blake224_ctx_t *ctx, const void *block, uint16_t length_b);
+void blake224_lastBlock(blake224_ctx_t *ctx, const void *block,
+ uint16_t length_b);
void blake256_nextBlock(blake256_ctx_t *ctx, const void *block);
-void blake256_lastBlock(blake256_ctx_t *ctx, const void *block, uint16_t length_b);
+void blake256_lastBlock(blake256_ctx_t *ctx, const void *block,
+ uint16_t length_b);
void blake224_ctx2hash(void *dest, const blake224_ctx_t *ctx);
void blake256_ctx2hash(void *dest, const blake256_ctx_t *ctx);
/* bmw_large.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2009 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2009 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/*
* \file bmw_large.h
* \author Daniel Otte
#define BMW512_BLOCKSIZE_B BMW_LARGE_BLOCKSIZE_B
typedef struct {
- uint64_t h[16];
- uint32_t counter;
+ uint64_t h[16];
+ uint32_t counter;
} bmw_large_ctx_t;
typedef bmw_large_ctx_t bmw384_ctx_t;
void bmw512_init(bmw512_ctx_t *ctx);
void bmw_large_nextBlock(bmw_large_ctx_t *ctx, const void *block);
-void bmw_large_lastBlock(bmw_large_ctx_t *ctx, const void *block, uint16_t length_b);
+void bmw_large_lastBlock(bmw_large_ctx_t *ctx, const void *block,
+ uint16_t length_b);
void bmw384_nextBlock(bmw384_ctx_t *ctx, const void *block);
void bmw384_lastBlock(bmw384_ctx_t *ctx, const void *block, uint16_t length_b);
/* cast5-sbox.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/*
* File: cast5-sbox.h
* Author: Daniel Otte
* Description: sboxes for CAST5 (aka CAST-128) cipher algorithm as described in RFC 2144.
*
*/
-
+
#ifndef CAST5_SBOX_H_
#define CAST5_SBOX_H_
#ifndef BIG_ENDIAN
const uint32_t s1[] PROGMEM = {
-0x30fb40d4UL, 0x9fa0ff0bUL, 0x6beccd2fUL, 0x3f258c7aUL, 0x1e213f2fUL, 0x9c004dd3UL, 0x6003e540UL, 0xcf9fc949UL,
-0xbfd4af27UL, 0x88bbbdb5UL, 0xe2034090UL, 0x98d09675UL, 0x6e63a0e0UL, 0x15c361d2UL, 0xc2e7661dUL, 0x22d4ff8eUL,
-0x28683b6fUL, 0xc07fd059UL, 0xff2379c8UL, 0x775f50e2UL, 0x43c340d3UL, 0xdf2f8656UL, 0x887ca41aUL, 0xa2d2bd2dUL,
-0xa1c9e0d6UL, 0x346c4819UL, 0x61b76d87UL, 0x22540f2fUL, 0x2abe32e1UL, 0xaa54166bUL, 0x22568e3aUL, 0xa2d341d0UL,
-0x66db40c8UL, 0xa784392fUL, 0x004dff2fUL, 0x2db9d2deUL, 0x97943facUL, 0x4a97c1d8UL, 0x527644b7UL, 0xb5f437a7UL,
-0xb82cbaefUL, 0xd751d159UL, 0x6ff7f0edUL, 0x5a097a1fUL, 0x827b68d0UL, 0x90ecf52eUL, 0x22b0c054UL, 0xbc8e5935UL,
-0x4b6d2f7fUL, 0x50bb64a2UL, 0xd2664910UL, 0xbee5812dUL, 0xb7332290UL, 0xe93b159fUL, 0xb48ee411UL, 0x4bff345dUL,
-0xfd45c240UL, 0xad31973fUL, 0xc4f6d02eUL, 0x55fc8165UL, 0xd5b1caadUL, 0xa1ac2daeUL, 0xa2d4b76dUL, 0xc19b0c50UL,
-0x882240f2UL, 0x0c6e4f38UL, 0xa4e4bfd7UL, 0x4f5ba272UL, 0x564c1d2fUL, 0xc59c5319UL, 0xb949e354UL, 0xb04669feUL,
-0xb1b6ab8aUL, 0xc71358ddUL, 0x6385c545UL, 0x110f935dUL, 0x57538ad5UL, 0x6a390493UL, 0xe63d37e0UL, 0x2a54f6b3UL,
-0x3a787d5fUL, 0x6276a0b5UL, 0x19a6fcdfUL, 0x7a42206aUL, 0x29f9d4d5UL, 0xf61b1891UL, 0xbb72275eUL, 0xaa508167UL,
-0x38901091UL, 0xc6b505ebUL, 0x84c7cb8cUL, 0x2ad75a0fUL, 0x874a1427UL, 0xa2d1936bUL, 0x2ad286afUL, 0xaa56d291UL,
-0xd7894360UL, 0x425c750dUL, 0x93b39e26UL, 0x187184c9UL, 0x6c00b32dUL, 0x73e2bb14UL, 0xa0bebc3cUL, 0x54623779UL,
-0x64459eabUL, 0x3f328b82UL, 0x7718cf82UL, 0x59a2cea6UL, 0x04ee002eUL, 0x89fe78e6UL, 0x3fab0950UL, 0x325ff6c2UL,
-0x81383f05UL, 0x6963c5c8UL, 0x76cb5ad6UL, 0xd49974c9UL, 0xca180dcfUL, 0x380782d5UL, 0xc7fa5cf6UL, 0x8ac31511UL,
-0x35e79e13UL, 0x47da91d0UL, 0xf40f9086UL, 0xa7e2419eUL, 0x31366241UL, 0x051ef495UL, 0xaa573b04UL, 0x4a805d8dUL,
-0x548300d0UL, 0x00322a3cUL, 0xbf64cddfUL, 0xba57a68eUL, 0x75c6372bUL, 0x50afd341UL, 0xa7c13275UL, 0x915a0bf5UL,
-0x6b54bfabUL, 0x2b0b1426UL, 0xab4cc9d7UL, 0x449ccd82UL, 0xf7fbf265UL, 0xab85c5f3UL, 0x1b55db94UL, 0xaad4e324UL,
-0xcfa4bd3fUL, 0x2deaa3e2UL, 0x9e204d02UL, 0xc8bd25acUL, 0xeadf55b3UL, 0xd5bd9e98UL, 0xe31231b2UL, 0x2ad5ad6cUL,
-0x954329deUL, 0xadbe4528UL, 0xd8710f69UL, 0xaa51c90fUL, 0xaa786bf6UL, 0x22513f1eUL, 0xaa51a79bUL, 0x2ad344ccUL,
-0x7b5a41f0UL, 0xd37cfbadUL, 0x1b069505UL, 0x41ece491UL, 0xb4c332e6UL, 0x032268d4UL, 0xc9600accUL, 0xce387e6dUL,
-0xbf6bb16cUL, 0x6a70fb78UL, 0x0d03d9c9UL, 0xd4df39deUL, 0xe01063daUL, 0x4736f464UL, 0x5ad328d8UL, 0xb347cc96UL,
-0x75bb0fc3UL, 0x98511bfbUL, 0x4ffbcc35UL, 0xb58bcf6aUL, 0xe11f0abcUL, 0xbfc5fe4aUL, 0xa70aec10UL, 0xac39570aUL,
-0x3f04442fUL, 0x6188b153UL, 0xe0397a2eUL, 0x5727cb79UL, 0x9ceb418fUL, 0x1cacd68dUL, 0x2ad37c96UL, 0x0175cb9dUL,
-0xc69dff09UL, 0xc75b65f0UL, 0xd9db40d8UL, 0xec0e7779UL, 0x4744ead4UL, 0xb11c3274UL, 0xdd24cb9eUL, 0x7e1c54bdUL,
-0xf01144f9UL, 0xd2240eb1UL, 0x9675b3fdUL, 0xa3ac3755UL, 0xd47c27afUL, 0x51c85f4dUL, 0x56907596UL, 0xa5bb15e6UL,
-0x580304f0UL, 0xca042cf1UL, 0x011a37eaUL, 0x8dbfaadbUL, 0x35ba3e4aUL, 0x3526ffa0UL, 0xc37b4d09UL, 0xbc306ed9UL,
-0x98a52666UL, 0x5648f725UL, 0xff5e569dUL, 0x0ced63d0UL, 0x7c63b2cfUL, 0x700b45e1UL, 0xd5ea50f1UL, 0x85a92872UL,
-0xaf1fbda7UL, 0xd4234870UL, 0xa7870bf3UL, 0x2d3b4d79UL, 0x42e04198UL, 0x0cd0ede7UL, 0x26470db8UL, 0xf881814cUL,
-0x474d6ad7UL, 0x7c0c5e5cUL, 0xd1231959UL, 0x381b7298UL, 0xf5d2f4dbUL, 0xab838653UL, 0x6e2f1e23UL, 0x83719c9eUL,
-0xbd91e046UL, 0x9a56456eUL, 0xdc39200cUL, 0x20c8c571UL, 0x962bda1cUL, 0xe1e696ffUL, 0xb141ab08UL, 0x7cca89b9UL,
-0x1a69e783UL, 0x02cc4843UL, 0xa2f7c579UL, 0x429ef47dUL, 0x427b169cUL, 0x5ac9f049UL, 0xdd8f0f00UL, 0x5c8165bfUL};
+ 0x30fb40d4UL, 0x9fa0ff0bUL, 0x6beccd2fUL, 0x3f258c7aUL, 0x1e213f2fUL,
+ 0x9c004dd3UL, 0x6003e540UL, 0xcf9fc949UL,
+ 0xbfd4af27UL, 0x88bbbdb5UL, 0xe2034090UL, 0x98d09675UL, 0x6e63a0e0UL,
+ 0x15c361d2UL, 0xc2e7661dUL, 0x22d4ff8eUL,
+ 0x28683b6fUL, 0xc07fd059UL, 0xff2379c8UL, 0x775f50e2UL, 0x43c340d3UL,
+ 0xdf2f8656UL, 0x887ca41aUL, 0xa2d2bd2dUL,
+ 0xa1c9e0d6UL, 0x346c4819UL, 0x61b76d87UL, 0x22540f2fUL, 0x2abe32e1UL,
+ 0xaa54166bUL, 0x22568e3aUL, 0xa2d341d0UL,
+ 0x66db40c8UL, 0xa784392fUL, 0x004dff2fUL, 0x2db9d2deUL, 0x97943facUL,
+ 0x4a97c1d8UL, 0x527644b7UL, 0xb5f437a7UL,
+ 0xb82cbaefUL, 0xd751d159UL, 0x6ff7f0edUL, 0x5a097a1fUL, 0x827b68d0UL,
+ 0x90ecf52eUL, 0x22b0c054UL, 0xbc8e5935UL,
+ 0x4b6d2f7fUL, 0x50bb64a2UL, 0xd2664910UL, 0xbee5812dUL, 0xb7332290UL,
+ 0xe93b159fUL, 0xb48ee411UL, 0x4bff345dUL,
+ 0xfd45c240UL, 0xad31973fUL, 0xc4f6d02eUL, 0x55fc8165UL, 0xd5b1caadUL,
+ 0xa1ac2daeUL, 0xa2d4b76dUL, 0xc19b0c50UL,
+ 0x882240f2UL, 0x0c6e4f38UL, 0xa4e4bfd7UL, 0x4f5ba272UL, 0x564c1d2fUL,
+ 0xc59c5319UL, 0xb949e354UL, 0xb04669feUL,
+ 0xb1b6ab8aUL, 0xc71358ddUL, 0x6385c545UL, 0x110f935dUL, 0x57538ad5UL,
+ 0x6a390493UL, 0xe63d37e0UL, 0x2a54f6b3UL,
+ 0x3a787d5fUL, 0x6276a0b5UL, 0x19a6fcdfUL, 0x7a42206aUL, 0x29f9d4d5UL,
+ 0xf61b1891UL, 0xbb72275eUL, 0xaa508167UL,
+ 0x38901091UL, 0xc6b505ebUL, 0x84c7cb8cUL, 0x2ad75a0fUL, 0x874a1427UL,
+ 0xa2d1936bUL, 0x2ad286afUL, 0xaa56d291UL,
+ 0xd7894360UL, 0x425c750dUL, 0x93b39e26UL, 0x187184c9UL, 0x6c00b32dUL,
+ 0x73e2bb14UL, 0xa0bebc3cUL, 0x54623779UL,
+ 0x64459eabUL, 0x3f328b82UL, 0x7718cf82UL, 0x59a2cea6UL, 0x04ee002eUL,
+ 0x89fe78e6UL, 0x3fab0950UL, 0x325ff6c2UL,
+ 0x81383f05UL, 0x6963c5c8UL, 0x76cb5ad6UL, 0xd49974c9UL, 0xca180dcfUL,
+ 0x380782d5UL, 0xc7fa5cf6UL, 0x8ac31511UL,
+ 0x35e79e13UL, 0x47da91d0UL, 0xf40f9086UL, 0xa7e2419eUL, 0x31366241UL,
+ 0x051ef495UL, 0xaa573b04UL, 0x4a805d8dUL,
+ 0x548300d0UL, 0x00322a3cUL, 0xbf64cddfUL, 0xba57a68eUL, 0x75c6372bUL,
+ 0x50afd341UL, 0xa7c13275UL, 0x915a0bf5UL,
+ 0x6b54bfabUL, 0x2b0b1426UL, 0xab4cc9d7UL, 0x449ccd82UL, 0xf7fbf265UL,
+ 0xab85c5f3UL, 0x1b55db94UL, 0xaad4e324UL,
+ 0xcfa4bd3fUL, 0x2deaa3e2UL, 0x9e204d02UL, 0xc8bd25acUL, 0xeadf55b3UL,
+ 0xd5bd9e98UL, 0xe31231b2UL, 0x2ad5ad6cUL,
+ 0x954329deUL, 0xadbe4528UL, 0xd8710f69UL, 0xaa51c90fUL, 0xaa786bf6UL,
+ 0x22513f1eUL, 0xaa51a79bUL, 0x2ad344ccUL,
+ 0x7b5a41f0UL, 0xd37cfbadUL, 0x1b069505UL, 0x41ece491UL, 0xb4c332e6UL,
+ 0x032268d4UL, 0xc9600accUL, 0xce387e6dUL,
+ 0xbf6bb16cUL, 0x6a70fb78UL, 0x0d03d9c9UL, 0xd4df39deUL, 0xe01063daUL,
+ 0x4736f464UL, 0x5ad328d8UL, 0xb347cc96UL,
+ 0x75bb0fc3UL, 0x98511bfbUL, 0x4ffbcc35UL, 0xb58bcf6aUL, 0xe11f0abcUL,
+ 0xbfc5fe4aUL, 0xa70aec10UL, 0xac39570aUL,
+ 0x3f04442fUL, 0x6188b153UL, 0xe0397a2eUL, 0x5727cb79UL, 0x9ceb418fUL,
+ 0x1cacd68dUL, 0x2ad37c96UL, 0x0175cb9dUL,
+ 0xc69dff09UL, 0xc75b65f0UL, 0xd9db40d8UL, 0xec0e7779UL, 0x4744ead4UL,
+ 0xb11c3274UL, 0xdd24cb9eUL, 0x7e1c54bdUL,
+ 0xf01144f9UL, 0xd2240eb1UL, 0x9675b3fdUL, 0xa3ac3755UL, 0xd47c27afUL,
+ 0x51c85f4dUL, 0x56907596UL, 0xa5bb15e6UL,
+ 0x580304f0UL, 0xca042cf1UL, 0x011a37eaUL, 0x8dbfaadbUL, 0x35ba3e4aUL,
+ 0x3526ffa0UL, 0xc37b4d09UL, 0xbc306ed9UL,
+ 0x98a52666UL, 0x5648f725UL, 0xff5e569dUL, 0x0ced63d0UL, 0x7c63b2cfUL,
+ 0x700b45e1UL, 0xd5ea50f1UL, 0x85a92872UL,
+ 0xaf1fbda7UL, 0xd4234870UL, 0xa7870bf3UL, 0x2d3b4d79UL, 0x42e04198UL,
+ 0x0cd0ede7UL, 0x26470db8UL, 0xf881814cUL,
+ 0x474d6ad7UL, 0x7c0c5e5cUL, 0xd1231959UL, 0x381b7298UL, 0xf5d2f4dbUL,
+ 0xab838653UL, 0x6e2f1e23UL, 0x83719c9eUL,
+ 0xbd91e046UL, 0x9a56456eUL, 0xdc39200cUL, 0x20c8c571UL, 0x962bda1cUL,
+ 0xe1e696ffUL, 0xb141ab08UL, 0x7cca89b9UL,
+ 0x1a69e783UL, 0x02cc4843UL, 0xa2f7c579UL, 0x429ef47dUL, 0x427b169cUL,
+ 0x5ac9f049UL, 0xdd8f0f00UL, 0x5c8165bfUL };
const uint32_t s2[] PROGMEM = {
-0x1f201094UL, 0xef0ba75bUL, 0x69e3cf7eUL, 0x393f4380UL, 0xfe61cf7aUL, 0xeec5207aUL, 0x55889c94UL, 0x72fc0651UL,
-0xada7ef79UL, 0x4e1d7235UL, 0xd55a63ceUL, 0xde0436baUL, 0x99c430efUL, 0x5f0c0794UL, 0x18dcdb7dUL, 0xa1d6eff3UL,
-0xa0b52f7bUL, 0x59e83605UL, 0xee15b094UL, 0xe9ffd909UL, 0xdc440086UL, 0xef944459UL, 0xba83ccb3UL, 0xe0c3cdfbUL,
-0xd1da4181UL, 0x3b092ab1UL, 0xf997f1c1UL, 0xa5e6cf7bUL, 0x01420ddbUL, 0xe4e7ef5bUL, 0x25a1ff41UL, 0xe180f806UL,
-0x1fc41080UL, 0x179bee7aUL, 0xd37ac6a9UL, 0xfe5830a4UL, 0x98de8b7fUL, 0x77e83f4eUL, 0x79929269UL, 0x24fa9f7bUL,
-0xe113c85bUL, 0xacc40083UL, 0xd7503525UL, 0xf7ea615fUL, 0x62143154UL, 0x0d554b63UL, 0x5d681121UL, 0xc866c359UL,
-0x3d63cf73UL, 0xcee234c0UL, 0xd4d87e87UL, 0x5c672b21UL, 0x071f6181UL, 0x39f7627fUL, 0x361e3084UL, 0xe4eb573bUL,
-0x602f64a4UL, 0xd63acd9cUL, 0x1bbc4635UL, 0x9e81032dUL, 0x2701f50cUL, 0x99847ab4UL, 0xa0e3df79UL, 0xba6cf38cUL,
-0x10843094UL, 0x2537a95eUL, 0xf46f6ffeUL, 0xa1ff3b1fUL, 0x208cfb6aUL, 0x8f458c74UL, 0xd9e0a227UL, 0x4ec73a34UL,
-0xfc884f69UL, 0x3e4de8dfUL, 0xef0e0088UL, 0x3559648dUL, 0x8a45388cUL, 0x1d804366UL, 0x721d9bfdUL, 0xa58684bbUL,
-0xe8256333UL, 0x844e8212UL, 0x128d8098UL, 0xfed33fb4UL, 0xce280ae1UL, 0x27e19ba5UL, 0xd5a6c252UL, 0xe49754bdUL,
-0xc5d655ddUL, 0xeb667064UL, 0x77840b4dUL, 0xa1b6a801UL, 0x84db26a9UL, 0xe0b56714UL, 0x21f043b7UL, 0xe5d05860UL,
-0x54f03084UL, 0x066ff472UL, 0xa31aa153UL, 0xdadc4755UL, 0xb5625dbfUL, 0x68561be6UL, 0x83ca6b94UL, 0x2d6ed23bUL,
-0xeccf01dbUL, 0xa6d3d0baUL, 0xb6803d5cUL, 0xaf77a709UL, 0x33b4a34cUL, 0x397bc8d6UL, 0x5ee22b95UL, 0x5f0e5304UL,
-0x81ed6f61UL, 0x20e74364UL, 0xb45e1378UL, 0xde18639bUL, 0x881ca122UL, 0xb96726d1UL, 0x8049a7e8UL, 0x22b7da7bUL,
-0x5e552d25UL, 0x5272d237UL, 0x79d2951cUL, 0xc60d894cUL, 0x488cb402UL, 0x1ba4fe5bUL, 0xa4b09f6bUL, 0x1ca815cfUL,
-0xa20c3005UL, 0x8871df63UL, 0xb9de2fcbUL, 0x0cc6c9e9UL, 0x0beeff53UL, 0xe3214517UL, 0xb4542835UL, 0x9f63293cUL,
-0xee41e729UL, 0x6e1d2d7cUL, 0x50045286UL, 0x1e6685f3UL, 0xf33401c6UL, 0x30a22c95UL, 0x31a70850UL, 0x60930f13UL,
-0x73f98417UL, 0xa1269859UL, 0xec645c44UL, 0x52c877a9UL, 0xcdff33a6UL, 0xa02b1741UL, 0x7cbad9a2UL, 0x2180036fUL,
-0x50d99c08UL, 0xcb3f4861UL, 0xc26bd765UL, 0x64a3f6abUL, 0x80342676UL, 0x25a75e7bUL, 0xe4e6d1fcUL, 0x20c710e6UL,
-0xcdf0b680UL, 0x17844d3bUL, 0x31eef84dUL, 0x7e0824e4UL, 0x2ccb49ebUL, 0x846a3baeUL, 0x8ff77888UL, 0xee5d60f6UL,
-0x7af75673UL, 0x2fdd5cdbUL, 0xa11631c1UL, 0x30f66f43UL, 0xb3faec54UL, 0x157fd7faUL, 0xef8579ccUL, 0xd152de58UL,
-0xdb2ffd5eUL, 0x8f32ce19UL, 0x306af97aUL, 0x02f03ef8UL, 0x99319ad5UL, 0xc242fa0fUL, 0xa7e3ebb0UL, 0xc68e4906UL,
-0xb8da230cUL, 0x80823028UL, 0xdcdef3c8UL, 0xd35fb171UL, 0x088a1bc8UL, 0xbec0c560UL, 0x61a3c9e8UL, 0xbca8f54dUL,
-0xc72feffaUL, 0x22822e99UL, 0x82c570b4UL, 0xd8d94e89UL, 0x8b1c34bcUL, 0x301e16e6UL, 0x273be979UL, 0xb0ffeaa6UL,
-0x61d9b8c6UL, 0x00b24869UL, 0xb7ffce3fUL, 0x08dc283bUL, 0x43daf65aUL, 0xf7e19798UL, 0x7619b72fUL, 0x8f1c9ba4UL,
-0xdc8637a0UL, 0x16a7d3b1UL, 0x9fc393b7UL, 0xa7136eebUL, 0xc6bcc63eUL, 0x1a513742UL, 0xef6828bcUL, 0x520365d6UL,
-0x2d6a77abUL, 0x3527ed4bUL, 0x821fd216UL, 0x095c6e2eUL, 0xdb92f2fbUL, 0x5eea29cbUL, 0x145892f5UL, 0x91584f7fUL,
-0x5483697bUL, 0x2667a8ccUL, 0x85196048UL, 0x8c4baceaUL, 0x833860d4UL, 0x0d23e0f9UL, 0x6c387e8aUL, 0x0ae6d249UL,
-0xb284600cUL, 0xd835731dUL, 0xdcb1c647UL, 0xac4c56eaUL, 0x3ebd81b3UL, 0x230eabb0UL, 0x6438bc87UL, 0xf0b5b1faUL,
-0x8f5ea2b3UL, 0xfc184642UL, 0x0a036b7aUL, 0x4fb089bdUL, 0x649da589UL, 0xa345415eUL, 0x5c038323UL, 0x3e5d3bb9UL,
-0x43d79572UL, 0x7e6dd07cUL, 0x06dfdf1eUL, 0x6c6cc4efUL, 0x7160a539UL, 0x73bfbe70UL, 0x83877605UL, 0x4523ecf1UL};
+ 0x1f201094UL, 0xef0ba75bUL, 0x69e3cf7eUL, 0x393f4380UL, 0xfe61cf7aUL,
+ 0xeec5207aUL, 0x55889c94UL, 0x72fc0651UL,
+ 0xada7ef79UL, 0x4e1d7235UL, 0xd55a63ceUL, 0xde0436baUL, 0x99c430efUL,
+ 0x5f0c0794UL, 0x18dcdb7dUL, 0xa1d6eff3UL,
+ 0xa0b52f7bUL, 0x59e83605UL, 0xee15b094UL, 0xe9ffd909UL, 0xdc440086UL,
+ 0xef944459UL, 0xba83ccb3UL, 0xe0c3cdfbUL,
+ 0xd1da4181UL, 0x3b092ab1UL, 0xf997f1c1UL, 0xa5e6cf7bUL, 0x01420ddbUL,
+ 0xe4e7ef5bUL, 0x25a1ff41UL, 0xe180f806UL,
+ 0x1fc41080UL, 0x179bee7aUL, 0xd37ac6a9UL, 0xfe5830a4UL, 0x98de8b7fUL,
+ 0x77e83f4eUL, 0x79929269UL, 0x24fa9f7bUL,
+ 0xe113c85bUL, 0xacc40083UL, 0xd7503525UL, 0xf7ea615fUL, 0x62143154UL,
+ 0x0d554b63UL, 0x5d681121UL, 0xc866c359UL,
+ 0x3d63cf73UL, 0xcee234c0UL, 0xd4d87e87UL, 0x5c672b21UL, 0x071f6181UL,
+ 0x39f7627fUL, 0x361e3084UL, 0xe4eb573bUL,
+ 0x602f64a4UL, 0xd63acd9cUL, 0x1bbc4635UL, 0x9e81032dUL, 0x2701f50cUL,
+ 0x99847ab4UL, 0xa0e3df79UL, 0xba6cf38cUL,
+ 0x10843094UL, 0x2537a95eUL, 0xf46f6ffeUL, 0xa1ff3b1fUL, 0x208cfb6aUL,
+ 0x8f458c74UL, 0xd9e0a227UL, 0x4ec73a34UL,
+ 0xfc884f69UL, 0x3e4de8dfUL, 0xef0e0088UL, 0x3559648dUL, 0x8a45388cUL,
+ 0x1d804366UL, 0x721d9bfdUL, 0xa58684bbUL,
+ 0xe8256333UL, 0x844e8212UL, 0x128d8098UL, 0xfed33fb4UL, 0xce280ae1UL,
+ 0x27e19ba5UL, 0xd5a6c252UL, 0xe49754bdUL,
+ 0xc5d655ddUL, 0xeb667064UL, 0x77840b4dUL, 0xa1b6a801UL, 0x84db26a9UL,
+ 0xe0b56714UL, 0x21f043b7UL, 0xe5d05860UL,
+ 0x54f03084UL, 0x066ff472UL, 0xa31aa153UL, 0xdadc4755UL, 0xb5625dbfUL,
+ 0x68561be6UL, 0x83ca6b94UL, 0x2d6ed23bUL,
+ 0xeccf01dbUL, 0xa6d3d0baUL, 0xb6803d5cUL, 0xaf77a709UL, 0x33b4a34cUL,
+ 0x397bc8d6UL, 0x5ee22b95UL, 0x5f0e5304UL,
+ 0x81ed6f61UL, 0x20e74364UL, 0xb45e1378UL, 0xde18639bUL, 0x881ca122UL,
+ 0xb96726d1UL, 0x8049a7e8UL, 0x22b7da7bUL,
+ 0x5e552d25UL, 0x5272d237UL, 0x79d2951cUL, 0xc60d894cUL, 0x488cb402UL,
+ 0x1ba4fe5bUL, 0xa4b09f6bUL, 0x1ca815cfUL,
+ 0xa20c3005UL, 0x8871df63UL, 0xb9de2fcbUL, 0x0cc6c9e9UL, 0x0beeff53UL,
+ 0xe3214517UL, 0xb4542835UL, 0x9f63293cUL,
+ 0xee41e729UL, 0x6e1d2d7cUL, 0x50045286UL, 0x1e6685f3UL, 0xf33401c6UL,
+ 0x30a22c95UL, 0x31a70850UL, 0x60930f13UL,
+ 0x73f98417UL, 0xa1269859UL, 0xec645c44UL, 0x52c877a9UL, 0xcdff33a6UL,
+ 0xa02b1741UL, 0x7cbad9a2UL, 0x2180036fUL,
+ 0x50d99c08UL, 0xcb3f4861UL, 0xc26bd765UL, 0x64a3f6abUL, 0x80342676UL,
+ 0x25a75e7bUL, 0xe4e6d1fcUL, 0x20c710e6UL,
+ 0xcdf0b680UL, 0x17844d3bUL, 0x31eef84dUL, 0x7e0824e4UL, 0x2ccb49ebUL,
+ 0x846a3baeUL, 0x8ff77888UL, 0xee5d60f6UL,
+ 0x7af75673UL, 0x2fdd5cdbUL, 0xa11631c1UL, 0x30f66f43UL, 0xb3faec54UL,
+ 0x157fd7faUL, 0xef8579ccUL, 0xd152de58UL,
+ 0xdb2ffd5eUL, 0x8f32ce19UL, 0x306af97aUL, 0x02f03ef8UL, 0x99319ad5UL,
+ 0xc242fa0fUL, 0xa7e3ebb0UL, 0xc68e4906UL,
+ 0xb8da230cUL, 0x80823028UL, 0xdcdef3c8UL, 0xd35fb171UL, 0x088a1bc8UL,
+ 0xbec0c560UL, 0x61a3c9e8UL, 0xbca8f54dUL,
+ 0xc72feffaUL, 0x22822e99UL, 0x82c570b4UL, 0xd8d94e89UL, 0x8b1c34bcUL,
+ 0x301e16e6UL, 0x273be979UL, 0xb0ffeaa6UL,
+ 0x61d9b8c6UL, 0x00b24869UL, 0xb7ffce3fUL, 0x08dc283bUL, 0x43daf65aUL,
+ 0xf7e19798UL, 0x7619b72fUL, 0x8f1c9ba4UL,
+ 0xdc8637a0UL, 0x16a7d3b1UL, 0x9fc393b7UL, 0xa7136eebUL, 0xc6bcc63eUL,
+ 0x1a513742UL, 0xef6828bcUL, 0x520365d6UL,
+ 0x2d6a77abUL, 0x3527ed4bUL, 0x821fd216UL, 0x095c6e2eUL, 0xdb92f2fbUL,
+ 0x5eea29cbUL, 0x145892f5UL, 0x91584f7fUL,
+ 0x5483697bUL, 0x2667a8ccUL, 0x85196048UL, 0x8c4baceaUL, 0x833860d4UL,
+ 0x0d23e0f9UL, 0x6c387e8aUL, 0x0ae6d249UL,
+ 0xb284600cUL, 0xd835731dUL, 0xdcb1c647UL, 0xac4c56eaUL, 0x3ebd81b3UL,
+ 0x230eabb0UL, 0x6438bc87UL, 0xf0b5b1faUL,
+ 0x8f5ea2b3UL, 0xfc184642UL, 0x0a036b7aUL, 0x4fb089bdUL, 0x649da589UL,
+ 0xa345415eUL, 0x5c038323UL, 0x3e5d3bb9UL,
+ 0x43d79572UL, 0x7e6dd07cUL, 0x06dfdf1eUL, 0x6c6cc4efUL, 0x7160a539UL,
+ 0x73bfbe70UL, 0x83877605UL, 0x4523ecf1UL };
const uint32_t s3[] PROGMEM = {
-0x8defc240UL, 0x25fa5d9fUL, 0xeb903dbfUL, 0xe810c907UL, 0x47607fffUL, 0x369fe44bUL, 0x8c1fc644UL, 0xaececa90UL,
-0xbeb1f9bfUL, 0xeefbcaeaUL, 0xe8cf1950UL, 0x51df07aeUL, 0x920e8806UL, 0xf0ad0548UL, 0xe13c8d83UL, 0x927010d5UL,
-0x11107d9fUL, 0x07647db9UL, 0xb2e3e4d4UL, 0x3d4f285eUL, 0xb9afa820UL, 0xfade82e0UL, 0xa067268bUL, 0x8272792eUL,
-0x553fb2c0UL, 0x489ae22bUL, 0xd4ef9794UL, 0x125e3fbcUL, 0x21fffceeUL, 0x825b1bfdUL, 0x9255c5edUL, 0x1257a240UL,
-0x4e1a8302UL, 0xbae07fffUL, 0x528246e7UL, 0x8e57140eUL, 0x3373f7bfUL, 0x8c9f8188UL, 0xa6fc4ee8UL, 0xc982b5a5UL,
-0xa8c01db7UL, 0x579fc264UL, 0x67094f31UL, 0xf2bd3f5fUL, 0x40fff7c1UL, 0x1fb78dfcUL, 0x8e6bd2c1UL, 0x437be59bUL,
-0x99b03dbfUL, 0xb5dbc64bUL, 0x638dc0e6UL, 0x55819d99UL, 0xa197c81cUL, 0x4a012d6eUL, 0xc5884a28UL, 0xccc36f71UL,
-0xb843c213UL, 0x6c0743f1UL, 0x8309893cUL, 0x0feddd5fUL, 0x2f7fe850UL, 0xd7c07f7eUL, 0x02507fbfUL, 0x5afb9a04UL,
-0xa747d2d0UL, 0x1651192eUL, 0xaf70bf3eUL, 0x58c31380UL, 0x5f98302eUL, 0x727cc3c4UL, 0x0a0fb402UL, 0x0f7fef82UL,
-0x8c96fdadUL, 0x5d2c2aaeUL, 0x8ee99a49UL, 0x50da88b8UL, 0x8427f4a0UL, 0x1eac5790UL, 0x796fb449UL, 0x8252dc15UL,
-0xefbd7d9bUL, 0xa672597dUL, 0xada840d8UL, 0x45f54504UL, 0xfa5d7403UL, 0xe83ec305UL, 0x4f91751aUL, 0x925669c2UL,
-0x23efe941UL, 0xa903f12eUL, 0x60270df2UL, 0x0276e4b6UL, 0x94fd6574UL, 0x927985b2UL, 0x8276dbcbUL, 0x02778176UL,
-0xf8af918dUL, 0x4e48f79eUL, 0x8f616ddfUL, 0xe29d840eUL, 0x842f7d83UL, 0x340ce5c8UL, 0x96bbb682UL, 0x93b4b148UL,
-0xef303cabUL, 0x984faf28UL, 0x779faf9bUL, 0x92dc560dUL, 0x224d1e20UL, 0x8437aa88UL, 0x7d29dc96UL, 0x2756d3dcUL,
-0x8b907ceeUL, 0xb51fd240UL, 0xe7c07ce3UL, 0xe566b4a1UL, 0xc3e9615eUL, 0x3cf8209dUL, 0x6094d1e3UL, 0xcd9ca341UL,
-0x5c76460eUL, 0x00ea983bUL, 0xd4d67881UL, 0xfd47572cUL, 0xf76cedd9UL, 0xbda8229cUL, 0x127dadaaUL, 0x438a074eUL,
-0x1f97c090UL, 0x081bdb8aUL, 0x93a07ebeUL, 0xb938ca15UL, 0x97b03cffUL, 0x3dc2c0f8UL, 0x8d1ab2ecUL, 0x64380e51UL,
-0x68cc7bfbUL, 0xd90f2788UL, 0x12490181UL, 0x5de5ffd4UL, 0xdd7ef86aUL, 0x76a2e214UL, 0xb9a40368UL, 0x925d958fUL,
-0x4b39fffaUL, 0xba39aee9UL, 0xa4ffd30bUL, 0xfaf7933bUL, 0x6d498623UL, 0x193cbcfaUL, 0x27627545UL, 0x825cf47aUL,
-0x61bd8ba0UL, 0xd11e42d1UL, 0xcead04f4UL, 0x127ea392UL, 0x10428db7UL, 0x8272a972UL, 0x9270c4a8UL, 0x127de50bUL,
-0x285ba1c8UL, 0x3c62f44fUL, 0x35c0eaa5UL, 0xe805d231UL, 0x428929fbUL, 0xb4fcdf82UL, 0x4fb66a53UL, 0x0e7dc15bUL,
-0x1f081fabUL, 0x108618aeUL, 0xfcfd086dUL, 0xf9ff2889UL, 0x694bcc11UL, 0x236a5caeUL, 0x12deca4dUL, 0x2c3f8cc5UL,
-0xd2d02dfeUL, 0xf8ef5896UL, 0xe4cf52daUL, 0x95155b67UL, 0x494a488cUL, 0xb9b6a80cUL, 0x5c8f82bcUL, 0x89d36b45UL,
-0x3a609437UL, 0xec00c9a9UL, 0x44715253UL, 0x0a874b49UL, 0xd773bc40UL, 0x7c34671cUL, 0x02717ef6UL, 0x4feb5536UL,
-0xa2d02fffUL, 0xd2bf60c4UL, 0xd43f03c0UL, 0x50b4ef6dUL, 0x07478cd1UL, 0x006e1888UL, 0xa2e53f55UL, 0xb9e6d4bcUL,
-0xa2048016UL, 0x97573833UL, 0xd7207d67UL, 0xde0f8f3dUL, 0x72f87b33UL, 0xabcc4f33UL, 0x7688c55dUL, 0x7b00a6b0UL,
-0x947b0001UL, 0x570075d2UL, 0xf9bb88f8UL, 0x8942019eUL, 0x4264a5ffUL, 0x856302e0UL, 0x72dbd92bUL, 0xee971b69UL,
-0x6ea22fdeUL, 0x5f08ae2bUL, 0xaf7a616dUL, 0xe5c98767UL, 0xcf1febd2UL, 0x61efc8c2UL, 0xf1ac2571UL, 0xcc8239c2UL,
-0x67214cb8UL, 0xb1e583d1UL, 0xb7dc3e62UL, 0x7f10bdceUL, 0xf90a5c38UL, 0x0ff0443dUL, 0x606e6dc6UL, 0x60543a49UL,
-0x5727c148UL, 0x2be98a1dUL, 0x8ab41738UL, 0x20e1be24UL, 0xaf96da0fUL, 0x68458425UL, 0x99833be5UL, 0x600d457dUL,
-0x282f9350UL, 0x8334b362UL, 0xd91d1120UL, 0x2b6d8da0UL, 0x642b1e31UL, 0x9c305a00UL, 0x52bce688UL, 0x1b03588aUL,
-0xf7baefd5UL, 0x4142ed9cUL, 0xa4315c11UL, 0x83323ec5UL, 0xdfef4636UL, 0xa133c501UL, 0xe9d3531cUL, 0xee353783UL};
+ 0x8defc240UL, 0x25fa5d9fUL, 0xeb903dbfUL, 0xe810c907UL, 0x47607fffUL,
+ 0x369fe44bUL, 0x8c1fc644UL, 0xaececa90UL,
+ 0xbeb1f9bfUL, 0xeefbcaeaUL, 0xe8cf1950UL, 0x51df07aeUL, 0x920e8806UL,
+ 0xf0ad0548UL, 0xe13c8d83UL, 0x927010d5UL,
+ 0x11107d9fUL, 0x07647db9UL, 0xb2e3e4d4UL, 0x3d4f285eUL, 0xb9afa820UL,
+ 0xfade82e0UL, 0xa067268bUL, 0x8272792eUL,
+ 0x553fb2c0UL, 0x489ae22bUL, 0xd4ef9794UL, 0x125e3fbcUL, 0x21fffceeUL,
+ 0x825b1bfdUL, 0x9255c5edUL, 0x1257a240UL,
+ 0x4e1a8302UL, 0xbae07fffUL, 0x528246e7UL, 0x8e57140eUL, 0x3373f7bfUL,
+ 0x8c9f8188UL, 0xa6fc4ee8UL, 0xc982b5a5UL,
+ 0xa8c01db7UL, 0x579fc264UL, 0x67094f31UL, 0xf2bd3f5fUL, 0x40fff7c1UL,
+ 0x1fb78dfcUL, 0x8e6bd2c1UL, 0x437be59bUL,
+ 0x99b03dbfUL, 0xb5dbc64bUL, 0x638dc0e6UL, 0x55819d99UL, 0xa197c81cUL,
+ 0x4a012d6eUL, 0xc5884a28UL, 0xccc36f71UL,
+ 0xb843c213UL, 0x6c0743f1UL, 0x8309893cUL, 0x0feddd5fUL, 0x2f7fe850UL,
+ 0xd7c07f7eUL, 0x02507fbfUL, 0x5afb9a04UL,
+ 0xa747d2d0UL, 0x1651192eUL, 0xaf70bf3eUL, 0x58c31380UL, 0x5f98302eUL,
+ 0x727cc3c4UL, 0x0a0fb402UL, 0x0f7fef82UL,
+ 0x8c96fdadUL, 0x5d2c2aaeUL, 0x8ee99a49UL, 0x50da88b8UL, 0x8427f4a0UL,
+ 0x1eac5790UL, 0x796fb449UL, 0x8252dc15UL,
+ 0xefbd7d9bUL, 0xa672597dUL, 0xada840d8UL, 0x45f54504UL, 0xfa5d7403UL,
+ 0xe83ec305UL, 0x4f91751aUL, 0x925669c2UL,
+ 0x23efe941UL, 0xa903f12eUL, 0x60270df2UL, 0x0276e4b6UL, 0x94fd6574UL,
+ 0x927985b2UL, 0x8276dbcbUL, 0x02778176UL,
+ 0xf8af918dUL, 0x4e48f79eUL, 0x8f616ddfUL, 0xe29d840eUL, 0x842f7d83UL,
+ 0x340ce5c8UL, 0x96bbb682UL, 0x93b4b148UL,
+ 0xef303cabUL, 0x984faf28UL, 0x779faf9bUL, 0x92dc560dUL, 0x224d1e20UL,
+ 0x8437aa88UL, 0x7d29dc96UL, 0x2756d3dcUL,
+ 0x8b907ceeUL, 0xb51fd240UL, 0xe7c07ce3UL, 0xe566b4a1UL, 0xc3e9615eUL,
+ 0x3cf8209dUL, 0x6094d1e3UL, 0xcd9ca341UL,
+ 0x5c76460eUL, 0x00ea983bUL, 0xd4d67881UL, 0xfd47572cUL, 0xf76cedd9UL,
+ 0xbda8229cUL, 0x127dadaaUL, 0x438a074eUL,
+ 0x1f97c090UL, 0x081bdb8aUL, 0x93a07ebeUL, 0xb938ca15UL, 0x97b03cffUL,
+ 0x3dc2c0f8UL, 0x8d1ab2ecUL, 0x64380e51UL,
+ 0x68cc7bfbUL, 0xd90f2788UL, 0x12490181UL, 0x5de5ffd4UL, 0xdd7ef86aUL,
+ 0x76a2e214UL, 0xb9a40368UL, 0x925d958fUL,
+ 0x4b39fffaUL, 0xba39aee9UL, 0xa4ffd30bUL, 0xfaf7933bUL, 0x6d498623UL,
+ 0x193cbcfaUL, 0x27627545UL, 0x825cf47aUL,
+ 0x61bd8ba0UL, 0xd11e42d1UL, 0xcead04f4UL, 0x127ea392UL, 0x10428db7UL,
+ 0x8272a972UL, 0x9270c4a8UL, 0x127de50bUL,
+ 0x285ba1c8UL, 0x3c62f44fUL, 0x35c0eaa5UL, 0xe805d231UL, 0x428929fbUL,
+ 0xb4fcdf82UL, 0x4fb66a53UL, 0x0e7dc15bUL,
+ 0x1f081fabUL, 0x108618aeUL, 0xfcfd086dUL, 0xf9ff2889UL, 0x694bcc11UL,
+ 0x236a5caeUL, 0x12deca4dUL, 0x2c3f8cc5UL,
+ 0xd2d02dfeUL, 0xf8ef5896UL, 0xe4cf52daUL, 0x95155b67UL, 0x494a488cUL,
+ 0xb9b6a80cUL, 0x5c8f82bcUL, 0x89d36b45UL,
+ 0x3a609437UL, 0xec00c9a9UL, 0x44715253UL, 0x0a874b49UL, 0xd773bc40UL,
+ 0x7c34671cUL, 0x02717ef6UL, 0x4feb5536UL,
+ 0xa2d02fffUL, 0xd2bf60c4UL, 0xd43f03c0UL, 0x50b4ef6dUL, 0x07478cd1UL,
+ 0x006e1888UL, 0xa2e53f55UL, 0xb9e6d4bcUL,
+ 0xa2048016UL, 0x97573833UL, 0xd7207d67UL, 0xde0f8f3dUL, 0x72f87b33UL,
+ 0xabcc4f33UL, 0x7688c55dUL, 0x7b00a6b0UL,
+ 0x947b0001UL, 0x570075d2UL, 0xf9bb88f8UL, 0x8942019eUL, 0x4264a5ffUL,
+ 0x856302e0UL, 0x72dbd92bUL, 0xee971b69UL,
+ 0x6ea22fdeUL, 0x5f08ae2bUL, 0xaf7a616dUL, 0xe5c98767UL, 0xcf1febd2UL,
+ 0x61efc8c2UL, 0xf1ac2571UL, 0xcc8239c2UL,
+ 0x67214cb8UL, 0xb1e583d1UL, 0xb7dc3e62UL, 0x7f10bdceUL, 0xf90a5c38UL,
+ 0x0ff0443dUL, 0x606e6dc6UL, 0x60543a49UL,
+ 0x5727c148UL, 0x2be98a1dUL, 0x8ab41738UL, 0x20e1be24UL, 0xaf96da0fUL,
+ 0x68458425UL, 0x99833be5UL, 0x600d457dUL,
+ 0x282f9350UL, 0x8334b362UL, 0xd91d1120UL, 0x2b6d8da0UL, 0x642b1e31UL,
+ 0x9c305a00UL, 0x52bce688UL, 0x1b03588aUL,
+ 0xf7baefd5UL, 0x4142ed9cUL, 0xa4315c11UL, 0x83323ec5UL, 0xdfef4636UL,
+ 0xa133c501UL, 0xe9d3531cUL, 0xee353783UL };
const uint32_t s4[] PROGMEM = {
-0x9db30420UL, 0x1fb6e9deUL, 0xa7be7befUL, 0xd273a298UL, 0x4a4f7bdbUL, 0x64ad8c57UL, 0x85510443UL, 0xfa020ed1UL,
-0x7e287affUL, 0xe60fb663UL, 0x095f35a1UL, 0x79ebf120UL, 0xfd059d43UL, 0x6497b7b1UL, 0xf3641f63UL, 0x241e4adfUL,
-0x28147f5fUL, 0x4fa2b8cdUL, 0xc9430040UL, 0x0cc32220UL, 0xfdd30b30UL, 0xc0a5374fUL, 0x1d2d00d9UL, 0x24147b15UL,
-0xee4d111aUL, 0x0fca5167UL, 0x71ff904cUL, 0x2d195ffeUL, 0x1a05645fUL, 0x0c13fefeUL, 0x081b08caUL, 0x05170121UL,
-0x80530100UL, 0xe83e5efeUL, 0xac9af4f8UL, 0x7fe72701UL, 0xd2b8ee5fUL, 0x06df4261UL, 0xbb9e9b8aUL, 0x7293ea25UL,
-0xce84ffdfUL, 0xf5718801UL, 0x3dd64b04UL, 0xa26f263bUL, 0x7ed48400UL, 0x547eebe6UL, 0x446d4ca0UL, 0x6cf3d6f5UL,
-0x2649abdfUL, 0xaea0c7f5UL, 0x36338cc1UL, 0x503f7e93UL, 0xd3772061UL, 0x11b638e1UL, 0x72500e03UL, 0xf80eb2bbUL,
-0xabe0502eUL, 0xec8d77deUL, 0x57971e81UL, 0xe14f6746UL, 0xc9335400UL, 0x6920318fUL, 0x081dbb99UL, 0xffc304a5UL,
-0x4d351805UL, 0x7f3d5ce3UL, 0xa6c866c6UL, 0x5d5bcca9UL, 0xdaec6feaUL, 0x9f926f91UL, 0x9f46222fUL, 0x3991467dUL,
-0xa5bf6d8eUL, 0x1143c44fUL, 0x43958302UL, 0xd0214eebUL, 0x022083b8UL, 0x3fb6180cUL, 0x18f8931eUL, 0x281658e6UL,
-0x26486e3eUL, 0x8bd78a70UL, 0x7477e4c1UL, 0xb506e07cUL, 0xf32d0a25UL, 0x79098b02UL, 0xe4eabb81UL, 0x28123b23UL,
-0x69dead38UL, 0x1574ca16UL, 0xdf871b62UL, 0x211c40b7UL, 0xa51a9ef9UL, 0x0014377bUL, 0x041e8ac8UL, 0x09114003UL,
-0xbd59e4d2UL, 0xe3d156d5UL, 0x4fe876d5UL, 0x2f91a340UL, 0x557be8deUL, 0x00eae4a7UL, 0x0ce5c2ecUL, 0x4db4bba6UL,
-0xe756bdffUL, 0xdd3369acUL, 0xec17b035UL, 0x06572327UL, 0x99afc8b0UL, 0x56c8c391UL, 0x6b65811cUL, 0x5e146119UL,
-0x6e85cb75UL, 0xbe07c002UL, 0xc2325577UL, 0x893ff4ecUL, 0x5bbfc92dUL, 0xd0ec3b25UL, 0xb7801ab7UL, 0x8d6d3b24UL,
-0x20c763efUL, 0xc366a5fcUL, 0x9c382880UL, 0x0ace3205UL, 0xaac9548aUL, 0xeca1d7c7UL, 0x041afa32UL, 0x1d16625aUL,
-0x6701902cUL, 0x9b757a54UL, 0x31d477f7UL, 0x9126b031UL, 0x36cc6fdbUL, 0xc70b8b46UL, 0xd9e66a48UL, 0x56e55a79UL,
-0x026a4cebUL, 0x52437effUL, 0x2f8f76b4UL, 0x0df980a5UL, 0x8674cde3UL, 0xedda04ebUL, 0x17a9be04UL, 0x2c18f4dfUL,
-0xb7747f9dUL, 0xab2af7b4UL, 0xefc34d20UL, 0x2e096b7cUL, 0x1741a254UL, 0xe5b6a035UL, 0x213d42f6UL, 0x2c1c7c26UL,
-0x61c2f50fUL, 0x6552daf9UL, 0xd2c231f8UL, 0x25130f69UL, 0xd8167fa2UL, 0x0418f2c8UL, 0x001a96a6UL, 0x0d1526abUL,
-0x63315c21UL, 0x5e0a72ecUL, 0x49bafefdUL, 0x187908d9UL, 0x8d0dbd86UL, 0x311170a7UL, 0x3e9b640cUL, 0xcc3e10d7UL,
-0xd5cad3b6UL, 0x0caec388UL, 0xf73001e1UL, 0x6c728affUL, 0x71eae2a1UL, 0x1f9af36eUL, 0xcfcbd12fUL, 0xc1de8417UL,
-0xac07be6bUL, 0xcb44a1d8UL, 0x8b9b0f56UL, 0x013988c3UL, 0xb1c52fcaUL, 0xb4be31cdUL, 0xd8782806UL, 0x12a3a4e2UL,
-0x6f7de532UL, 0x58fd7eb6UL, 0xd01ee900UL, 0x24adffc2UL, 0xf4990fc5UL, 0x9711aac5UL, 0x001d7b95UL, 0x82e5e7d2UL,
-0x109873f6UL, 0x00613096UL, 0xc32d9521UL, 0xada121ffUL, 0x29908415UL, 0x7fbb977fUL, 0xaf9eb3dbUL, 0x29c9ed2aUL,
-0x5ce2a465UL, 0xa730f32cUL, 0xd0aa3fe8UL, 0x8a5cc091UL, 0xd49e2ce7UL, 0x0ce454a9UL, 0xd60acd86UL, 0x015f1919UL,
-0x77079103UL, 0xdea03af6UL, 0x78a8565eUL, 0xdee356dfUL, 0x21f05cbeUL, 0x8b75e387UL, 0xb3c50651UL, 0xb8a5c3efUL,
-0xd8eeb6d2UL, 0xe523be77UL, 0xc2154529UL, 0x2f69efdfUL, 0xafe67afbUL, 0xf470c4b2UL, 0xf3e0eb5bUL, 0xd6cc9876UL,
-0x39e4460cUL, 0x1fda8538UL, 0x1987832fUL, 0xca007367UL, 0xa99144f8UL, 0x296b299eUL, 0x492fc295UL, 0x9266beabUL,
-0xb5676e69UL, 0x9bd3dddaUL, 0xdf7e052fUL, 0xdb25701cUL, 0x1b5e51eeUL, 0xf65324e6UL, 0x6afce36cUL, 0x0316cc04UL,
-0x8644213eUL, 0xb7dc59d0UL, 0x7965291fUL, 0xccd6fd43UL, 0x41823979UL, 0x932bcdf6UL, 0xb657c34dUL, 0x4edfd282UL,
-0x7ae5290cUL, 0x3cb9536bUL, 0x851e20feUL, 0x9833557eUL, 0x13ecf0b0UL, 0xd3ffb372UL, 0x3f85c5c1UL, 0x0aef7ed2UL};
+ 0x9db30420UL, 0x1fb6e9deUL, 0xa7be7befUL, 0xd273a298UL, 0x4a4f7bdbUL,
+ 0x64ad8c57UL, 0x85510443UL, 0xfa020ed1UL,
+ 0x7e287affUL, 0xe60fb663UL, 0x095f35a1UL, 0x79ebf120UL, 0xfd059d43UL,
+ 0x6497b7b1UL, 0xf3641f63UL, 0x241e4adfUL,
+ 0x28147f5fUL, 0x4fa2b8cdUL, 0xc9430040UL, 0x0cc32220UL, 0xfdd30b30UL,
+ 0xc0a5374fUL, 0x1d2d00d9UL, 0x24147b15UL,
+ 0xee4d111aUL, 0x0fca5167UL, 0x71ff904cUL, 0x2d195ffeUL, 0x1a05645fUL,
+ 0x0c13fefeUL, 0x081b08caUL, 0x05170121UL,
+ 0x80530100UL, 0xe83e5efeUL, 0xac9af4f8UL, 0x7fe72701UL, 0xd2b8ee5fUL,
+ 0x06df4261UL, 0xbb9e9b8aUL, 0x7293ea25UL,
+ 0xce84ffdfUL, 0xf5718801UL, 0x3dd64b04UL, 0xa26f263bUL, 0x7ed48400UL,
+ 0x547eebe6UL, 0x446d4ca0UL, 0x6cf3d6f5UL,
+ 0x2649abdfUL, 0xaea0c7f5UL, 0x36338cc1UL, 0x503f7e93UL, 0xd3772061UL,
+ 0x11b638e1UL, 0x72500e03UL, 0xf80eb2bbUL,
+ 0xabe0502eUL, 0xec8d77deUL, 0x57971e81UL, 0xe14f6746UL, 0xc9335400UL,
+ 0x6920318fUL, 0x081dbb99UL, 0xffc304a5UL,
+ 0x4d351805UL, 0x7f3d5ce3UL, 0xa6c866c6UL, 0x5d5bcca9UL, 0xdaec6feaUL,
+ 0x9f926f91UL, 0x9f46222fUL, 0x3991467dUL,
+ 0xa5bf6d8eUL, 0x1143c44fUL, 0x43958302UL, 0xd0214eebUL, 0x022083b8UL,
+ 0x3fb6180cUL, 0x18f8931eUL, 0x281658e6UL,
+ 0x26486e3eUL, 0x8bd78a70UL, 0x7477e4c1UL, 0xb506e07cUL, 0xf32d0a25UL,
+ 0x79098b02UL, 0xe4eabb81UL, 0x28123b23UL,
+ 0x69dead38UL, 0x1574ca16UL, 0xdf871b62UL, 0x211c40b7UL, 0xa51a9ef9UL,
+ 0x0014377bUL, 0x041e8ac8UL, 0x09114003UL,
+ 0xbd59e4d2UL, 0xe3d156d5UL, 0x4fe876d5UL, 0x2f91a340UL, 0x557be8deUL,
+ 0x00eae4a7UL, 0x0ce5c2ecUL, 0x4db4bba6UL,
+ 0xe756bdffUL, 0xdd3369acUL, 0xec17b035UL, 0x06572327UL, 0x99afc8b0UL,
+ 0x56c8c391UL, 0x6b65811cUL, 0x5e146119UL,
+ 0x6e85cb75UL, 0xbe07c002UL, 0xc2325577UL, 0x893ff4ecUL, 0x5bbfc92dUL,
+ 0xd0ec3b25UL, 0xb7801ab7UL, 0x8d6d3b24UL,
+ 0x20c763efUL, 0xc366a5fcUL, 0x9c382880UL, 0x0ace3205UL, 0xaac9548aUL,
+ 0xeca1d7c7UL, 0x041afa32UL, 0x1d16625aUL,
+ 0x6701902cUL, 0x9b757a54UL, 0x31d477f7UL, 0x9126b031UL, 0x36cc6fdbUL,
+ 0xc70b8b46UL, 0xd9e66a48UL, 0x56e55a79UL,
+ 0x026a4cebUL, 0x52437effUL, 0x2f8f76b4UL, 0x0df980a5UL, 0x8674cde3UL,
+ 0xedda04ebUL, 0x17a9be04UL, 0x2c18f4dfUL,
+ 0xb7747f9dUL, 0xab2af7b4UL, 0xefc34d20UL, 0x2e096b7cUL, 0x1741a254UL,
+ 0xe5b6a035UL, 0x213d42f6UL, 0x2c1c7c26UL,
+ 0x61c2f50fUL, 0x6552daf9UL, 0xd2c231f8UL, 0x25130f69UL, 0xd8167fa2UL,
+ 0x0418f2c8UL, 0x001a96a6UL, 0x0d1526abUL,
+ 0x63315c21UL, 0x5e0a72ecUL, 0x49bafefdUL, 0x187908d9UL, 0x8d0dbd86UL,
+ 0x311170a7UL, 0x3e9b640cUL, 0xcc3e10d7UL,
+ 0xd5cad3b6UL, 0x0caec388UL, 0xf73001e1UL, 0x6c728affUL, 0x71eae2a1UL,
+ 0x1f9af36eUL, 0xcfcbd12fUL, 0xc1de8417UL,
+ 0xac07be6bUL, 0xcb44a1d8UL, 0x8b9b0f56UL, 0x013988c3UL, 0xb1c52fcaUL,
+ 0xb4be31cdUL, 0xd8782806UL, 0x12a3a4e2UL,
+ 0x6f7de532UL, 0x58fd7eb6UL, 0xd01ee900UL, 0x24adffc2UL, 0xf4990fc5UL,
+ 0x9711aac5UL, 0x001d7b95UL, 0x82e5e7d2UL,
+ 0x109873f6UL, 0x00613096UL, 0xc32d9521UL, 0xada121ffUL, 0x29908415UL,
+ 0x7fbb977fUL, 0xaf9eb3dbUL, 0x29c9ed2aUL,
+ 0x5ce2a465UL, 0xa730f32cUL, 0xd0aa3fe8UL, 0x8a5cc091UL, 0xd49e2ce7UL,
+ 0x0ce454a9UL, 0xd60acd86UL, 0x015f1919UL,
+ 0x77079103UL, 0xdea03af6UL, 0x78a8565eUL, 0xdee356dfUL, 0x21f05cbeUL,
+ 0x8b75e387UL, 0xb3c50651UL, 0xb8a5c3efUL,
+ 0xd8eeb6d2UL, 0xe523be77UL, 0xc2154529UL, 0x2f69efdfUL, 0xafe67afbUL,
+ 0xf470c4b2UL, 0xf3e0eb5bUL, 0xd6cc9876UL,
+ 0x39e4460cUL, 0x1fda8538UL, 0x1987832fUL, 0xca007367UL, 0xa99144f8UL,
+ 0x296b299eUL, 0x492fc295UL, 0x9266beabUL,
+ 0xb5676e69UL, 0x9bd3dddaUL, 0xdf7e052fUL, 0xdb25701cUL, 0x1b5e51eeUL,
+ 0xf65324e6UL, 0x6afce36cUL, 0x0316cc04UL,
+ 0x8644213eUL, 0xb7dc59d0UL, 0x7965291fUL, 0xccd6fd43UL, 0x41823979UL,
+ 0x932bcdf6UL, 0xb657c34dUL, 0x4edfd282UL,
+ 0x7ae5290cUL, 0x3cb9536bUL, 0x851e20feUL, 0x9833557eUL, 0x13ecf0b0UL,
+ 0xd3ffb372UL, 0x3f85c5c1UL, 0x0aef7ed2UL };
#else
const uint32_t s1[] PROGMEM = {
-0xd440fb30UL, 0x0bffa09fUL, 0x2fcdec6bUL, 0x7a8c253fUL, 0x2f3f211eUL, 0xd34d009cUL, 0x40e50360UL, 0x49c99fcfUL,
-0x27afd4bfUL, 0xb5bdbb88UL, 0x904003e2UL, 0x7596d098UL, 0xe0a0636eUL, 0xd261c315UL, 0x1d66e7c2UL, 0x8effd422UL,
-0x6f3b6828UL, 0x59d07fc0UL, 0xc87923ffUL, 0xe2505f77UL, 0xd340c343UL, 0x56862fdfUL, 0x1aa47c88UL, 0x2dbdd2a2UL,
-0xd6e0c9a1UL, 0x19486c34UL, 0x876db761UL, 0x2f0f5422UL, 0xe132be2aUL, 0x6b1654aaUL, 0x3a8e5622UL, 0xd041d3a2UL,
-0xc840db66UL, 0x2f3984a7UL, 0x2fff4d00UL, 0xded2b92dUL, 0xac3f9497UL, 0xd8c1974aUL, 0xb7447652UL, 0xa737f4b5UL,
-0xefba2cb8UL, 0x59d151d7UL, 0xedf0f76fUL, 0x1f7a095aUL, 0xd0687b82UL, 0x2ef5ec90UL, 0x54c0b022UL, 0x35598ebcUL,
-0x7f2f6d4bUL, 0xa264bb50UL, 0x104966d2UL, 0x2d81e5beUL, 0x902233b7UL, 0x9f153be9UL, 0x11e48eb4UL, 0x5d34ff4bUL,
-0x40c245fdUL, 0x3f9731adUL, 0x2ed0f6c4UL, 0x6581fc55UL, 0xadcab1d5UL, 0xae2daca1UL, 0x6db7d4a2UL, 0x500c9bc1UL,
-0xf2402288UL, 0x384f6e0cUL, 0xd7bfe4a4UL, 0x72a25b4fUL, 0x2f1d4c56UL, 0x19539cc5UL, 0x54e349b9UL, 0xfe6946b0UL,
-0x8aabb6b1UL, 0xdd5813c7UL, 0x45c58563UL, 0x5d930f11UL, 0xd58a5357UL, 0x9304396aUL, 0xe0373de6UL, 0xb3f6542aUL,
-0x5f7d783aUL, 0xb5a07662UL, 0xdffca619UL, 0x6a20427aUL, 0xd5d4f929UL, 0x91181bf6UL, 0x5e2772bbUL, 0x678150aaUL,
-0x91109038UL, 0xeb05b5c6UL, 0x8ccbc784UL, 0x0f5ad72aUL, 0x27144a87UL, 0x6b93d1a2UL, 0xaf86d22aUL, 0x91d256aaUL,
-0x604389d7UL, 0x0d755c42UL, 0x269eb393UL, 0xc9847118UL, 0x2db3006cUL, 0x14bbe273UL, 0x3cbcbea0UL, 0x79376254UL,
-0xab9e4564UL, 0x828b323fUL, 0x82cf1877UL, 0xa6cea259UL, 0x2e00ee04UL, 0xe678fe89UL, 0x5009ab3fUL, 0xc2f65f32UL,
-0x053f3881UL, 0xc8c56369UL, 0xd65acb76UL, 0xc97499d4UL, 0xcf0d18caUL, 0xd5820738UL, 0xf65cfac7UL, 0x1115c38aUL,
-0x139ee735UL, 0xd091da47UL, 0x86900ff4UL, 0x9e41e2a7UL, 0x41623631UL, 0x95f41e05UL, 0x043b57aaUL, 0x8d5d804aUL,
-0xd0008354UL, 0x3c2a3200UL, 0xdfcd64bfUL, 0x8ea657baUL, 0x2b37c675UL, 0x41d3af50UL, 0x7532c1a7UL, 0xf50b5a91UL,
-0xabbf546bUL, 0x26140b2bUL, 0xd7c94cabUL, 0x82cd9c44UL, 0x65f2fbf7UL, 0xf3c585abUL, 0x94db551bUL, 0x24e3d4aaUL,
-0x3fbda4cfUL, 0xe2a3ea2dUL, 0x024d209eUL, 0xac25bdc8UL, 0xb355dfeaUL, 0x989ebdd5UL, 0xb23112e3UL, 0x6cadd52aUL,
-0xde294395UL, 0x2845beadUL, 0x690f71d8UL, 0x0fc951aaUL, 0xf66b78aaUL, 0x1e3f5122UL, 0x9ba751aaUL, 0xcc44d32aUL,
-0xf0415a7bUL, 0xadfb7cd3UL, 0x0595061bUL, 0x91e4ec41UL, 0xe632c3b4UL, 0xd4682203UL, 0xcc0a60c9UL, 0x6d7e38ceUL,
-0x6cb16bbfUL, 0x78fb706aUL, 0xc9d9030dUL, 0xde39dfd4UL, 0xda6310e0UL, 0x64f43647UL, 0xd828d35aUL, 0x96cc47b3UL,
-0xc30fbb75UL, 0xfb1b5198UL, 0x35ccfb4fUL, 0x6acf8bb5UL, 0xbc0a1fe1UL, 0x4afec5bfUL, 0x10ec0aa7UL, 0x0a5739acUL,
-0x2f44043fUL, 0x53b18861UL, 0x2e7a39e0UL, 0x79cb2757UL, 0x8f41eb9cUL, 0x8dd6ac1cUL, 0x967cd32aUL, 0x9dcb7501UL,
-0x09ff9dc6UL, 0xf0655bc7UL, 0xd840dbd9UL, 0x79770eecUL, 0xd4ea4447UL, 0x74321cb1UL, 0x9ecb24ddUL, 0xbd541c7eUL,
-0xf94411f0UL, 0xb10e24d2UL, 0xfdb37596UL, 0x5537aca3UL, 0xaf277cd4UL, 0x4d5fc851UL, 0x96759056UL, 0xe615bba5UL,
-0xf0040358UL, 0xf12c04caUL, 0xea371a01UL, 0xdbaabf8dUL, 0x4a3eba35UL, 0xa0ff2635UL, 0x094d7bc3UL, 0xd96e30bcUL,
-0x6626a598UL, 0x25f74856UL, 0x9d565effUL, 0xd063ed0cUL, 0xcfb2637cUL, 0xe1450b70UL, 0xf150ead5UL, 0x7228a985UL,
-0xa7bd1fafUL, 0x704823d4UL, 0xf30b87a7UL, 0x794d3b2dUL, 0x9841e042UL, 0xe7edd00cUL, 0xb80d4726UL, 0x4c8181f8UL,
-0xd76a4d47UL, 0x5c5e0c7cUL, 0x591923d1UL, 0x98721b38UL, 0xdbf4d2f5UL, 0x538683abUL, 0x231e2f6eUL, 0x9e9c7183UL,
-0x46e091bdUL, 0x6e45569aUL, 0x0c2039dcUL, 0x71c5c820UL, 0x1cda2b96UL, 0xff96e6e1UL, 0x08ab41b1UL, 0xb989ca7cUL,
-0x83e7691aUL, 0x4348cc02UL, 0x79c5f7a2UL, 0x7df49e42UL, 0x9c167b42UL, 0x49f0c95aUL, 0x000f8fddUL, 0xbf65815cUL};
+ 0xd440fb30UL, 0x0bffa09fUL, 0x2fcdec6bUL, 0x7a8c253fUL, 0x2f3f211eUL, 0xd34d009cUL, 0x40e50360UL, 0x49c99fcfUL,
+ 0x27afd4bfUL, 0xb5bdbb88UL, 0x904003e2UL, 0x7596d098UL, 0xe0a0636eUL, 0xd261c315UL, 0x1d66e7c2UL, 0x8effd422UL,
+ 0x6f3b6828UL, 0x59d07fc0UL, 0xc87923ffUL, 0xe2505f77UL, 0xd340c343UL, 0x56862fdfUL, 0x1aa47c88UL, 0x2dbdd2a2UL,
+ 0xd6e0c9a1UL, 0x19486c34UL, 0x876db761UL, 0x2f0f5422UL, 0xe132be2aUL, 0x6b1654aaUL, 0x3a8e5622UL, 0xd041d3a2UL,
+ 0xc840db66UL, 0x2f3984a7UL, 0x2fff4d00UL, 0xded2b92dUL, 0xac3f9497UL, 0xd8c1974aUL, 0xb7447652UL, 0xa737f4b5UL,
+ 0xefba2cb8UL, 0x59d151d7UL, 0xedf0f76fUL, 0x1f7a095aUL, 0xd0687b82UL, 0x2ef5ec90UL, 0x54c0b022UL, 0x35598ebcUL,
+ 0x7f2f6d4bUL, 0xa264bb50UL, 0x104966d2UL, 0x2d81e5beUL, 0x902233b7UL, 0x9f153be9UL, 0x11e48eb4UL, 0x5d34ff4bUL,
+ 0x40c245fdUL, 0x3f9731adUL, 0x2ed0f6c4UL, 0x6581fc55UL, 0xadcab1d5UL, 0xae2daca1UL, 0x6db7d4a2UL, 0x500c9bc1UL,
+ 0xf2402288UL, 0x384f6e0cUL, 0xd7bfe4a4UL, 0x72a25b4fUL, 0x2f1d4c56UL, 0x19539cc5UL, 0x54e349b9UL, 0xfe6946b0UL,
+ 0x8aabb6b1UL, 0xdd5813c7UL, 0x45c58563UL, 0x5d930f11UL, 0xd58a5357UL, 0x9304396aUL, 0xe0373de6UL, 0xb3f6542aUL,
+ 0x5f7d783aUL, 0xb5a07662UL, 0xdffca619UL, 0x6a20427aUL, 0xd5d4f929UL, 0x91181bf6UL, 0x5e2772bbUL, 0x678150aaUL,
+ 0x91109038UL, 0xeb05b5c6UL, 0x8ccbc784UL, 0x0f5ad72aUL, 0x27144a87UL, 0x6b93d1a2UL, 0xaf86d22aUL, 0x91d256aaUL,
+ 0x604389d7UL, 0x0d755c42UL, 0x269eb393UL, 0xc9847118UL, 0x2db3006cUL, 0x14bbe273UL, 0x3cbcbea0UL, 0x79376254UL,
+ 0xab9e4564UL, 0x828b323fUL, 0x82cf1877UL, 0xa6cea259UL, 0x2e00ee04UL, 0xe678fe89UL, 0x5009ab3fUL, 0xc2f65f32UL,
+ 0x053f3881UL, 0xc8c56369UL, 0xd65acb76UL, 0xc97499d4UL, 0xcf0d18caUL, 0xd5820738UL, 0xf65cfac7UL, 0x1115c38aUL,
+ 0x139ee735UL, 0xd091da47UL, 0x86900ff4UL, 0x9e41e2a7UL, 0x41623631UL, 0x95f41e05UL, 0x043b57aaUL, 0x8d5d804aUL,
+ 0xd0008354UL, 0x3c2a3200UL, 0xdfcd64bfUL, 0x8ea657baUL, 0x2b37c675UL, 0x41d3af50UL, 0x7532c1a7UL, 0xf50b5a91UL,
+ 0xabbf546bUL, 0x26140b2bUL, 0xd7c94cabUL, 0x82cd9c44UL, 0x65f2fbf7UL, 0xf3c585abUL, 0x94db551bUL, 0x24e3d4aaUL,
+ 0x3fbda4cfUL, 0xe2a3ea2dUL, 0x024d209eUL, 0xac25bdc8UL, 0xb355dfeaUL, 0x989ebdd5UL, 0xb23112e3UL, 0x6cadd52aUL,
+ 0xde294395UL, 0x2845beadUL, 0x690f71d8UL, 0x0fc951aaUL, 0xf66b78aaUL, 0x1e3f5122UL, 0x9ba751aaUL, 0xcc44d32aUL,
+ 0xf0415a7bUL, 0xadfb7cd3UL, 0x0595061bUL, 0x91e4ec41UL, 0xe632c3b4UL, 0xd4682203UL, 0xcc0a60c9UL, 0x6d7e38ceUL,
+ 0x6cb16bbfUL, 0x78fb706aUL, 0xc9d9030dUL, 0xde39dfd4UL, 0xda6310e0UL, 0x64f43647UL, 0xd828d35aUL, 0x96cc47b3UL,
+ 0xc30fbb75UL, 0xfb1b5198UL, 0x35ccfb4fUL, 0x6acf8bb5UL, 0xbc0a1fe1UL, 0x4afec5bfUL, 0x10ec0aa7UL, 0x0a5739acUL,
+ 0x2f44043fUL, 0x53b18861UL, 0x2e7a39e0UL, 0x79cb2757UL, 0x8f41eb9cUL, 0x8dd6ac1cUL, 0x967cd32aUL, 0x9dcb7501UL,
+ 0x09ff9dc6UL, 0xf0655bc7UL, 0xd840dbd9UL, 0x79770eecUL, 0xd4ea4447UL, 0x74321cb1UL, 0x9ecb24ddUL, 0xbd541c7eUL,
+ 0xf94411f0UL, 0xb10e24d2UL, 0xfdb37596UL, 0x5537aca3UL, 0xaf277cd4UL, 0x4d5fc851UL, 0x96759056UL, 0xe615bba5UL,
+ 0xf0040358UL, 0xf12c04caUL, 0xea371a01UL, 0xdbaabf8dUL, 0x4a3eba35UL, 0xa0ff2635UL, 0x094d7bc3UL, 0xd96e30bcUL,
+ 0x6626a598UL, 0x25f74856UL, 0x9d565effUL, 0xd063ed0cUL, 0xcfb2637cUL, 0xe1450b70UL, 0xf150ead5UL, 0x7228a985UL,
+ 0xa7bd1fafUL, 0x704823d4UL, 0xf30b87a7UL, 0x794d3b2dUL, 0x9841e042UL, 0xe7edd00cUL, 0xb80d4726UL, 0x4c8181f8UL,
+ 0xd76a4d47UL, 0x5c5e0c7cUL, 0x591923d1UL, 0x98721b38UL, 0xdbf4d2f5UL, 0x538683abUL, 0x231e2f6eUL, 0x9e9c7183UL,
+ 0x46e091bdUL, 0x6e45569aUL, 0x0c2039dcUL, 0x71c5c820UL, 0x1cda2b96UL, 0xff96e6e1UL, 0x08ab41b1UL, 0xb989ca7cUL,
+ 0x83e7691aUL, 0x4348cc02UL, 0x79c5f7a2UL, 0x7df49e42UL, 0x9c167b42UL, 0x49f0c95aUL, 0x000f8fddUL, 0xbf65815cUL};
const uint32_t s2[] PROGMEM = {
-0x9410201fUL, 0x5ba70befUL, 0x7ecfe369UL, 0x80433f39UL, 0x7acf61feUL, 0x7a20c5eeUL, 0x949c8855UL, 0x5106fc72UL,
-0x79efa7adUL, 0x35721d4eUL, 0xce635ad5UL, 0xba3604deUL, 0xef30c499UL, 0x94070c5fUL, 0x7ddbdc18UL, 0xf3efd6a1UL,
-0x7b2fb5a0UL, 0x0536e859UL, 0x94b015eeUL, 0x09d9ffe9UL, 0x860044dcUL, 0x594494efUL, 0xb3cc83baUL, 0xfbcdc3e0UL,
-0x8141dad1UL, 0xb12a093bUL, 0xc1f197f9UL, 0x7bcfe6a5UL, 0xdb0d4201UL, 0x5befe7e4UL, 0x41ffa125UL, 0x06f880e1UL,
-0x8010c41fUL, 0x7aee9b17UL, 0xa9c67ad3UL, 0xa43058feUL, 0x7f8bde98UL, 0x4e3fe877UL, 0x69929279UL, 0x7b9ffa24UL,
-0x5bc813e1UL, 0x8300c4acUL, 0x253550d7UL, 0x5f61eaf7UL, 0x54311462UL, 0x634b550dUL, 0x2111685dUL, 0x59c366c8UL,
-0x73cf633dUL, 0xc034e2ceUL, 0x877ed8d4UL, 0x212b675cUL, 0x81611f07UL, 0x7f62f739UL, 0x84301e36UL, 0x3b57ebe4UL,
-0xa4642f60UL, 0x9ccd3ad6UL, 0x3546bc1bUL, 0x2d03819eUL, 0x0cf50127UL, 0xb47a8499UL, 0x79dfe3a0UL, 0x8cf36cbaUL,
-0x94308410UL, 0x5ea93725UL, 0xfe6f6ff4UL, 0x1f3bffa1UL, 0x6afb8c20UL, 0x748c458fUL, 0x27a2e0d9UL, 0x343ac74eUL,
-0x694f88fcUL, 0xdfe84d3eUL, 0x88000eefUL, 0x8d645935UL, 0x8c38458aUL, 0x6643801dUL, 0xfd9b1d72UL, 0xbb8486a5UL,
-0x336325e8UL, 0x12824e84UL, 0x98808d12UL, 0xb43fd3feUL, 0xe10a28ceUL, 0xa59be127UL, 0x52c2a6d5UL, 0xbd5497e4UL,
-0xdd55d6c5UL, 0x647066ebUL, 0x4d0b8477UL, 0x01a8b6a1UL, 0xa926db84UL, 0x1467b5e0UL, 0xb743f021UL, 0x6058d0e5UL,
-0x8430f054UL, 0x72f46f06UL, 0x53a11aa3UL, 0x5547dcdaUL, 0xbf5d62b5UL, 0xe61b5668UL, 0x946bca83UL, 0x3bd26e2dUL,
-0xdb01cfecUL, 0xbad0d3a6UL, 0x5c3d80b6UL, 0x09a777afUL, 0x4ca3b433UL, 0xd6c87b39UL, 0x952be25eUL, 0x04530e5fUL,
-0x616fed81UL, 0x6443e720UL, 0x78135eb4UL, 0x9b6318deUL, 0x22a11c88UL, 0xd12667b9UL, 0xe8a74980UL, 0x7bdab722UL,
-0x252d555eUL, 0x37d27252UL, 0x1c95d279UL, 0x4c890dc6UL, 0x02b48c48UL, 0x5bfea41bUL, 0x6b9fb0a4UL, 0xcf15a81cUL,
-0x05300ca2UL, 0x63df7188UL, 0xcb2fdeb9UL, 0xe9c9c60cUL, 0x53ffee0bUL, 0x174521e3UL, 0x352854b4UL, 0x3c29639fUL,
-0x29e741eeUL, 0x7c2d1d6eUL, 0x86520450UL, 0xf385661eUL, 0xc60134f3UL, 0x952ca230UL, 0x5008a731UL, 0x130f9360UL,
-0x1784f973UL, 0x599826a1UL, 0x445c64ecUL, 0xa977c852UL, 0xa633ffcdUL, 0x41172ba0UL, 0xa2d9ba7cUL, 0x6f038021UL,
-0x089cd950UL, 0x61483fcbUL, 0x65d76bc2UL, 0xabf6a364UL, 0x76263480UL, 0x7b5ea725UL, 0xfcd1e6e4UL, 0xe610c720UL,
-0x80b6f0cdUL, 0x3b4d8417UL, 0x4df8ee31UL, 0xe424087eUL, 0xeb49cb2cUL, 0xae3b6a84UL, 0x8878f78fUL, 0xf6605deeUL,
-0x7356f77aUL, 0xdb5cdd2fUL, 0xc13116a1UL, 0x436ff630UL, 0x54ecfab3UL, 0xfad77f15UL, 0xcc7985efUL, 0x58de52d1UL,
-0x5efd2fdbUL, 0x19ce328fUL, 0x7af96a30UL, 0xf83ef002UL, 0xd59a3199UL, 0x0ffa42c2UL, 0xb0ebe3a7UL, 0x06498ec6UL,
-0x0c23dab8UL, 0x28308280UL, 0xc8f3dedcUL, 0x71b15fd3UL, 0xc81b8a08UL, 0x60c5c0beUL, 0xe8c9a361UL, 0x4df5a8bcUL,
-0xfaef2fc7UL, 0x992e8222UL, 0xb470c582UL, 0x894ed9d8UL, 0xbc341c8bUL, 0xe6161e30UL, 0x79e93b27UL, 0xa6eaffb0UL,
-0xc6b8d961UL, 0x6948b200UL, 0x3fceffb7UL, 0x3b28dc08UL, 0x5af6da43UL, 0x9897e1f7UL, 0x2fb71976UL, 0xa49b1c8fUL,
-0xa03786dcUL, 0xb1d3a716UL, 0xb793c39fUL, 0xeb6e13a7UL, 0x3ec6bcc6UL, 0x4237511aUL, 0xbc2868efUL, 0xd6650352UL,
-0xab776a2dUL, 0x4bed2735UL, 0x16d21f82UL, 0x2e6e5c09UL, 0xfbf292dbUL, 0xcb29ea5eUL, 0xf5925814UL, 0x7f4f5891UL,
-0x7b698354UL, 0xcca86726UL, 0x48601985UL, 0xeaac4b8cUL, 0xd4603883UL, 0xf9e0230dUL, 0x8a7e386cUL, 0x49d2e60aUL,
-0x0c6084b2UL, 0x1d7335d8UL, 0x47c6b1dcUL, 0xea564cacUL, 0xb381bd3eUL, 0xb0ab0e23UL, 0x87bc3864UL, 0xfab1b5f0UL,
-0xb3a25e8fUL, 0x424618fcUL, 0x7a6b030aUL, 0xbd89b04fUL, 0x89a59d64UL, 0x5e4145a3UL, 0x2383035cUL, 0xb93b5d3eUL,
-0x7295d743UL, 0x7cd06d7eUL, 0x1edfdf06UL, 0xefc46c6cUL, 0x39a56071UL, 0x70bebf73UL, 0x05768783UL, 0xf1ec2345UL};
+ 0x9410201fUL, 0x5ba70befUL, 0x7ecfe369UL, 0x80433f39UL, 0x7acf61feUL, 0x7a20c5eeUL, 0x949c8855UL, 0x5106fc72UL,
+ 0x79efa7adUL, 0x35721d4eUL, 0xce635ad5UL, 0xba3604deUL, 0xef30c499UL, 0x94070c5fUL, 0x7ddbdc18UL, 0xf3efd6a1UL,
+ 0x7b2fb5a0UL, 0x0536e859UL, 0x94b015eeUL, 0x09d9ffe9UL, 0x860044dcUL, 0x594494efUL, 0xb3cc83baUL, 0xfbcdc3e0UL,
+ 0x8141dad1UL, 0xb12a093bUL, 0xc1f197f9UL, 0x7bcfe6a5UL, 0xdb0d4201UL, 0x5befe7e4UL, 0x41ffa125UL, 0x06f880e1UL,
+ 0x8010c41fUL, 0x7aee9b17UL, 0xa9c67ad3UL, 0xa43058feUL, 0x7f8bde98UL, 0x4e3fe877UL, 0x69929279UL, 0x7b9ffa24UL,
+ 0x5bc813e1UL, 0x8300c4acUL, 0x253550d7UL, 0x5f61eaf7UL, 0x54311462UL, 0x634b550dUL, 0x2111685dUL, 0x59c366c8UL,
+ 0x73cf633dUL, 0xc034e2ceUL, 0x877ed8d4UL, 0x212b675cUL, 0x81611f07UL, 0x7f62f739UL, 0x84301e36UL, 0x3b57ebe4UL,
+ 0xa4642f60UL, 0x9ccd3ad6UL, 0x3546bc1bUL, 0x2d03819eUL, 0x0cf50127UL, 0xb47a8499UL, 0x79dfe3a0UL, 0x8cf36cbaUL,
+ 0x94308410UL, 0x5ea93725UL, 0xfe6f6ff4UL, 0x1f3bffa1UL, 0x6afb8c20UL, 0x748c458fUL, 0x27a2e0d9UL, 0x343ac74eUL,
+ 0x694f88fcUL, 0xdfe84d3eUL, 0x88000eefUL, 0x8d645935UL, 0x8c38458aUL, 0x6643801dUL, 0xfd9b1d72UL, 0xbb8486a5UL,
+ 0x336325e8UL, 0x12824e84UL, 0x98808d12UL, 0xb43fd3feUL, 0xe10a28ceUL, 0xa59be127UL, 0x52c2a6d5UL, 0xbd5497e4UL,
+ 0xdd55d6c5UL, 0x647066ebUL, 0x4d0b8477UL, 0x01a8b6a1UL, 0xa926db84UL, 0x1467b5e0UL, 0xb743f021UL, 0x6058d0e5UL,
+ 0x8430f054UL, 0x72f46f06UL, 0x53a11aa3UL, 0x5547dcdaUL, 0xbf5d62b5UL, 0xe61b5668UL, 0x946bca83UL, 0x3bd26e2dUL,
+ 0xdb01cfecUL, 0xbad0d3a6UL, 0x5c3d80b6UL, 0x09a777afUL, 0x4ca3b433UL, 0xd6c87b39UL, 0x952be25eUL, 0x04530e5fUL,
+ 0x616fed81UL, 0x6443e720UL, 0x78135eb4UL, 0x9b6318deUL, 0x22a11c88UL, 0xd12667b9UL, 0xe8a74980UL, 0x7bdab722UL,
+ 0x252d555eUL, 0x37d27252UL, 0x1c95d279UL, 0x4c890dc6UL, 0x02b48c48UL, 0x5bfea41bUL, 0x6b9fb0a4UL, 0xcf15a81cUL,
+ 0x05300ca2UL, 0x63df7188UL, 0xcb2fdeb9UL, 0xe9c9c60cUL, 0x53ffee0bUL, 0x174521e3UL, 0x352854b4UL, 0x3c29639fUL,
+ 0x29e741eeUL, 0x7c2d1d6eUL, 0x86520450UL, 0xf385661eUL, 0xc60134f3UL, 0x952ca230UL, 0x5008a731UL, 0x130f9360UL,
+ 0x1784f973UL, 0x599826a1UL, 0x445c64ecUL, 0xa977c852UL, 0xa633ffcdUL, 0x41172ba0UL, 0xa2d9ba7cUL, 0x6f038021UL,
+ 0x089cd950UL, 0x61483fcbUL, 0x65d76bc2UL, 0xabf6a364UL, 0x76263480UL, 0x7b5ea725UL, 0xfcd1e6e4UL, 0xe610c720UL,
+ 0x80b6f0cdUL, 0x3b4d8417UL, 0x4df8ee31UL, 0xe424087eUL, 0xeb49cb2cUL, 0xae3b6a84UL, 0x8878f78fUL, 0xf6605deeUL,
+ 0x7356f77aUL, 0xdb5cdd2fUL, 0xc13116a1UL, 0x436ff630UL, 0x54ecfab3UL, 0xfad77f15UL, 0xcc7985efUL, 0x58de52d1UL,
+ 0x5efd2fdbUL, 0x19ce328fUL, 0x7af96a30UL, 0xf83ef002UL, 0xd59a3199UL, 0x0ffa42c2UL, 0xb0ebe3a7UL, 0x06498ec6UL,
+ 0x0c23dab8UL, 0x28308280UL, 0xc8f3dedcUL, 0x71b15fd3UL, 0xc81b8a08UL, 0x60c5c0beUL, 0xe8c9a361UL, 0x4df5a8bcUL,
+ 0xfaef2fc7UL, 0x992e8222UL, 0xb470c582UL, 0x894ed9d8UL, 0xbc341c8bUL, 0xe6161e30UL, 0x79e93b27UL, 0xa6eaffb0UL,
+ 0xc6b8d961UL, 0x6948b200UL, 0x3fceffb7UL, 0x3b28dc08UL, 0x5af6da43UL, 0x9897e1f7UL, 0x2fb71976UL, 0xa49b1c8fUL,
+ 0xa03786dcUL, 0xb1d3a716UL, 0xb793c39fUL, 0xeb6e13a7UL, 0x3ec6bcc6UL, 0x4237511aUL, 0xbc2868efUL, 0xd6650352UL,
+ 0xab776a2dUL, 0x4bed2735UL, 0x16d21f82UL, 0x2e6e5c09UL, 0xfbf292dbUL, 0xcb29ea5eUL, 0xf5925814UL, 0x7f4f5891UL,
+ 0x7b698354UL, 0xcca86726UL, 0x48601985UL, 0xeaac4b8cUL, 0xd4603883UL, 0xf9e0230dUL, 0x8a7e386cUL, 0x49d2e60aUL,
+ 0x0c6084b2UL, 0x1d7335d8UL, 0x47c6b1dcUL, 0xea564cacUL, 0xb381bd3eUL, 0xb0ab0e23UL, 0x87bc3864UL, 0xfab1b5f0UL,
+ 0xb3a25e8fUL, 0x424618fcUL, 0x7a6b030aUL, 0xbd89b04fUL, 0x89a59d64UL, 0x5e4145a3UL, 0x2383035cUL, 0xb93b5d3eUL,
+ 0x7295d743UL, 0x7cd06d7eUL, 0x1edfdf06UL, 0xefc46c6cUL, 0x39a56071UL, 0x70bebf73UL, 0x05768783UL, 0xf1ec2345UL};
const uint32_t s3[] PROGMEM = {
-0x40c2ef8dUL, 0x9f5dfa25UL, 0xbf3d90ebUL, 0x07c910e8UL, 0xff7f6047UL, 0x4be49f36UL, 0x44c61f8cUL, 0x90caceaeUL,
-0xbff9b1beUL, 0xeacafbeeUL, 0x5019cfe8UL, 0xae07df51UL, 0x06880e92UL, 0x4805adf0UL, 0x838d3ce1UL, 0xd5107092UL,
-0x9f7d1011UL, 0xb97d6407UL, 0xd4e4e3b2UL, 0x5e284f3dUL, 0x20a8afb9UL, 0xe082defaUL, 0x8b2667a0UL, 0x2e797282UL,
-0xc0b23f55UL, 0x2be29a48UL, 0x9497efd4UL, 0xbc3f5e12UL, 0xeefcff21UL, 0xfd1b5b82UL, 0xedc55592UL, 0x40a25712UL,
-0x02831a4eUL, 0xff7fe0baUL, 0xe7468252UL, 0x0e14578eUL, 0xbff77333UL, 0x88819f8cUL, 0xe84efca6UL, 0xa5b582c9UL,
-0xb71dc0a8UL, 0x64c29f57UL, 0x314f0967UL, 0x5f3fbdf2UL, 0xc1f7ff40UL, 0xfc8db71fUL, 0xc1d26b8eUL, 0x9be57b43UL,
-0xbf3db099UL, 0x4bc6dbb5UL, 0xe6c08d63UL, 0x999d8155UL, 0x1cc897a1UL, 0x6e2d014aUL, 0x284a88c5UL, 0x716fc3ccUL,
-0x13c243b8UL, 0xf143076cUL, 0x3c890983UL, 0x5fdded0fUL, 0x50e87f2fUL, 0x7e7fc0d7UL, 0xbf7f5002UL, 0x049afb5aUL,
-0xd0d247a7UL, 0x2e195116UL, 0x3ebf70afUL, 0x8013c358UL, 0x2e30985fUL, 0xc4c37c72UL, 0x02b40f0aUL, 0x82ef7f0fUL,
-0xadfd968cUL, 0xae2a2c5dUL, 0x499ae98eUL, 0xb888da50UL, 0xa0f42784UL, 0x9057ac1eUL, 0x49b46f79UL, 0x15dc5282UL,
-0x9b7dbdefUL, 0x7d5972a6UL, 0xd840a8adUL, 0x0445f545UL, 0x03745dfaUL, 0x05c33ee8UL, 0x1a75914fUL, 0xc2695692UL,
-0x41e9ef23UL, 0x2ef103a9UL, 0xf20d2760UL, 0xb6e47602UL, 0x7465fd94UL, 0xb2857992UL, 0xcbdb7682UL, 0x76817702UL,
-0x8d91aff8UL, 0x9ef7484eUL, 0xdf6d618fUL, 0x0e849de2UL, 0x837d2f84UL, 0xc8e50c34UL, 0x82b6bb96UL, 0x48b1b493UL,
-0xab3c30efUL, 0x28af4f98UL, 0x9baf9f77UL, 0x0d56dc92UL, 0x201e4d22UL, 0x88aa3784UL, 0x96dc297dUL, 0xdcd35627UL,
-0xee7c908bUL, 0x40d21fb5UL, 0xe37cc0e7UL, 0xa1b466e5UL, 0x5e61e9c3UL, 0x9d20f83cUL, 0xe3d19460UL, 0x41a39ccdUL,
-0x0e46765cUL, 0x3b98ea00UL, 0x8178d6d4UL, 0x2c5747fdUL, 0xd9ed6cf7UL, 0x9c22a8bdUL, 0xaaad7d12UL, 0x4e078a43UL,
-0x90c0971fUL, 0x8adb1b08UL, 0xbe7ea093UL, 0x15ca38b9UL, 0xff3cb097UL, 0xf8c0c23dUL, 0xecb21a8dUL, 0x510e3864UL,
-0xfb7bcc68UL, 0x88270fd9UL, 0x81014912UL, 0xd4ffe55dUL, 0x6af87eddUL, 0x14e2a276UL, 0x6803a4b9UL, 0x8f955d92UL,
-0xfaff394bUL, 0xe9ae39baUL, 0x0bd3ffa4UL, 0x3b93f7faUL, 0x2386496dUL, 0xfabc3c19UL, 0x45756227UL, 0x7af45c82UL,
-0xa08bbd61UL, 0xd1421ed1UL, 0xf404adceUL, 0x92a37e12UL, 0xb78d4210UL, 0x72a97282UL, 0xa8c47092UL, 0x0be57d12UL,
-0xc8a15b28UL, 0x4ff4623cUL, 0xa5eac035UL, 0x31d205e8UL, 0xfb298942UL, 0x82dffcb4UL, 0x536ab64fUL, 0x5bc17d0eUL,
-0xab1f081fUL, 0xae188610UL, 0x6d08fdfcUL, 0x8928fff9UL, 0x11cc4b69UL, 0xae5c6a23UL, 0x4dcade12UL, 0xc58c3f2cUL,
-0xfe2dd0d2UL, 0x9658eff8UL, 0xda52cfe4UL, 0x675b1595UL, 0x8c484a49UL, 0x0ca8b6b9UL, 0xbc828f5cUL, 0x456bd389UL,
-0x3794603aUL, 0xa9c900ecUL, 0x53527144UL, 0x494b870aUL, 0x40bc73d7UL, 0x1c67347cUL, 0xf67e7102UL, 0x3655eb4fUL,
-0xff2fd0a2UL, 0xc460bfd2UL, 0xc0033fd4UL, 0x6defb450UL, 0xd18c4707UL, 0x88186e00UL, 0x553fe5a2UL, 0xbcd4e6b9UL,
-0x168004a2UL, 0x33385797UL, 0x677d20d7UL, 0x3d8f0fdeUL, 0x337bf872UL, 0x334fccabUL, 0x5dc58876UL, 0xb0a6007bUL,
-0x01007b94UL, 0xd2750057UL, 0xf888bbf9UL, 0x9e014289UL, 0xffa56442UL, 0xe0026385UL, 0x2bd9db72UL, 0x691b97eeUL,
-0xde2fa26eUL, 0x2bae085fUL, 0x6d617aafUL, 0x6787c9e5UL, 0xd2eb1fcfUL, 0xc2c8ef61UL, 0x7125acf1UL, 0xc23982ccUL,
-0xb84c2167UL, 0xd183e5b1UL, 0x623edcb7UL, 0xcebd107fUL, 0x385c0af9UL, 0x3d44f00fUL, 0xc66d6e60UL, 0x493a5460UL,
-0x48c12757UL, 0x1d8ae92bUL, 0x3817b48aUL, 0x24bee120UL, 0x0fda96afUL, 0x25844568UL, 0xe53b8399UL, 0x7d450d60UL,
-0x50932f28UL, 0x62b33483UL, 0x20111dd9UL, 0xa08d6d2bUL, 0x311e2b64UL, 0x005a309cUL, 0x88e6bc52UL, 0x8a58031bUL,
-0xd5efbaf7UL, 0x9ced4241UL, 0x115c31a4UL, 0xc53e3283UL, 0x3646efdfUL, 0x01c533a1UL, 0x1c53d3e9UL, 0x833735eeUL};
+ 0x40c2ef8dUL, 0x9f5dfa25UL, 0xbf3d90ebUL, 0x07c910e8UL, 0xff7f6047UL, 0x4be49f36UL, 0x44c61f8cUL, 0x90caceaeUL,
+ 0xbff9b1beUL, 0xeacafbeeUL, 0x5019cfe8UL, 0xae07df51UL, 0x06880e92UL, 0x4805adf0UL, 0x838d3ce1UL, 0xd5107092UL,
+ 0x9f7d1011UL, 0xb97d6407UL, 0xd4e4e3b2UL, 0x5e284f3dUL, 0x20a8afb9UL, 0xe082defaUL, 0x8b2667a0UL, 0x2e797282UL,
+ 0xc0b23f55UL, 0x2be29a48UL, 0x9497efd4UL, 0xbc3f5e12UL, 0xeefcff21UL, 0xfd1b5b82UL, 0xedc55592UL, 0x40a25712UL,
+ 0x02831a4eUL, 0xff7fe0baUL, 0xe7468252UL, 0x0e14578eUL, 0xbff77333UL, 0x88819f8cUL, 0xe84efca6UL, 0xa5b582c9UL,
+ 0xb71dc0a8UL, 0x64c29f57UL, 0x314f0967UL, 0x5f3fbdf2UL, 0xc1f7ff40UL, 0xfc8db71fUL, 0xc1d26b8eUL, 0x9be57b43UL,
+ 0xbf3db099UL, 0x4bc6dbb5UL, 0xe6c08d63UL, 0x999d8155UL, 0x1cc897a1UL, 0x6e2d014aUL, 0x284a88c5UL, 0x716fc3ccUL,
+ 0x13c243b8UL, 0xf143076cUL, 0x3c890983UL, 0x5fdded0fUL, 0x50e87f2fUL, 0x7e7fc0d7UL, 0xbf7f5002UL, 0x049afb5aUL,
+ 0xd0d247a7UL, 0x2e195116UL, 0x3ebf70afUL, 0x8013c358UL, 0x2e30985fUL, 0xc4c37c72UL, 0x02b40f0aUL, 0x82ef7f0fUL,
+ 0xadfd968cUL, 0xae2a2c5dUL, 0x499ae98eUL, 0xb888da50UL, 0xa0f42784UL, 0x9057ac1eUL, 0x49b46f79UL, 0x15dc5282UL,
+ 0x9b7dbdefUL, 0x7d5972a6UL, 0xd840a8adUL, 0x0445f545UL, 0x03745dfaUL, 0x05c33ee8UL, 0x1a75914fUL, 0xc2695692UL,
+ 0x41e9ef23UL, 0x2ef103a9UL, 0xf20d2760UL, 0xb6e47602UL, 0x7465fd94UL, 0xb2857992UL, 0xcbdb7682UL, 0x76817702UL,
+ 0x8d91aff8UL, 0x9ef7484eUL, 0xdf6d618fUL, 0x0e849de2UL, 0x837d2f84UL, 0xc8e50c34UL, 0x82b6bb96UL, 0x48b1b493UL,
+ 0xab3c30efUL, 0x28af4f98UL, 0x9baf9f77UL, 0x0d56dc92UL, 0x201e4d22UL, 0x88aa3784UL, 0x96dc297dUL, 0xdcd35627UL,
+ 0xee7c908bUL, 0x40d21fb5UL, 0xe37cc0e7UL, 0xa1b466e5UL, 0x5e61e9c3UL, 0x9d20f83cUL, 0xe3d19460UL, 0x41a39ccdUL,
+ 0x0e46765cUL, 0x3b98ea00UL, 0x8178d6d4UL, 0x2c5747fdUL, 0xd9ed6cf7UL, 0x9c22a8bdUL, 0xaaad7d12UL, 0x4e078a43UL,
+ 0x90c0971fUL, 0x8adb1b08UL, 0xbe7ea093UL, 0x15ca38b9UL, 0xff3cb097UL, 0xf8c0c23dUL, 0xecb21a8dUL, 0x510e3864UL,
+ 0xfb7bcc68UL, 0x88270fd9UL, 0x81014912UL, 0xd4ffe55dUL, 0x6af87eddUL, 0x14e2a276UL, 0x6803a4b9UL, 0x8f955d92UL,
+ 0xfaff394bUL, 0xe9ae39baUL, 0x0bd3ffa4UL, 0x3b93f7faUL, 0x2386496dUL, 0xfabc3c19UL, 0x45756227UL, 0x7af45c82UL,
+ 0xa08bbd61UL, 0xd1421ed1UL, 0xf404adceUL, 0x92a37e12UL, 0xb78d4210UL, 0x72a97282UL, 0xa8c47092UL, 0x0be57d12UL,
+ 0xc8a15b28UL, 0x4ff4623cUL, 0xa5eac035UL, 0x31d205e8UL, 0xfb298942UL, 0x82dffcb4UL, 0x536ab64fUL, 0x5bc17d0eUL,
+ 0xab1f081fUL, 0xae188610UL, 0x6d08fdfcUL, 0x8928fff9UL, 0x11cc4b69UL, 0xae5c6a23UL, 0x4dcade12UL, 0xc58c3f2cUL,
+ 0xfe2dd0d2UL, 0x9658eff8UL, 0xda52cfe4UL, 0x675b1595UL, 0x8c484a49UL, 0x0ca8b6b9UL, 0xbc828f5cUL, 0x456bd389UL,
+ 0x3794603aUL, 0xa9c900ecUL, 0x53527144UL, 0x494b870aUL, 0x40bc73d7UL, 0x1c67347cUL, 0xf67e7102UL, 0x3655eb4fUL,
+ 0xff2fd0a2UL, 0xc460bfd2UL, 0xc0033fd4UL, 0x6defb450UL, 0xd18c4707UL, 0x88186e00UL, 0x553fe5a2UL, 0xbcd4e6b9UL,
+ 0x168004a2UL, 0x33385797UL, 0x677d20d7UL, 0x3d8f0fdeUL, 0x337bf872UL, 0x334fccabUL, 0x5dc58876UL, 0xb0a6007bUL,
+ 0x01007b94UL, 0xd2750057UL, 0xf888bbf9UL, 0x9e014289UL, 0xffa56442UL, 0xe0026385UL, 0x2bd9db72UL, 0x691b97eeUL,
+ 0xde2fa26eUL, 0x2bae085fUL, 0x6d617aafUL, 0x6787c9e5UL, 0xd2eb1fcfUL, 0xc2c8ef61UL, 0x7125acf1UL, 0xc23982ccUL,
+ 0xb84c2167UL, 0xd183e5b1UL, 0x623edcb7UL, 0xcebd107fUL, 0x385c0af9UL, 0x3d44f00fUL, 0xc66d6e60UL, 0x493a5460UL,
+ 0x48c12757UL, 0x1d8ae92bUL, 0x3817b48aUL, 0x24bee120UL, 0x0fda96afUL, 0x25844568UL, 0xe53b8399UL, 0x7d450d60UL,
+ 0x50932f28UL, 0x62b33483UL, 0x20111dd9UL, 0xa08d6d2bUL, 0x311e2b64UL, 0x005a309cUL, 0x88e6bc52UL, 0x8a58031bUL,
+ 0xd5efbaf7UL, 0x9ced4241UL, 0x115c31a4UL, 0xc53e3283UL, 0x3646efdfUL, 0x01c533a1UL, 0x1c53d3e9UL, 0x833735eeUL};
const uint32_t s4[] PROGMEM = {
-0x2004b39dUL, 0xdee9b61fUL, 0xef7bbea7UL, 0x98a273d2UL, 0xdb7b4f4aUL, 0x578cad64UL, 0x43045185UL, 0xd10e02faUL,
-0xff7a287eUL, 0x63b60fe6UL, 0xa1355f09UL, 0x20f1eb79UL, 0x439d05fdUL, 0xb1b79764UL, 0x631f64f3UL, 0xdf4a1e24UL,
-0x5f7f1428UL, 0xcdb8a24fUL, 0x400043c9UL, 0x2022c30cUL, 0x300bd3fdUL, 0x4f37a5c0UL, 0xd9002d1dUL, 0x157b1424UL,
-0x1a114deeUL, 0x6751ca0fUL, 0x4c90ff71UL, 0xfe5f192dUL, 0x5f64051aUL, 0xfefe130cUL, 0xca081b08UL, 0x21011705UL,
-0x00015380UL, 0xfe5e3ee8UL, 0xf8f49aacUL, 0x0127e77fUL, 0x5feeb8d2UL, 0x6142df06UL, 0x8a9b9ebbUL, 0x25ea9372UL,
-0xdfff84ceUL, 0x018871f5UL, 0x044bd63dUL, 0x3b266fa2UL, 0x0084d47eUL, 0xe6eb7e54UL, 0xa04c6d44UL, 0xf5d6f36cUL,
-0xdfab4926UL, 0xf5c7a0aeUL, 0xc18c3336UL, 0x937e3f50UL, 0x612077d3UL, 0xe138b611UL, 0x030e5072UL, 0xbbb20ef8UL,
-0x2e50e0abUL, 0xde778decUL, 0x811e9757UL, 0x46674fe1UL, 0x005433c9UL, 0x8f312069UL, 0x99bb1d08UL, 0xa504c3ffUL,
-0x0518354dUL, 0xe35c3d7fUL, 0xc666c8a6UL, 0xa9cc5b5dUL, 0xea6fecdaUL, 0x916f929fUL, 0x2f22469fUL, 0x7d469139UL,
-0x8e6dbfa5UL, 0x4fc44311UL, 0x02839543UL, 0xeb4e21d0UL, 0xb8832002UL, 0x0c18b63fUL, 0x1e93f818UL, 0xe6581628UL,
-0x3e6e4826UL, 0x708ad78bUL, 0xc1e47774UL, 0x7ce006b5UL, 0x250a2df3UL, 0x028b0979UL, 0x81bbeae4UL, 0x233b1228UL,
-0x38adde69UL, 0x16ca7415UL, 0x621b87dfUL, 0xb7401c21UL, 0xf99e1aa5UL, 0x7b371400UL, 0xc88a1e04UL, 0x03401109UL,
-0xd2e459bdUL, 0xd556d1e3UL, 0xd576e84fUL, 0x40a3912fUL, 0xdee87b55UL, 0xa7e4ea00UL, 0xecc2e50cUL, 0xa6bbb44dUL,
-0xffbd56e7UL, 0xac6933ddUL, 0x35b017ecUL, 0x27235706UL, 0xb0c8af99UL, 0x91c3c856UL, 0x1c81656bUL, 0x1961145eUL,
-0x75cb856eUL, 0x02c007beUL, 0x775532c2UL, 0xecf43f89UL, 0x2dc9bf5bUL, 0x253becd0UL, 0xb71a80b7UL, 0x243b6d8dUL,
-0xef63c720UL, 0xfca566c3UL, 0x8028389cUL, 0x0532ce0aUL, 0x8a54c9aaUL, 0xc7d7a1ecUL, 0x32fa1a04UL, 0x5a62161dUL,
-0x2c900167UL, 0x547a759bUL, 0xf777d431UL, 0x31b02691UL, 0xdb6fcc36UL, 0x468b0bc7UL, 0x486ae6d9UL, 0x795ae556UL,
-0xeb4c6a02UL, 0xff7e4352UL, 0xb4768f2fUL, 0xa580f90dUL, 0xe3cd7486UL, 0xeb04daedUL, 0x04bea917UL, 0xdff4182cUL,
-0x9d7f74b7UL, 0xb4f72aabUL, 0x204dc3efUL, 0x7c6b092eUL, 0x54a24117UL, 0x35a0b6e5UL, 0xf6423d21UL, 0x267c1c2cUL,
-0x0ff5c261UL, 0xf9da5265UL, 0xf831c2d2UL, 0x690f1325UL, 0xa27f16d8UL, 0xc8f21804UL, 0xa6961a00UL, 0xab26150dUL,
-0x215c3163UL, 0xec720a5eUL, 0xfdfeba49UL, 0xd9087918UL, 0x86bd0d8dUL, 0xa7701131UL, 0x0c649b3eUL, 0xd7103eccUL,
-0xb6d3cad5UL, 0x88c3ae0cUL, 0xe10130f7UL, 0xff8a726cUL, 0xa1e2ea71UL, 0x6ef39a1fUL, 0x2fd1cbcfUL, 0x1784dec1UL,
-0x6bbe07acUL, 0xd8a144cbUL, 0x560f9b8bUL, 0xc3883901UL, 0xca2fc5b1UL, 0xcd31beb4UL, 0x062878d8UL, 0xe2a4a312UL,
-0x32e57d6fUL, 0xb67efd58UL, 0x00e91ed0UL, 0xc2ffad24UL, 0xc50f99f4UL, 0xc5aa1197UL, 0x957b1d00UL, 0xd2e7e582UL,
-0xf6739810UL, 0x96306100UL, 0x21952dc3UL, 0xff21a1adUL, 0x15849029UL, 0x7f97bb7fUL, 0xdbb39eafUL, 0x2aedc929UL,
-0x65a4e25cUL, 0x2cf330a7UL, 0xe83faad0UL, 0x91c05c8aUL, 0xe72c9ed4UL, 0xa954e40cUL, 0x86cd0ad6UL, 0x19195f01UL,
-0x03910777UL, 0xf63aa0deUL, 0x5e56a878UL, 0xdf56e3deUL, 0xbe5cf021UL, 0x87e3758bUL, 0x5106c5b3UL, 0xefc3a5b8UL,
-0xd2b6eed8UL, 0x77be23e5UL, 0x294515c2UL, 0xdfef692fUL, 0xfb7ae6afUL, 0xb2c470f4UL, 0x5bebe0f3UL, 0x7698ccd6UL,
-0x0c46e439UL, 0x3885da1fUL, 0x2f838719UL, 0x677300caUL, 0xf84491a9UL, 0x9e296b29UL, 0x95c22f49UL, 0xabbe6692UL,
-0x696e67b5UL, 0xdaddd39bUL, 0x2f057edfUL, 0x1c7025dbUL, 0xee515e1bUL, 0xe62453f6UL, 0x6ce3fc6aUL, 0x04cc1603UL,
-0x3e214486UL, 0xd059dcb7UL, 0x1f296579UL, 0x43fdd6ccUL, 0x79398241UL, 0xf6cd2b93UL, 0x4dc357b6UL, 0x82d2df4eUL,
-0x0c29e57aUL, 0x6b53b93cUL, 0xfe201e85UL, 0x7e553398UL, 0xb0f0ec13UL, 0x72b3ffd3UL, 0xc1c5853fUL, 0xd27eef0aUL};
+ 0x2004b39dUL, 0xdee9b61fUL, 0xef7bbea7UL, 0x98a273d2UL, 0xdb7b4f4aUL, 0x578cad64UL, 0x43045185UL, 0xd10e02faUL,
+ 0xff7a287eUL, 0x63b60fe6UL, 0xa1355f09UL, 0x20f1eb79UL, 0x439d05fdUL, 0xb1b79764UL, 0x631f64f3UL, 0xdf4a1e24UL,
+ 0x5f7f1428UL, 0xcdb8a24fUL, 0x400043c9UL, 0x2022c30cUL, 0x300bd3fdUL, 0x4f37a5c0UL, 0xd9002d1dUL, 0x157b1424UL,
+ 0x1a114deeUL, 0x6751ca0fUL, 0x4c90ff71UL, 0xfe5f192dUL, 0x5f64051aUL, 0xfefe130cUL, 0xca081b08UL, 0x21011705UL,
+ 0x00015380UL, 0xfe5e3ee8UL, 0xf8f49aacUL, 0x0127e77fUL, 0x5feeb8d2UL, 0x6142df06UL, 0x8a9b9ebbUL, 0x25ea9372UL,
+ 0xdfff84ceUL, 0x018871f5UL, 0x044bd63dUL, 0x3b266fa2UL, 0x0084d47eUL, 0xe6eb7e54UL, 0xa04c6d44UL, 0xf5d6f36cUL,
+ 0xdfab4926UL, 0xf5c7a0aeUL, 0xc18c3336UL, 0x937e3f50UL, 0x612077d3UL, 0xe138b611UL, 0x030e5072UL, 0xbbb20ef8UL,
+ 0x2e50e0abUL, 0xde778decUL, 0x811e9757UL, 0x46674fe1UL, 0x005433c9UL, 0x8f312069UL, 0x99bb1d08UL, 0xa504c3ffUL,
+ 0x0518354dUL, 0xe35c3d7fUL, 0xc666c8a6UL, 0xa9cc5b5dUL, 0xea6fecdaUL, 0x916f929fUL, 0x2f22469fUL, 0x7d469139UL,
+ 0x8e6dbfa5UL, 0x4fc44311UL, 0x02839543UL, 0xeb4e21d0UL, 0xb8832002UL, 0x0c18b63fUL, 0x1e93f818UL, 0xe6581628UL,
+ 0x3e6e4826UL, 0x708ad78bUL, 0xc1e47774UL, 0x7ce006b5UL, 0x250a2df3UL, 0x028b0979UL, 0x81bbeae4UL, 0x233b1228UL,
+ 0x38adde69UL, 0x16ca7415UL, 0x621b87dfUL, 0xb7401c21UL, 0xf99e1aa5UL, 0x7b371400UL, 0xc88a1e04UL, 0x03401109UL,
+ 0xd2e459bdUL, 0xd556d1e3UL, 0xd576e84fUL, 0x40a3912fUL, 0xdee87b55UL, 0xa7e4ea00UL, 0xecc2e50cUL, 0xa6bbb44dUL,
+ 0xffbd56e7UL, 0xac6933ddUL, 0x35b017ecUL, 0x27235706UL, 0xb0c8af99UL, 0x91c3c856UL, 0x1c81656bUL, 0x1961145eUL,
+ 0x75cb856eUL, 0x02c007beUL, 0x775532c2UL, 0xecf43f89UL, 0x2dc9bf5bUL, 0x253becd0UL, 0xb71a80b7UL, 0x243b6d8dUL,
+ 0xef63c720UL, 0xfca566c3UL, 0x8028389cUL, 0x0532ce0aUL, 0x8a54c9aaUL, 0xc7d7a1ecUL, 0x32fa1a04UL, 0x5a62161dUL,
+ 0x2c900167UL, 0x547a759bUL, 0xf777d431UL, 0x31b02691UL, 0xdb6fcc36UL, 0x468b0bc7UL, 0x486ae6d9UL, 0x795ae556UL,
+ 0xeb4c6a02UL, 0xff7e4352UL, 0xb4768f2fUL, 0xa580f90dUL, 0xe3cd7486UL, 0xeb04daedUL, 0x04bea917UL, 0xdff4182cUL,
+ 0x9d7f74b7UL, 0xb4f72aabUL, 0x204dc3efUL, 0x7c6b092eUL, 0x54a24117UL, 0x35a0b6e5UL, 0xf6423d21UL, 0x267c1c2cUL,
+ 0x0ff5c261UL, 0xf9da5265UL, 0xf831c2d2UL, 0x690f1325UL, 0xa27f16d8UL, 0xc8f21804UL, 0xa6961a00UL, 0xab26150dUL,
+ 0x215c3163UL, 0xec720a5eUL, 0xfdfeba49UL, 0xd9087918UL, 0x86bd0d8dUL, 0xa7701131UL, 0x0c649b3eUL, 0xd7103eccUL,
+ 0xb6d3cad5UL, 0x88c3ae0cUL, 0xe10130f7UL, 0xff8a726cUL, 0xa1e2ea71UL, 0x6ef39a1fUL, 0x2fd1cbcfUL, 0x1784dec1UL,
+ 0x6bbe07acUL, 0xd8a144cbUL, 0x560f9b8bUL, 0xc3883901UL, 0xca2fc5b1UL, 0xcd31beb4UL, 0x062878d8UL, 0xe2a4a312UL,
+ 0x32e57d6fUL, 0xb67efd58UL, 0x00e91ed0UL, 0xc2ffad24UL, 0xc50f99f4UL, 0xc5aa1197UL, 0x957b1d00UL, 0xd2e7e582UL,
+ 0xf6739810UL, 0x96306100UL, 0x21952dc3UL, 0xff21a1adUL, 0x15849029UL, 0x7f97bb7fUL, 0xdbb39eafUL, 0x2aedc929UL,
+ 0x65a4e25cUL, 0x2cf330a7UL, 0xe83faad0UL, 0x91c05c8aUL, 0xe72c9ed4UL, 0xa954e40cUL, 0x86cd0ad6UL, 0x19195f01UL,
+ 0x03910777UL, 0xf63aa0deUL, 0x5e56a878UL, 0xdf56e3deUL, 0xbe5cf021UL, 0x87e3758bUL, 0x5106c5b3UL, 0xefc3a5b8UL,
+ 0xd2b6eed8UL, 0x77be23e5UL, 0x294515c2UL, 0xdfef692fUL, 0xfb7ae6afUL, 0xb2c470f4UL, 0x5bebe0f3UL, 0x7698ccd6UL,
+ 0x0c46e439UL, 0x3885da1fUL, 0x2f838719UL, 0x677300caUL, 0xf84491a9UL, 0x9e296b29UL, 0x95c22f49UL, 0xabbe6692UL,
+ 0x696e67b5UL, 0xdaddd39bUL, 0x2f057edfUL, 0x1c7025dbUL, 0xee515e1bUL, 0xe62453f6UL, 0x6ce3fc6aUL, 0x04cc1603UL,
+ 0x3e214486UL, 0xd059dcb7UL, 0x1f296579UL, 0x43fdd6ccUL, 0x79398241UL, 0xf6cd2b93UL, 0x4dc357b6UL, 0x82d2df4eUL,
+ 0x0c29e57aUL, 0x6b53b93cUL, 0xfe201e85UL, 0x7e553398UL, 0xb0f0ec13UL, 0x72b3ffd3UL, 0xc1c5853fUL, 0xd27eef0aUL};
#endif
#ifdef BIG_ENDIAN
const uint32_t s5[] PROGMEM = {
-0x7ec90c04UL, 0x2c6e74b9UL, 0x9b0e66dfUL, 0xa6337911UL, 0xb86a7fffUL, 0x1dd358f5UL, 0x44dd9d44UL, 0x1731167fUL,
-0x08fbf1faUL, 0xe7f511ccUL, 0xd2051b00UL, 0x735aba00UL, 0x2ab722d8UL, 0x386381cbUL, 0xacf6243aUL, 0x69befd7aUL,
-0xe6a2e77fUL, 0xf0c720cdUL, 0xc4494816UL, 0xccf5c180UL, 0x38851640UL, 0x15b0a848UL, 0xe68b18cbUL, 0x4caadeffUL,
-0x5f480a01UL, 0x0412b2aaUL, 0x259814fcUL, 0x41d0efe2UL, 0x4e40b48dUL, 0x248eb6fbUL, 0x8dba1cfeUL, 0x41a99b02UL,
-0x1a550a04UL, 0xba8f65cbUL, 0x7251f4e7UL, 0x95a51725UL, 0xc106ecd7UL, 0x97a5980aUL, 0xc539b9aaUL, 0x4d79fe6aUL,
-0xf2f3f763UL, 0x68af8040UL, 0xed0c9e56UL, 0x11b4958bUL, 0xe1eb5a88UL, 0x8709e6b0UL, 0xd7e07156UL, 0x4e29fea7UL,
-0x6366e52dUL, 0x02d1c000UL, 0xc4ac8e05UL, 0x9377f571UL, 0x0c05372aUL, 0x578535f2UL, 0x2261be02UL, 0xd642a0c9UL,
-0xdf13a280UL, 0x74b55bd2UL, 0x682199c0UL, 0xd421e5ecUL, 0x53fb3ce8UL, 0xc8adedb3UL, 0x28a87fc9UL, 0x3d959981UL,
-0x5c1ff900UL, 0xfe38d399UL, 0x0c4eff0bUL, 0x062407eaUL, 0xaa2f4fb1UL, 0x4fb96976UL, 0x90c79505UL, 0xb0a8a774UL,
-0xef55a1ffUL, 0xe59ca2c2UL, 0xa6b62d27UL, 0xe66a4263UL, 0xdf65001fUL, 0x0ec50966UL, 0xdfdd55bcUL, 0x29de0655UL,
-0x911e739aUL, 0x17af8975UL, 0x32c7911cUL, 0x89f89468UL, 0x0d01e980UL, 0x524755f4UL, 0x03b63cc9UL, 0x0cc844b2UL,
-0xbcf3f0aaUL, 0x87ac36e9UL, 0xe53a7426UL, 0x01b3d82bUL, 0x1a9e7449UL, 0x64ee2d7eUL, 0xcddbb1daUL, 0x01c94910UL,
-0xb868bf80UL, 0x0d26f3fdUL, 0x9342ede7UL, 0x04a5c284UL, 0x636737b6UL, 0x50f5b616UL, 0xf24766e3UL, 0x8eca36c1UL,
-0x136e05dbUL, 0xfef18391UL, 0xfb887a37UL, 0xd6e7f7d4UL, 0xc7fb7dc9UL, 0x3063fcdfUL, 0xb6f589deUL, 0xec2941daUL,
-0x26e46695UL, 0xb7566419UL, 0xf654efc5UL, 0xd08d58b7UL, 0x48925401UL, 0xc1bacb7fUL, 0xe5ff550fUL, 0xb6083049UL,
-0x5bb5d0e8UL, 0x87d72e5aUL, 0xab6a6ee1UL, 0x223a66ceUL, 0xc62bf3cdUL, 0x9e0885f9UL, 0x68cb3e47UL, 0x086c010fUL,
-0xa21de820UL, 0xd18b69deUL, 0xf3f65777UL, 0xfa02c3f6UL, 0x407edac3UL, 0xcbb3d550UL, 0x1793084dUL, 0xb0d70ebaUL,
-0x0ab378d5UL, 0xd951fb0cUL, 0xded7da56UL, 0x4124bbe4UL, 0x94ca0b56UL, 0x0f5755d1UL, 0xe0e1e56eUL, 0x6184b5beUL,
-0x580a249fUL, 0x94f74bc0UL, 0xe327888eUL, 0x9f7b5561UL, 0xc3dc0280UL, 0x05687715UL, 0x646c6bd7UL, 0x44904db3UL,
-0x66b4f0a3UL, 0xc0f1648aUL, 0x697ed5afUL, 0x49e92ff6UL, 0x309e374fUL, 0x2cb6356aUL, 0x85808573UL, 0x4991f840UL,
-0x76f0ae02UL, 0x083be84dUL, 0x28421c9aUL, 0x44489406UL, 0x736e4cb8UL, 0xc1092910UL, 0x8bc95fc6UL, 0x7d869cf4UL,
-0x134f616fUL, 0x2e77118dUL, 0xb31b2be1UL, 0xaa90b472UL, 0x3ca5d717UL, 0x7d161bbaUL, 0x9cad9010UL, 0xaf462ba2UL,
-0x9fe459d2UL, 0x45d34559UL, 0xd9f2da13UL, 0xdbc65487UL, 0xf3e4f94eUL, 0x176d486fUL, 0x097c13eaUL, 0x631da5c7UL,
-0x445f7382UL, 0x175683f4UL, 0xcdc66a97UL, 0x70be0288UL, 0xb3cdcf72UL, 0x6e5dd2f3UL, 0x20936079UL, 0x459b80a5UL,
-0xbe60e2dbUL, 0xa9c23101UL, 0xeba5315cUL, 0x224e42f2UL, 0x1c5c1572UL, 0xf6721b2cUL, 0x1ad2fff3UL, 0x8c25404eUL,
-0x324ed72fUL, 0x4067b7fdUL, 0x0523138eUL, 0x5ca3bc78UL, 0xdc0fd66eUL, 0x75922283UL, 0x784d6b17UL, 0x58ebb16eUL,
-0x44094f85UL, 0x3f481d87UL, 0xfcfeae7bUL, 0x77b5ff76UL, 0x8c2302bfUL, 0xaaf47556UL, 0x5f46b02aUL, 0x2b092801UL,
-0x3d38f5f7UL, 0x0ca81f36UL, 0x52af4a8aUL, 0x66d5e7c0UL, 0xdf3b0874UL, 0x95055110UL, 0x1b5ad7a8UL, 0xf61ed5adUL,
-0x6cf6e479UL, 0x20758184UL, 0xd0cefa65UL, 0x88f7be58UL, 0x4a046826UL, 0x0ff6f8f3UL, 0xa09c7f70UL, 0x5346aba0UL,
-0x5ce96c28UL, 0xe176eda3UL, 0x6bac307fUL, 0x376829d2UL, 0x85360fa9UL, 0x17e3fe2aUL, 0x24b79767UL, 0xf5a96b20UL,
-0xd6cd2595UL, 0x68ff1ebfUL, 0x7555442cUL, 0xf19f06beUL, 0xf9e0659aUL, 0xeeb9491dUL, 0x34010718UL, 0xbb30cab8UL,
-0xe822fe15UL, 0x88570983UL, 0x750e6249UL, 0xda627e55UL, 0x5e76ffa8UL, 0xb1534546UL, 0x6d47de08UL, 0xefe9e7d4UL};
-
+ 0x7ec90c04UL, 0x2c6e74b9UL, 0x9b0e66dfUL, 0xa6337911UL, 0xb86a7fffUL, 0x1dd358f5UL, 0x44dd9d44UL, 0x1731167fUL,
+ 0x08fbf1faUL, 0xe7f511ccUL, 0xd2051b00UL, 0x735aba00UL, 0x2ab722d8UL, 0x386381cbUL, 0xacf6243aUL, 0x69befd7aUL,
+ 0xe6a2e77fUL, 0xf0c720cdUL, 0xc4494816UL, 0xccf5c180UL, 0x38851640UL, 0x15b0a848UL, 0xe68b18cbUL, 0x4caadeffUL,
+ 0x5f480a01UL, 0x0412b2aaUL, 0x259814fcUL, 0x41d0efe2UL, 0x4e40b48dUL, 0x248eb6fbUL, 0x8dba1cfeUL, 0x41a99b02UL,
+ 0x1a550a04UL, 0xba8f65cbUL, 0x7251f4e7UL, 0x95a51725UL, 0xc106ecd7UL, 0x97a5980aUL, 0xc539b9aaUL, 0x4d79fe6aUL,
+ 0xf2f3f763UL, 0x68af8040UL, 0xed0c9e56UL, 0x11b4958bUL, 0xe1eb5a88UL, 0x8709e6b0UL, 0xd7e07156UL, 0x4e29fea7UL,
+ 0x6366e52dUL, 0x02d1c000UL, 0xc4ac8e05UL, 0x9377f571UL, 0x0c05372aUL, 0x578535f2UL, 0x2261be02UL, 0xd642a0c9UL,
+ 0xdf13a280UL, 0x74b55bd2UL, 0x682199c0UL, 0xd421e5ecUL, 0x53fb3ce8UL, 0xc8adedb3UL, 0x28a87fc9UL, 0x3d959981UL,
+ 0x5c1ff900UL, 0xfe38d399UL, 0x0c4eff0bUL, 0x062407eaUL, 0xaa2f4fb1UL, 0x4fb96976UL, 0x90c79505UL, 0xb0a8a774UL,
+ 0xef55a1ffUL, 0xe59ca2c2UL, 0xa6b62d27UL, 0xe66a4263UL, 0xdf65001fUL, 0x0ec50966UL, 0xdfdd55bcUL, 0x29de0655UL,
+ 0x911e739aUL, 0x17af8975UL, 0x32c7911cUL, 0x89f89468UL, 0x0d01e980UL, 0x524755f4UL, 0x03b63cc9UL, 0x0cc844b2UL,
+ 0xbcf3f0aaUL, 0x87ac36e9UL, 0xe53a7426UL, 0x01b3d82bUL, 0x1a9e7449UL, 0x64ee2d7eUL, 0xcddbb1daUL, 0x01c94910UL,
+ 0xb868bf80UL, 0x0d26f3fdUL, 0x9342ede7UL, 0x04a5c284UL, 0x636737b6UL, 0x50f5b616UL, 0xf24766e3UL, 0x8eca36c1UL,
+ 0x136e05dbUL, 0xfef18391UL, 0xfb887a37UL, 0xd6e7f7d4UL, 0xc7fb7dc9UL, 0x3063fcdfUL, 0xb6f589deUL, 0xec2941daUL,
+ 0x26e46695UL, 0xb7566419UL, 0xf654efc5UL, 0xd08d58b7UL, 0x48925401UL, 0xc1bacb7fUL, 0xe5ff550fUL, 0xb6083049UL,
+ 0x5bb5d0e8UL, 0x87d72e5aUL, 0xab6a6ee1UL, 0x223a66ceUL, 0xc62bf3cdUL, 0x9e0885f9UL, 0x68cb3e47UL, 0x086c010fUL,
+ 0xa21de820UL, 0xd18b69deUL, 0xf3f65777UL, 0xfa02c3f6UL, 0x407edac3UL, 0xcbb3d550UL, 0x1793084dUL, 0xb0d70ebaUL,
+ 0x0ab378d5UL, 0xd951fb0cUL, 0xded7da56UL, 0x4124bbe4UL, 0x94ca0b56UL, 0x0f5755d1UL, 0xe0e1e56eUL, 0x6184b5beUL,
+ 0x580a249fUL, 0x94f74bc0UL, 0xe327888eUL, 0x9f7b5561UL, 0xc3dc0280UL, 0x05687715UL, 0x646c6bd7UL, 0x44904db3UL,
+ 0x66b4f0a3UL, 0xc0f1648aUL, 0x697ed5afUL, 0x49e92ff6UL, 0x309e374fUL, 0x2cb6356aUL, 0x85808573UL, 0x4991f840UL,
+ 0x76f0ae02UL, 0x083be84dUL, 0x28421c9aUL, 0x44489406UL, 0x736e4cb8UL, 0xc1092910UL, 0x8bc95fc6UL, 0x7d869cf4UL,
+ 0x134f616fUL, 0x2e77118dUL, 0xb31b2be1UL, 0xaa90b472UL, 0x3ca5d717UL, 0x7d161bbaUL, 0x9cad9010UL, 0xaf462ba2UL,
+ 0x9fe459d2UL, 0x45d34559UL, 0xd9f2da13UL, 0xdbc65487UL, 0xf3e4f94eUL, 0x176d486fUL, 0x097c13eaUL, 0x631da5c7UL,
+ 0x445f7382UL, 0x175683f4UL, 0xcdc66a97UL, 0x70be0288UL, 0xb3cdcf72UL, 0x6e5dd2f3UL, 0x20936079UL, 0x459b80a5UL,
+ 0xbe60e2dbUL, 0xa9c23101UL, 0xeba5315cUL, 0x224e42f2UL, 0x1c5c1572UL, 0xf6721b2cUL, 0x1ad2fff3UL, 0x8c25404eUL,
+ 0x324ed72fUL, 0x4067b7fdUL, 0x0523138eUL, 0x5ca3bc78UL, 0xdc0fd66eUL, 0x75922283UL, 0x784d6b17UL, 0x58ebb16eUL,
+ 0x44094f85UL, 0x3f481d87UL, 0xfcfeae7bUL, 0x77b5ff76UL, 0x8c2302bfUL, 0xaaf47556UL, 0x5f46b02aUL, 0x2b092801UL,
+ 0x3d38f5f7UL, 0x0ca81f36UL, 0x52af4a8aUL, 0x66d5e7c0UL, 0xdf3b0874UL, 0x95055110UL, 0x1b5ad7a8UL, 0xf61ed5adUL,
+ 0x6cf6e479UL, 0x20758184UL, 0xd0cefa65UL, 0x88f7be58UL, 0x4a046826UL, 0x0ff6f8f3UL, 0xa09c7f70UL, 0x5346aba0UL,
+ 0x5ce96c28UL, 0xe176eda3UL, 0x6bac307fUL, 0x376829d2UL, 0x85360fa9UL, 0x17e3fe2aUL, 0x24b79767UL, 0xf5a96b20UL,
+ 0xd6cd2595UL, 0x68ff1ebfUL, 0x7555442cUL, 0xf19f06beUL, 0xf9e0659aUL, 0xeeb9491dUL, 0x34010718UL, 0xbb30cab8UL,
+ 0xe822fe15UL, 0x88570983UL, 0x750e6249UL, 0xda627e55UL, 0x5e76ffa8UL, 0xb1534546UL, 0x6d47de08UL, 0xefe9e7d4UL};
const uint32_t s6[] PROGMEM = {
-0xf6fa8f9dUL, 0x2cac6ce1UL, 0x4ca34867UL, 0xe2337f7cUL, 0x95db08e7UL, 0x016843b4UL, 0xeced5cbcUL, 0x325553acUL,
-0xbf9f0960UL, 0xdfa1e2edUL, 0x83f0579dUL, 0x63ed86b9UL, 0x1ab6a6b8UL, 0xde5ebe39UL, 0xf38ff732UL, 0x8989b138UL,
-0x33f14961UL, 0xc01937bdUL, 0xf506c6daUL, 0xe4625e7eUL, 0xa308ea99UL, 0x4e23e33cUL, 0x79cbd7ccUL, 0x48a14367UL,
-0xa3149619UL, 0xfec94bd5UL, 0xa114174aUL, 0xeaa01866UL, 0xa084db2dUL, 0x09a8486fUL, 0xa888614aUL, 0x2900af98UL,
-0x01665991UL, 0xe1992863UL, 0xc8f30c60UL, 0x2e78ef3cUL, 0xd0d51932UL, 0xcf0fec14UL, 0xf7ca07d2UL, 0xd0a82072UL,
-0xfd41197eUL, 0x9305a6b0UL, 0xe86be3daUL, 0x74bed3cdUL, 0x372da53cUL, 0x4c7f4448UL, 0xdab5d440UL, 0x6dba0ec3UL,
-0x083919a7UL, 0x9fbaeed9UL, 0x49dbcfb0UL, 0x4e670c53UL, 0x5c3d9c01UL, 0x64bdb941UL, 0x2c0e636aUL, 0xba7dd9cdUL,
-0xea6f7388UL, 0xe70bc762UL, 0x35f29adbUL, 0x5c4cdd8dUL, 0xf0d48d8cUL, 0xb88153e2UL, 0x08a19866UL, 0x1ae2eac8UL,
-0x284caf89UL, 0xaa928223UL, 0x9334be53UL, 0x3b3a21bfUL, 0x16434be3UL, 0x9aea3906UL, 0xefe8c36eUL, 0xf890cdd9UL,
-0x80226daeUL, 0xc340a4a3UL, 0xdf7e9c09UL, 0xa694a807UL, 0x5b7c5eccUL, 0x221db3a6UL, 0x9a69a02fUL, 0x68818a54UL,
-0xceb2296fUL, 0x53c0843aUL, 0xfe893655UL, 0x25bfe68aUL, 0xb4628abcUL, 0xcf222ebfUL, 0x25ac6f48UL, 0xa9a99387UL,
-0x53bddb65UL, 0xe76ffbe7UL, 0xe967fd78UL, 0x0ba93563UL, 0x8e342bc1UL, 0xe8a11be9UL, 0x4980740dUL, 0xc8087dfcUL,
-0x8de4bf99UL, 0xa11101a0UL, 0x7fd37975UL, 0xda5a26c0UL, 0xe81f994fUL, 0x9528cd89UL, 0xfd339fedUL, 0xb87834bfUL,
-0x5f04456dUL, 0x22258698UL, 0xc9c4c83bUL, 0x2dc156beUL, 0x4f628daaUL, 0x57f55ec5UL, 0xe2220abeUL, 0xd2916ebfUL,
-0x4ec75b95UL, 0x24f2c3c0UL, 0x42d15d99UL, 0xcd0d7fa0UL, 0x7b6e27ffUL, 0xa8dc8af0UL, 0x7345c106UL, 0xf41e232fUL,
-0x35162386UL, 0xe6ea8926UL, 0x3333b094UL, 0x157ec6f2UL, 0x372b74afUL, 0x692573e4UL, 0xe9a9d848UL, 0xf3160289UL,
-0x3a62ef1dUL, 0xa787e238UL, 0xf3a5f676UL, 0x74364853UL, 0x20951063UL, 0x4576698dUL, 0xb6fad407UL, 0x592af950UL,
-0x36f73523UL, 0x4cfb6e87UL, 0x7da4cec0UL, 0x6c152daaUL, 0xcb0396a8UL, 0xc50dfe5dUL, 0xfcd707abUL, 0x0921c42fUL,
-0x89dff0bbUL, 0x5fe2be78UL, 0x448f4f33UL, 0x754613c9UL, 0x2b05d08dUL, 0x48b9d585UL, 0xdc049441UL, 0xc8098f9bUL,
-0x7dede786UL, 0xc39a3373UL, 0x42410005UL, 0x6a091751UL, 0x0ef3c8a6UL, 0x890072d6UL, 0x28207682UL, 0xa9a9f7beUL,
-0xbf32679dUL, 0xd45b5b75UL, 0xb353fd00UL, 0xcbb0e358UL, 0x830f220aUL, 0x1f8fb214UL, 0xd372cf08UL, 0xcc3c4a13UL,
-0x8cf63166UL, 0x061c87beUL, 0x88c98f88UL, 0x6062e397UL, 0x47cf8e7aUL, 0xb6c85283UL, 0x3cc2acfbUL, 0x3fc06976UL,
-0x4e8f0252UL, 0x64d8314dUL, 0xda3870e3UL, 0x1e665459UL, 0xc10908f0UL, 0x513021a5UL, 0x6c5b68b7UL, 0x822f8aa0UL,
-0x3007cd3eUL, 0x74719eefUL, 0xdc872681UL, 0x073340d4UL, 0x7e432fd9UL, 0x0c5ec241UL, 0x8809286cUL, 0xf592d891UL,
-0x08a930f6UL, 0x957ef305UL, 0xb7fbffbdUL, 0xc266e96fUL, 0x6fe4ac98UL, 0xb173ecc0UL, 0xbc60b42aUL, 0x953498daUL,
-0xfba1ae12UL, 0x2d4bd736UL, 0x0f25faabUL, 0xa4f3fcebUL, 0xe2969123UL, 0x257f0c3dUL, 0x9348af49UL, 0x361400bcUL,
-0xe8816f4aUL, 0x3814f200UL, 0xa3f94043UL, 0x9c7a54c2UL, 0xbc704f57UL, 0xda41e7f9UL, 0xc25ad33aUL, 0x54f4a084UL,
-0xb17f5505UL, 0x59357cbeUL, 0xedbd15c8UL, 0x7f97c5abUL, 0xba5ac7b5UL, 0xb6f6deafUL, 0x3a479c3aUL, 0x5302da25UL,
-0x653d7e6aUL, 0x54268d49UL, 0x51a477eaUL, 0x5017d55bUL, 0xd7d25d88UL, 0x44136c76UL, 0x0404a8c8UL, 0xb8e5a121UL,
-0xb81a928aUL, 0x60ed5869UL, 0x97c55b96UL, 0xeaec991bUL, 0x29935913UL, 0x01fdb7f1UL, 0x088e8dfaUL, 0x9ab6f6f5UL,
-0x3b4cbf9fUL, 0x4a5de3abUL, 0xe6051d35UL, 0xa0e1d855UL, 0xd36b4cf1UL, 0xf544edebUL, 0xb0e93524UL, 0xbebb8fbdUL,
-0xa2d762cfUL, 0x49c92f54UL, 0x38b5f331UL, 0x7128a454UL, 0x48392905UL, 0xa65b1db8UL, 0x851c97bdUL, 0xd675cf2fUL};
-
+ 0xf6fa8f9dUL, 0x2cac6ce1UL, 0x4ca34867UL, 0xe2337f7cUL, 0x95db08e7UL, 0x016843b4UL, 0xeced5cbcUL, 0x325553acUL,
+ 0xbf9f0960UL, 0xdfa1e2edUL, 0x83f0579dUL, 0x63ed86b9UL, 0x1ab6a6b8UL, 0xde5ebe39UL, 0xf38ff732UL, 0x8989b138UL,
+ 0x33f14961UL, 0xc01937bdUL, 0xf506c6daUL, 0xe4625e7eUL, 0xa308ea99UL, 0x4e23e33cUL, 0x79cbd7ccUL, 0x48a14367UL,
+ 0xa3149619UL, 0xfec94bd5UL, 0xa114174aUL, 0xeaa01866UL, 0xa084db2dUL, 0x09a8486fUL, 0xa888614aUL, 0x2900af98UL,
+ 0x01665991UL, 0xe1992863UL, 0xc8f30c60UL, 0x2e78ef3cUL, 0xd0d51932UL, 0xcf0fec14UL, 0xf7ca07d2UL, 0xd0a82072UL,
+ 0xfd41197eUL, 0x9305a6b0UL, 0xe86be3daUL, 0x74bed3cdUL, 0x372da53cUL, 0x4c7f4448UL, 0xdab5d440UL, 0x6dba0ec3UL,
+ 0x083919a7UL, 0x9fbaeed9UL, 0x49dbcfb0UL, 0x4e670c53UL, 0x5c3d9c01UL, 0x64bdb941UL, 0x2c0e636aUL, 0xba7dd9cdUL,
+ 0xea6f7388UL, 0xe70bc762UL, 0x35f29adbUL, 0x5c4cdd8dUL, 0xf0d48d8cUL, 0xb88153e2UL, 0x08a19866UL, 0x1ae2eac8UL,
+ 0x284caf89UL, 0xaa928223UL, 0x9334be53UL, 0x3b3a21bfUL, 0x16434be3UL, 0x9aea3906UL, 0xefe8c36eUL, 0xf890cdd9UL,
+ 0x80226daeUL, 0xc340a4a3UL, 0xdf7e9c09UL, 0xa694a807UL, 0x5b7c5eccUL, 0x221db3a6UL, 0x9a69a02fUL, 0x68818a54UL,
+ 0xceb2296fUL, 0x53c0843aUL, 0xfe893655UL, 0x25bfe68aUL, 0xb4628abcUL, 0xcf222ebfUL, 0x25ac6f48UL, 0xa9a99387UL,
+ 0x53bddb65UL, 0xe76ffbe7UL, 0xe967fd78UL, 0x0ba93563UL, 0x8e342bc1UL, 0xe8a11be9UL, 0x4980740dUL, 0xc8087dfcUL,
+ 0x8de4bf99UL, 0xa11101a0UL, 0x7fd37975UL, 0xda5a26c0UL, 0xe81f994fUL, 0x9528cd89UL, 0xfd339fedUL, 0xb87834bfUL,
+ 0x5f04456dUL, 0x22258698UL, 0xc9c4c83bUL, 0x2dc156beUL, 0x4f628daaUL, 0x57f55ec5UL, 0xe2220abeUL, 0xd2916ebfUL,
+ 0x4ec75b95UL, 0x24f2c3c0UL, 0x42d15d99UL, 0xcd0d7fa0UL, 0x7b6e27ffUL, 0xa8dc8af0UL, 0x7345c106UL, 0xf41e232fUL,
+ 0x35162386UL, 0xe6ea8926UL, 0x3333b094UL, 0x157ec6f2UL, 0x372b74afUL, 0x692573e4UL, 0xe9a9d848UL, 0xf3160289UL,
+ 0x3a62ef1dUL, 0xa787e238UL, 0xf3a5f676UL, 0x74364853UL, 0x20951063UL, 0x4576698dUL, 0xb6fad407UL, 0x592af950UL,
+ 0x36f73523UL, 0x4cfb6e87UL, 0x7da4cec0UL, 0x6c152daaUL, 0xcb0396a8UL, 0xc50dfe5dUL, 0xfcd707abUL, 0x0921c42fUL,
+ 0x89dff0bbUL, 0x5fe2be78UL, 0x448f4f33UL, 0x754613c9UL, 0x2b05d08dUL, 0x48b9d585UL, 0xdc049441UL, 0xc8098f9bUL,
+ 0x7dede786UL, 0xc39a3373UL, 0x42410005UL, 0x6a091751UL, 0x0ef3c8a6UL, 0x890072d6UL, 0x28207682UL, 0xa9a9f7beUL,
+ 0xbf32679dUL, 0xd45b5b75UL, 0xb353fd00UL, 0xcbb0e358UL, 0x830f220aUL, 0x1f8fb214UL, 0xd372cf08UL, 0xcc3c4a13UL,
+ 0x8cf63166UL, 0x061c87beUL, 0x88c98f88UL, 0x6062e397UL, 0x47cf8e7aUL, 0xb6c85283UL, 0x3cc2acfbUL, 0x3fc06976UL,
+ 0x4e8f0252UL, 0x64d8314dUL, 0xda3870e3UL, 0x1e665459UL, 0xc10908f0UL, 0x513021a5UL, 0x6c5b68b7UL, 0x822f8aa0UL,
+ 0x3007cd3eUL, 0x74719eefUL, 0xdc872681UL, 0x073340d4UL, 0x7e432fd9UL, 0x0c5ec241UL, 0x8809286cUL, 0xf592d891UL,
+ 0x08a930f6UL, 0x957ef305UL, 0xb7fbffbdUL, 0xc266e96fUL, 0x6fe4ac98UL, 0xb173ecc0UL, 0xbc60b42aUL, 0x953498daUL,
+ 0xfba1ae12UL, 0x2d4bd736UL, 0x0f25faabUL, 0xa4f3fcebUL, 0xe2969123UL, 0x257f0c3dUL, 0x9348af49UL, 0x361400bcUL,
+ 0xe8816f4aUL, 0x3814f200UL, 0xa3f94043UL, 0x9c7a54c2UL, 0xbc704f57UL, 0xda41e7f9UL, 0xc25ad33aUL, 0x54f4a084UL,
+ 0xb17f5505UL, 0x59357cbeUL, 0xedbd15c8UL, 0x7f97c5abUL, 0xba5ac7b5UL, 0xb6f6deafUL, 0x3a479c3aUL, 0x5302da25UL,
+ 0x653d7e6aUL, 0x54268d49UL, 0x51a477eaUL, 0x5017d55bUL, 0xd7d25d88UL, 0x44136c76UL, 0x0404a8c8UL, 0xb8e5a121UL,
+ 0xb81a928aUL, 0x60ed5869UL, 0x97c55b96UL, 0xeaec991bUL, 0x29935913UL, 0x01fdb7f1UL, 0x088e8dfaUL, 0x9ab6f6f5UL,
+ 0x3b4cbf9fUL, 0x4a5de3abUL, 0xe6051d35UL, 0xa0e1d855UL, 0xd36b4cf1UL, 0xf544edebUL, 0xb0e93524UL, 0xbebb8fbdUL,
+ 0xa2d762cfUL, 0x49c92f54UL, 0x38b5f331UL, 0x7128a454UL, 0x48392905UL, 0xa65b1db8UL, 0x851c97bdUL, 0xd675cf2fUL};
const uint32_t s7[] PROGMEM = {
-0x85e04019UL, 0x332bf567UL, 0x662dbfffUL, 0xcfc65693UL, 0x2a8d7f6fUL, 0xab9bc912UL, 0xde6008a1UL, 0x2028da1fUL,
-0x0227bce7UL, 0x4d642916UL, 0x18fac300UL, 0x50f18b82UL, 0x2cb2cb11UL, 0xb232e75cUL, 0x4b3695f2UL, 0xb28707deUL,
-0xa05fbcf6UL, 0xcd4181e9UL, 0xe150210cUL, 0xe24ef1bdUL, 0xb168c381UL, 0xfde4e789UL, 0x5c79b0d8UL, 0x1e8bfd43UL,
-0x4d495001UL, 0x38be4341UL, 0x913cee1dUL, 0x92a79c3fUL, 0x089766beUL, 0xbaeeadf4UL, 0x1286becfUL, 0xb6eacb19UL,
-0x2660c200UL, 0x7565bde4UL, 0x64241f7aUL, 0x8248dca9UL, 0xc3b3ad66UL, 0x28136086UL, 0x0bd8dfa8UL, 0x356d1cf2UL,
-0x107789beUL, 0xb3b2e9ceUL, 0x0502aa8fUL, 0x0bc0351eUL, 0x166bf52aUL, 0xeb12ff82UL, 0xe3486911UL, 0xd34d7516UL,
-0x4e7b3affUL, 0x5f43671bUL, 0x9cf6e037UL, 0x4981ac83UL, 0x334266ceUL, 0x8c9341b7UL, 0xd0d854c0UL, 0xcb3a6c88UL,
-0x47bc2829UL, 0x4725ba37UL, 0xa66ad22bUL, 0x7ad61f1eUL, 0x0c5cbafaUL, 0x4437f107UL, 0xb6e79962UL, 0x42d2d816UL,
-0x0a961288UL, 0xe1a5c06eUL, 0x13749e67UL, 0x72fc081aUL, 0xb1d139f7UL, 0xf9583745UL, 0xcf19df58UL, 0xbec3f756UL,
-0xc06eba30UL, 0x07211b24UL, 0x45c28829UL, 0xc95e317fUL, 0xbc8ec511UL, 0x38bc46e9UL, 0xc6e6fa14UL, 0xbae8584aUL,
-0xad4ebc46UL, 0x468f508bUL, 0x7829435fUL, 0xf124183bUL, 0x821dba9fUL, 0xaff60ff4UL, 0xea2c4e6dUL, 0x16e39264UL,
-0x92544a8bUL, 0x009b4fc3UL, 0xaba68cedUL, 0x9ac96f78UL, 0x06a5b79aUL, 0xb2856e6eUL, 0x1aec3ca9UL, 0xbe838688UL,
-0x0e0804e9UL, 0x55f1be56UL, 0xe7e5363bUL, 0xb3a1f25dUL, 0xf7debb85UL, 0x61fe033cUL, 0x16746233UL, 0x3c034c28UL,
-0xda6d0c74UL, 0x79aac56cUL, 0x3ce4e1adUL, 0x51f0c802UL, 0x98f8f35aUL, 0x1626a49fUL, 0xeed82b29UL, 0x1d382fe3UL,
-0x0c4fb99aUL, 0xbb325778UL, 0x3ec6d97bUL, 0x6e77a6a9UL, 0xcb658b5cUL, 0xd45230c7UL, 0x2bd1408bUL, 0x60c03eb7UL,
-0xb9068d78UL, 0xa33754f4UL, 0xf430c87dUL, 0xc8a71302UL, 0xb96d8c32UL, 0xebd4e7beUL, 0xbe8b9d2dUL, 0x7979fb06UL,
-0xe7225308UL, 0x8b75cf77UL, 0x11ef8da4UL, 0xe083c858UL, 0x8d6b786fUL, 0x5a6317a6UL, 0xfa5cf7a0UL, 0x5dda0033UL,
-0xf28ebfb0UL, 0xf5b9c310UL, 0xa0eac280UL, 0x08b9767aUL, 0xa3d9d2b0UL, 0x79d34217UL, 0x021a718dUL, 0x9ac6336aUL,
-0x2711fd60UL, 0x438050e3UL, 0x069908a8UL, 0x3d7fedc4UL, 0x826d2befUL, 0x4eeb8476UL, 0x488dcf25UL, 0x36c9d566UL,
-0x28e74e41UL, 0xc2610acaUL, 0x3d49a9cfUL, 0xbae3b9dfUL, 0xb65f8de6UL, 0x92aeaf64UL, 0x3ac7d5e6UL, 0x9ea80509UL,
-0xf22b017dUL, 0xa4173f70UL, 0xdd1e16c3UL, 0x15e0d7f9UL, 0x50b1b887UL, 0x2b9f4fd5UL, 0x625aba82UL, 0x6a017962UL,
-0x2ec01b9cUL, 0x15488aa9UL, 0xd716e740UL, 0x40055a2cUL, 0x93d29a22UL, 0xe32dbf9aUL, 0x058745b9UL, 0x3453dc1eUL,
-0xd699296eUL, 0x496cff6fUL, 0x1c9f4986UL, 0xdfe2ed07UL, 0xb87242d1UL, 0x19de7eaeUL, 0x053e561aUL, 0x15ad6f8cUL,
-0x66626c1cUL, 0x7154c24cUL, 0xea082b2aUL, 0x93eb2939UL, 0x17dcb0f0UL, 0x58d4f2aeUL, 0x9ea294fbUL, 0x52cf564cUL,
-0x9883fe66UL, 0x2ec40581UL, 0x763953c3UL, 0x01d6692eUL, 0xd3a0c108UL, 0xa1e7160eUL, 0xe4f2dfa6UL, 0x693ed285UL,
-0x74904698UL, 0x4c2b0eddUL, 0x4f757656UL, 0x5d393378UL, 0xa132234fUL, 0x3d321c5dUL, 0xc3f5e194UL, 0x4b269301UL,
-0xc79f022fUL, 0x3c997e7eUL, 0x5e4f9504UL, 0x3ffafbbdUL, 0x76f7ad0eUL, 0x296693f4UL, 0x3d1fce6fUL, 0xc61e45beUL,
-0xd3b5ab34UL, 0xf72bf9b7UL, 0x1b0434c0UL, 0x4e72b567UL, 0x5592a33dUL, 0xb5229301UL, 0xcfd2a87fUL, 0x60aeb767UL,
-0x1814386bUL, 0x30bcc33dUL, 0x38a0c07dUL, 0xfd1606f2UL, 0xc363519bUL, 0x589dd390UL, 0x5479f8e6UL, 0x1cb8d647UL,
-0x97fd61a9UL, 0xea7759f4UL, 0x2d57539dUL, 0x569a58cfUL, 0xe84e63adUL, 0x462e1b78UL, 0x6580f87eUL, 0xf3817914UL,
-0x91da55f4UL, 0x40a230f3UL, 0xd1988f35UL, 0xb6e318d2UL, 0x3ffa50bcUL, 0x3d40f021UL, 0xc3c0bdaeUL, 0x4958c24cUL,
-0x518f36b2UL, 0x84b1d370UL, 0x0fedce83UL, 0x878ddadaUL, 0xf2a279c7UL, 0x94e01be8UL, 0x90716f4bUL, 0x954b8aa3UL};
-
+ 0x85e04019UL, 0x332bf567UL, 0x662dbfffUL, 0xcfc65693UL, 0x2a8d7f6fUL, 0xab9bc912UL, 0xde6008a1UL, 0x2028da1fUL,
+ 0x0227bce7UL, 0x4d642916UL, 0x18fac300UL, 0x50f18b82UL, 0x2cb2cb11UL, 0xb232e75cUL, 0x4b3695f2UL, 0xb28707deUL,
+ 0xa05fbcf6UL, 0xcd4181e9UL, 0xe150210cUL, 0xe24ef1bdUL, 0xb168c381UL, 0xfde4e789UL, 0x5c79b0d8UL, 0x1e8bfd43UL,
+ 0x4d495001UL, 0x38be4341UL, 0x913cee1dUL, 0x92a79c3fUL, 0x089766beUL, 0xbaeeadf4UL, 0x1286becfUL, 0xb6eacb19UL,
+ 0x2660c200UL, 0x7565bde4UL, 0x64241f7aUL, 0x8248dca9UL, 0xc3b3ad66UL, 0x28136086UL, 0x0bd8dfa8UL, 0x356d1cf2UL,
+ 0x107789beUL, 0xb3b2e9ceUL, 0x0502aa8fUL, 0x0bc0351eUL, 0x166bf52aUL, 0xeb12ff82UL, 0xe3486911UL, 0xd34d7516UL,
+ 0x4e7b3affUL, 0x5f43671bUL, 0x9cf6e037UL, 0x4981ac83UL, 0x334266ceUL, 0x8c9341b7UL, 0xd0d854c0UL, 0xcb3a6c88UL,
+ 0x47bc2829UL, 0x4725ba37UL, 0xa66ad22bUL, 0x7ad61f1eUL, 0x0c5cbafaUL, 0x4437f107UL, 0xb6e79962UL, 0x42d2d816UL,
+ 0x0a961288UL, 0xe1a5c06eUL, 0x13749e67UL, 0x72fc081aUL, 0xb1d139f7UL, 0xf9583745UL, 0xcf19df58UL, 0xbec3f756UL,
+ 0xc06eba30UL, 0x07211b24UL, 0x45c28829UL, 0xc95e317fUL, 0xbc8ec511UL, 0x38bc46e9UL, 0xc6e6fa14UL, 0xbae8584aUL,
+ 0xad4ebc46UL, 0x468f508bUL, 0x7829435fUL, 0xf124183bUL, 0x821dba9fUL, 0xaff60ff4UL, 0xea2c4e6dUL, 0x16e39264UL,
+ 0x92544a8bUL, 0x009b4fc3UL, 0xaba68cedUL, 0x9ac96f78UL, 0x06a5b79aUL, 0xb2856e6eUL, 0x1aec3ca9UL, 0xbe838688UL,
+ 0x0e0804e9UL, 0x55f1be56UL, 0xe7e5363bUL, 0xb3a1f25dUL, 0xf7debb85UL, 0x61fe033cUL, 0x16746233UL, 0x3c034c28UL,
+ 0xda6d0c74UL, 0x79aac56cUL, 0x3ce4e1adUL, 0x51f0c802UL, 0x98f8f35aUL, 0x1626a49fUL, 0xeed82b29UL, 0x1d382fe3UL,
+ 0x0c4fb99aUL, 0xbb325778UL, 0x3ec6d97bUL, 0x6e77a6a9UL, 0xcb658b5cUL, 0xd45230c7UL, 0x2bd1408bUL, 0x60c03eb7UL,
+ 0xb9068d78UL, 0xa33754f4UL, 0xf430c87dUL, 0xc8a71302UL, 0xb96d8c32UL, 0xebd4e7beUL, 0xbe8b9d2dUL, 0x7979fb06UL,
+ 0xe7225308UL, 0x8b75cf77UL, 0x11ef8da4UL, 0xe083c858UL, 0x8d6b786fUL, 0x5a6317a6UL, 0xfa5cf7a0UL, 0x5dda0033UL,
+ 0xf28ebfb0UL, 0xf5b9c310UL, 0xa0eac280UL, 0x08b9767aUL, 0xa3d9d2b0UL, 0x79d34217UL, 0x021a718dUL, 0x9ac6336aUL,
+ 0x2711fd60UL, 0x438050e3UL, 0x069908a8UL, 0x3d7fedc4UL, 0x826d2befUL, 0x4eeb8476UL, 0x488dcf25UL, 0x36c9d566UL,
+ 0x28e74e41UL, 0xc2610acaUL, 0x3d49a9cfUL, 0xbae3b9dfUL, 0xb65f8de6UL, 0x92aeaf64UL, 0x3ac7d5e6UL, 0x9ea80509UL,
+ 0xf22b017dUL, 0xa4173f70UL, 0xdd1e16c3UL, 0x15e0d7f9UL, 0x50b1b887UL, 0x2b9f4fd5UL, 0x625aba82UL, 0x6a017962UL,
+ 0x2ec01b9cUL, 0x15488aa9UL, 0xd716e740UL, 0x40055a2cUL, 0x93d29a22UL, 0xe32dbf9aUL, 0x058745b9UL, 0x3453dc1eUL,
+ 0xd699296eUL, 0x496cff6fUL, 0x1c9f4986UL, 0xdfe2ed07UL, 0xb87242d1UL, 0x19de7eaeUL, 0x053e561aUL, 0x15ad6f8cUL,
+ 0x66626c1cUL, 0x7154c24cUL, 0xea082b2aUL, 0x93eb2939UL, 0x17dcb0f0UL, 0x58d4f2aeUL, 0x9ea294fbUL, 0x52cf564cUL,
+ 0x9883fe66UL, 0x2ec40581UL, 0x763953c3UL, 0x01d6692eUL, 0xd3a0c108UL, 0xa1e7160eUL, 0xe4f2dfa6UL, 0x693ed285UL,
+ 0x74904698UL, 0x4c2b0eddUL, 0x4f757656UL, 0x5d393378UL, 0xa132234fUL, 0x3d321c5dUL, 0xc3f5e194UL, 0x4b269301UL,
+ 0xc79f022fUL, 0x3c997e7eUL, 0x5e4f9504UL, 0x3ffafbbdUL, 0x76f7ad0eUL, 0x296693f4UL, 0x3d1fce6fUL, 0xc61e45beUL,
+ 0xd3b5ab34UL, 0xf72bf9b7UL, 0x1b0434c0UL, 0x4e72b567UL, 0x5592a33dUL, 0xb5229301UL, 0xcfd2a87fUL, 0x60aeb767UL,
+ 0x1814386bUL, 0x30bcc33dUL, 0x38a0c07dUL, 0xfd1606f2UL, 0xc363519bUL, 0x589dd390UL, 0x5479f8e6UL, 0x1cb8d647UL,
+ 0x97fd61a9UL, 0xea7759f4UL, 0x2d57539dUL, 0x569a58cfUL, 0xe84e63adUL, 0x462e1b78UL, 0x6580f87eUL, 0xf3817914UL,
+ 0x91da55f4UL, 0x40a230f3UL, 0xd1988f35UL, 0xb6e318d2UL, 0x3ffa50bcUL, 0x3d40f021UL, 0xc3c0bdaeUL, 0x4958c24cUL,
+ 0x518f36b2UL, 0x84b1d370UL, 0x0fedce83UL, 0x878ddadaUL, 0xf2a279c7UL, 0x94e01be8UL, 0x90716f4bUL, 0x954b8aa3UL};
const uint32_t s8[] PROGMEM = {
-0xe216300dUL, 0xbbddfffcUL, 0xa7ebdabdUL, 0x35648095UL, 0x7789f8b7UL, 0xe6c1121bUL, 0x0e241600UL, 0x052ce8b5UL,
-0x11a9cfb0UL, 0xe5952f11UL, 0xece7990aUL, 0x9386d174UL, 0x2a42931cUL, 0x76e38111UL, 0xb12def3aUL, 0x37ddddfcUL,
-0xde9adeb1UL, 0x0a0cc32cUL, 0xbe197029UL, 0x84a00940UL, 0xbb243a0fUL, 0xb4d137cfUL, 0xb44e79f0UL, 0x049eedfdUL,
-0x0b15a15dUL, 0x480d3168UL, 0x8bbbde5aUL, 0x669ded42UL, 0xc7ece831UL, 0x3f8f95e7UL, 0x72df191bUL, 0x7580330dUL,
-0x94074251UL, 0x5c7dcdfaUL, 0xabbe6d63UL, 0xaa402164UL, 0xb301d40aUL, 0x02e7d1caUL, 0x53571daeUL, 0x7a3182a2UL,
-0x12a8ddecUL, 0xfdaa335dUL, 0x176f43e8UL, 0x71fb46d4UL, 0x38129022UL, 0xce949ad4UL, 0xb84769adUL, 0x965bd862UL,
-0x82f3d055UL, 0x66fb9767UL, 0x15b80b4eUL, 0x1d5b47a0UL, 0x4cfde06fUL, 0xc28ec4b8UL, 0x57e8726eUL, 0x647a78fcUL,
-0x99865d44UL, 0x608bd593UL, 0x6c200e03UL, 0x39dc5ff6UL, 0x5d0b00a3UL, 0xae63aff2UL, 0x7e8bd632UL, 0x70108c0cUL,
-0xbbd35049UL, 0x2998df04UL, 0x980cf42aUL, 0x9b6df491UL, 0x9e7edd53UL, 0x06918548UL, 0x58cb7e07UL, 0x3b74ef2eUL,
-0x522fffb1UL, 0xd24708ccUL, 0x1c7e27cdUL, 0xa4eb215bUL, 0x3cf1d2e2UL, 0x19b47a38UL, 0x424f7618UL, 0x35856039UL,
-0x9d17dee7UL, 0x27eb35e6UL, 0xc9aff67bUL, 0x36baf5b8UL, 0x09c467cdUL, 0xc18910b1UL, 0xe11dbf7bUL, 0x06cd1af8UL,
-0x7170c608UL, 0x2d5e3354UL, 0xd4de495aUL, 0x64c6d006UL, 0xbcc0c62cUL, 0x3dd00db3UL, 0x708f8f34UL, 0x77d51b42UL,
-0x264f620fUL, 0x24b8d2bfUL, 0x15c1b79eUL, 0x46a52564UL, 0xf8d7e54eUL, 0x3e378160UL, 0x7895cda5UL, 0x859c15a5UL,
-0xe6459788UL, 0xc37bc75fUL, 0xdb07ba0cUL, 0x0676a3abUL, 0x7f229b1eUL, 0x31842e7bUL, 0x24259fd7UL, 0xf8bef472UL,
-0x835ffcb8UL, 0x6df4c1f2UL, 0x96f5b195UL, 0xfd0af0fcUL, 0xb0fe134cUL, 0xe2506d3dUL, 0x4f9b12eaUL, 0xf215f225UL,
-0xa223736fUL, 0x9fb4c428UL, 0x25d04979UL, 0x34c713f8UL, 0xc4618187UL, 0xea7a6e98UL, 0x7cd16efcUL, 0x1436876cUL,
-0xf1544107UL, 0xbedeee14UL, 0x56e9af27UL, 0xa04aa441UL, 0x3cf7c899UL, 0x92ecbae6UL, 0xdd67016dUL, 0x151682ebUL,
-0xa842eedfUL, 0xfdba60b4UL, 0xf1907b75UL, 0x20e3030fUL, 0x24d8c29eUL, 0xe139673bUL, 0xefa63fb8UL, 0x71873054UL,
-0xb6f2cf3bUL, 0x9f326442UL, 0xcb15a4ccUL, 0xb01a4504UL, 0xf1e47d8dUL, 0x844a1be5UL, 0xbae7dfdcUL, 0x42cbda70UL,
-0xcd7dae0aUL, 0x57e85b7aUL, 0xd53f5af6UL, 0x20cf4d8cUL, 0xcea4d428UL, 0x79d130a4UL, 0x3486ebfbUL, 0x33d3cddcUL,
-0x77853b53UL, 0x37effcb5UL, 0xc5068778UL, 0xe580b3e6UL, 0x4e68b8f4UL, 0xc5c8b37eUL, 0x0d809ea2UL, 0x398feb7cUL,
-0x132a4f94UL, 0x43b7950eUL, 0x2fee7d1cUL, 0x223613bdUL, 0xdd06caa2UL, 0x37df932bUL, 0xc4248289UL, 0xacf3ebc3UL,
-0x5715f6b7UL, 0xef3478ddUL, 0xf267616fUL, 0xc148cbe4UL, 0x9052815eUL, 0x5e410fabUL, 0xb48a2465UL, 0x2eda7fa4UL,
-0xe87b40e4UL, 0xe98ea084UL, 0x5889e9e1UL, 0xefd390fcUL, 0xdd07d35bUL, 0xdb485694UL, 0x38d7e5b2UL, 0x57720101UL,
-0x730edebcUL, 0x5b643113UL, 0x94917e4fUL, 0x503c2fbaUL, 0x646f1282UL, 0x7523d24aUL, 0xe0779695UL, 0xf9c17a8fUL,
-0x7a5b2121UL, 0xd187b896UL, 0x29263a4dUL, 0xba510cdfUL, 0x81f47c9fUL, 0xad1163edUL, 0xea7b5965UL, 0x1a00726eUL,
-0x11403092UL, 0x00da6d77UL, 0x4a0cdd61UL, 0xad1f4603UL, 0x605bdfb0UL, 0x9eedc364UL, 0x22ebe6a8UL, 0xcee7d28aUL,
-0xa0e736a0UL, 0x5564a6b9UL, 0x10853209UL, 0xc7eb8f37UL, 0x2de705caUL, 0x8951570fUL, 0xdf09822bUL, 0xbd691a6cUL,
-0xaa12e4f2UL, 0x87451c0fUL, 0xe0f6a27aUL, 0x3ada4819UL, 0x4cf1764fUL, 0x0d771c2bUL, 0x67cdb156UL, 0x350d8384UL,
-0x5938fa0fUL, 0x42399ef3UL, 0x36997b07UL, 0x0e84093dUL, 0x4aa93e61UL, 0x8360d87bUL, 0x1fa98b0cUL, 0x1149382cUL,
-0xe97625a5UL, 0x0614d1b7UL, 0x0e25244bUL, 0x0c768347UL, 0x589e8d82UL, 0x0d2059d1UL, 0xa466bb1eUL, 0xf8da0a82UL,
-0x04f19130UL, 0xba6e4ec0UL, 0x99265164UL, 0x1ee7230dUL, 0x50b2ad80UL, 0xeaee6801UL, 0x8db2a283UL, 0xea8bf59eUL};
+ 0xe216300dUL, 0xbbddfffcUL, 0xa7ebdabdUL, 0x35648095UL, 0x7789f8b7UL, 0xe6c1121bUL, 0x0e241600UL, 0x052ce8b5UL,
+ 0x11a9cfb0UL, 0xe5952f11UL, 0xece7990aUL, 0x9386d174UL, 0x2a42931cUL, 0x76e38111UL, 0xb12def3aUL, 0x37ddddfcUL,
+ 0xde9adeb1UL, 0x0a0cc32cUL, 0xbe197029UL, 0x84a00940UL, 0xbb243a0fUL, 0xb4d137cfUL, 0xb44e79f0UL, 0x049eedfdUL,
+ 0x0b15a15dUL, 0x480d3168UL, 0x8bbbde5aUL, 0x669ded42UL, 0xc7ece831UL, 0x3f8f95e7UL, 0x72df191bUL, 0x7580330dUL,
+ 0x94074251UL, 0x5c7dcdfaUL, 0xabbe6d63UL, 0xaa402164UL, 0xb301d40aUL, 0x02e7d1caUL, 0x53571daeUL, 0x7a3182a2UL,
+ 0x12a8ddecUL, 0xfdaa335dUL, 0x176f43e8UL, 0x71fb46d4UL, 0x38129022UL, 0xce949ad4UL, 0xb84769adUL, 0x965bd862UL,
+ 0x82f3d055UL, 0x66fb9767UL, 0x15b80b4eUL, 0x1d5b47a0UL, 0x4cfde06fUL, 0xc28ec4b8UL, 0x57e8726eUL, 0x647a78fcUL,
+ 0x99865d44UL, 0x608bd593UL, 0x6c200e03UL, 0x39dc5ff6UL, 0x5d0b00a3UL, 0xae63aff2UL, 0x7e8bd632UL, 0x70108c0cUL,
+ 0xbbd35049UL, 0x2998df04UL, 0x980cf42aUL, 0x9b6df491UL, 0x9e7edd53UL, 0x06918548UL, 0x58cb7e07UL, 0x3b74ef2eUL,
+ 0x522fffb1UL, 0xd24708ccUL, 0x1c7e27cdUL, 0xa4eb215bUL, 0x3cf1d2e2UL, 0x19b47a38UL, 0x424f7618UL, 0x35856039UL,
+ 0x9d17dee7UL, 0x27eb35e6UL, 0xc9aff67bUL, 0x36baf5b8UL, 0x09c467cdUL, 0xc18910b1UL, 0xe11dbf7bUL, 0x06cd1af8UL,
+ 0x7170c608UL, 0x2d5e3354UL, 0xd4de495aUL, 0x64c6d006UL, 0xbcc0c62cUL, 0x3dd00db3UL, 0x708f8f34UL, 0x77d51b42UL,
+ 0x264f620fUL, 0x24b8d2bfUL, 0x15c1b79eUL, 0x46a52564UL, 0xf8d7e54eUL, 0x3e378160UL, 0x7895cda5UL, 0x859c15a5UL,
+ 0xe6459788UL, 0xc37bc75fUL, 0xdb07ba0cUL, 0x0676a3abUL, 0x7f229b1eUL, 0x31842e7bUL, 0x24259fd7UL, 0xf8bef472UL,
+ 0x835ffcb8UL, 0x6df4c1f2UL, 0x96f5b195UL, 0xfd0af0fcUL, 0xb0fe134cUL, 0xe2506d3dUL, 0x4f9b12eaUL, 0xf215f225UL,
+ 0xa223736fUL, 0x9fb4c428UL, 0x25d04979UL, 0x34c713f8UL, 0xc4618187UL, 0xea7a6e98UL, 0x7cd16efcUL, 0x1436876cUL,
+ 0xf1544107UL, 0xbedeee14UL, 0x56e9af27UL, 0xa04aa441UL, 0x3cf7c899UL, 0x92ecbae6UL, 0xdd67016dUL, 0x151682ebUL,
+ 0xa842eedfUL, 0xfdba60b4UL, 0xf1907b75UL, 0x20e3030fUL, 0x24d8c29eUL, 0xe139673bUL, 0xefa63fb8UL, 0x71873054UL,
+ 0xb6f2cf3bUL, 0x9f326442UL, 0xcb15a4ccUL, 0xb01a4504UL, 0xf1e47d8dUL, 0x844a1be5UL, 0xbae7dfdcUL, 0x42cbda70UL,
+ 0xcd7dae0aUL, 0x57e85b7aUL, 0xd53f5af6UL, 0x20cf4d8cUL, 0xcea4d428UL, 0x79d130a4UL, 0x3486ebfbUL, 0x33d3cddcUL,
+ 0x77853b53UL, 0x37effcb5UL, 0xc5068778UL, 0xe580b3e6UL, 0x4e68b8f4UL, 0xc5c8b37eUL, 0x0d809ea2UL, 0x398feb7cUL,
+ 0x132a4f94UL, 0x43b7950eUL, 0x2fee7d1cUL, 0x223613bdUL, 0xdd06caa2UL, 0x37df932bUL, 0xc4248289UL, 0xacf3ebc3UL,
+ 0x5715f6b7UL, 0xef3478ddUL, 0xf267616fUL, 0xc148cbe4UL, 0x9052815eUL, 0x5e410fabUL, 0xb48a2465UL, 0x2eda7fa4UL,
+ 0xe87b40e4UL, 0xe98ea084UL, 0x5889e9e1UL, 0xefd390fcUL, 0xdd07d35bUL, 0xdb485694UL, 0x38d7e5b2UL, 0x57720101UL,
+ 0x730edebcUL, 0x5b643113UL, 0x94917e4fUL, 0x503c2fbaUL, 0x646f1282UL, 0x7523d24aUL, 0xe0779695UL, 0xf9c17a8fUL,
+ 0x7a5b2121UL, 0xd187b896UL, 0x29263a4dUL, 0xba510cdfUL, 0x81f47c9fUL, 0xad1163edUL, 0xea7b5965UL, 0x1a00726eUL,
+ 0x11403092UL, 0x00da6d77UL, 0x4a0cdd61UL, 0xad1f4603UL, 0x605bdfb0UL, 0x9eedc364UL, 0x22ebe6a8UL, 0xcee7d28aUL,
+ 0xa0e736a0UL, 0x5564a6b9UL, 0x10853209UL, 0xc7eb8f37UL, 0x2de705caUL, 0x8951570fUL, 0xdf09822bUL, 0xbd691a6cUL,
+ 0xaa12e4f2UL, 0x87451c0fUL, 0xe0f6a27aUL, 0x3ada4819UL, 0x4cf1764fUL, 0x0d771c2bUL, 0x67cdb156UL, 0x350d8384UL,
+ 0x5938fa0fUL, 0x42399ef3UL, 0x36997b07UL, 0x0e84093dUL, 0x4aa93e61UL, 0x8360d87bUL, 0x1fa98b0cUL, 0x1149382cUL,
+ 0xe97625a5UL, 0x0614d1b7UL, 0x0e25244bUL, 0x0c768347UL, 0x589e8d82UL, 0x0d2059d1UL, 0xa466bb1eUL, 0xf8da0a82UL,
+ 0x04f19130UL, 0xba6e4ec0UL, 0x99265164UL, 0x1ee7230dUL, 0x50b2ad80UL, 0xeaee6801UL, 0x8db2a283UL, 0xea8bf59eUL};
#else
const uint32_t s5[] PROGMEM = {
-0x040cc97eUL, 0xb9746e2cUL, 0xdf660e9bUL, 0x117933a6UL, 0xff7f6ab8UL, 0xf558d31dUL, 0x449ddd44UL, 0x7f163117UL,
-0xfaf1fb08UL, 0xcc11f5e7UL, 0x001b05d2UL, 0x00ba5a73UL, 0xd822b72aUL, 0xcb816338UL, 0x3a24f6acUL, 0x7afdbe69UL,
-0x7fe7a2e6UL, 0xcd20c7f0UL, 0x164849c4UL, 0x80c1f5ccUL, 0x40168538UL, 0x48a8b015UL, 0xcb188be6UL, 0xffdeaa4cUL,
-0x010a485fUL, 0xaab21204UL, 0xfc149825UL, 0xe2efd041UL, 0x8db4404eUL, 0xfbb68e24UL, 0xfe1cba8dUL, 0x029ba941UL,
-0x040a551aUL, 0xcb658fbaUL, 0xe7f45172UL, 0x2517a595UL, 0xd7ec06c1UL, 0x0a98a597UL, 0xaab939c5UL, 0x6afe794dUL,
-0x63f7f3f2UL, 0x4080af68UL, 0x569e0cedUL, 0x8b95b411UL, 0x885aebe1UL, 0xb0e60987UL, 0x5671e0d7UL, 0xa7fe294eUL,
-0x2de56663UL, 0x00c0d102UL, 0x058eacc4UL, 0x71f57793UL, 0x2a37050cUL, 0xf2358557UL, 0x02be6122UL, 0xc9a042d6UL,
-0x80a213dfUL, 0xd25bb574UL, 0xc0992168UL, 0xece521d4UL, 0xe83cfb53UL, 0xb3edadc8UL, 0xc97fa828UL, 0x8199953dUL,
-0x00f91f5cUL, 0x99d338feUL, 0x0bff4e0cUL, 0xea072406UL, 0xb14f2faaUL, 0x7669b94fUL, 0x0595c790UL, 0x74a7a8b0UL,
-0xffa155efUL, 0xc2a29ce5UL, 0x272db6a6UL, 0x63426ae6UL, 0x1f0065dfUL, 0x6609c50eUL, 0xbc55dddfUL, 0x5506de29UL,
-0x9a731e91UL, 0x7589af17UL, 0x1c91c732UL, 0x6894f889UL, 0x80e9010dUL, 0xf4554752UL, 0xc93cb603UL, 0xb244c80cUL,
-0xaaf0f3bcUL, 0xe936ac87UL, 0x26743ae5UL, 0x2bd8b301UL, 0x49749e1aUL, 0x7e2dee64UL, 0xdab1dbcdUL, 0x1049c901UL,
-0x80bf68b8UL, 0xfdf3260dUL, 0xe7ed4293UL, 0x84c2a504UL, 0xb6376763UL, 0x16b6f550UL, 0xe36647f2UL, 0xc136ca8eUL,
-0xdb056e13UL, 0x9183f1feUL, 0x377a88fbUL, 0xd4f7e7d6UL, 0xc97dfbc7UL, 0xdffc6330UL, 0xde89f5b6UL, 0xda4129ecUL,
-0x9566e426UL, 0x196456b7UL, 0xc5ef54f6UL, 0xb7588dd0UL, 0x01549248UL, 0x7fcbbac1UL, 0x0f55ffe5UL, 0x493008b6UL,
-0xe8d0b55bUL, 0x5a2ed787UL, 0xe16e6aabUL, 0xce663a22UL, 0xcdf32bc6UL, 0xf985089eUL, 0x473ecb68UL, 0x0f016c08UL,
-0x20e81da2UL, 0xde698bd1UL, 0x7757f6f3UL, 0xf6c302faUL, 0xc3da7e40UL, 0x50d5b3cbUL, 0x4d089317UL, 0xba0ed7b0UL,
-0xd578b30aUL, 0x0cfb51d9UL, 0x56dad7deUL, 0xe4bb2441UL, 0x560bca94UL, 0xd155570fUL, 0x6ee5e1e0UL, 0xbeb58461UL,
-0x9f240a58UL, 0xc04bf794UL, 0x8e8827e3UL, 0x61557b9fUL, 0x8002dcc3UL, 0x15776805UL, 0xd76b6c64UL, 0xb34d9044UL,
-0xa3f0b466UL, 0x8a64f1c0UL, 0xafd57e69UL, 0xf62fe949UL, 0x4f379e30UL, 0x6a35b62cUL, 0x73858085UL, 0x40f89149UL,
-0x02aef076UL, 0x4de83b08UL, 0x9a1c4228UL, 0x06944844UL, 0xb84c6e73UL, 0x102909c1UL, 0xc65fc98bUL, 0xf49c867dUL,
-0x6f614f13UL, 0x8d11772eUL, 0xe12b1bb3UL, 0x72b490aaUL, 0x17d7a53cUL, 0xba1b167dUL, 0x1090ad9cUL, 0xa22b46afUL,
-0xd259e49fUL, 0x5945d345UL, 0x13daf2d9UL, 0x8754c6dbUL, 0x4ef9e4f3UL, 0x6f486d17UL, 0xea137c09UL, 0xc7a51d63UL,
-0x82735f44UL, 0xf4835617UL, 0x976ac6cdUL, 0x8802be70UL, 0x72cfcdb3UL, 0xf3d25d6eUL, 0x79609320UL, 0xa5809b45UL,
-0xdbe260beUL, 0x0131c2a9UL, 0x5c31a5ebUL, 0xf2424e22UL, 0x72155c1cUL, 0x2c1b72f6UL, 0xf3ffd21aUL, 0x4e40258cUL,
-0x2fd74e32UL, 0xfdb76740UL, 0x8e132305UL, 0x78bca35cUL, 0x6ed60fdcUL, 0x83229275UL, 0x176b4d78UL, 0x6eb1eb58UL,
-0x854f0944UL, 0x871d483fUL, 0x7baefefcUL, 0x76ffb577UL, 0xbf02238cUL, 0x5675f4aaUL, 0x2ab0465fUL, 0x0128092bUL,
-0xf7f5383dUL, 0x361fa80cUL, 0x8a4aaf52UL, 0xc0e7d566UL, 0x74083bdfUL, 0x10510595UL, 0xa8d75a1bUL, 0xadd51ef6UL,
-0x79e4f66cUL, 0x84817520UL, 0x65faced0UL, 0x58bef788UL, 0x2668044aUL, 0xf3f8f60fUL, 0x707f9ca0UL, 0xa0ab4653UL,
-0x286ce95cUL, 0xa3ed76e1UL, 0x7f30ac6bUL, 0xd2296837UL, 0xa90f3685UL, 0x2afee317UL, 0x6797b724UL, 0x206ba9f5UL,
-0x9525cdd6UL, 0xbf1eff68UL, 0x2c445575UL, 0xbe069ff1UL, 0x9a65e0f9UL, 0x1d49b9eeUL, 0x18070134UL, 0xb8ca30bbUL,
-0x15fe22e8UL, 0x83095788UL, 0x49620e75UL, 0x557e62daUL, 0xa8ff765eUL, 0x464553b1UL, 0x08de476dUL, 0xd4e7e9efUL};
-
+ 0x040cc97eUL, 0xb9746e2cUL, 0xdf660e9bUL, 0x117933a6UL, 0xff7f6ab8UL,
+ 0xf558d31dUL, 0x449ddd44UL, 0x7f163117UL,
+ 0xfaf1fb08UL, 0xcc11f5e7UL, 0x001b05d2UL, 0x00ba5a73UL, 0xd822b72aUL,
+ 0xcb816338UL, 0x3a24f6acUL, 0x7afdbe69UL,
+ 0x7fe7a2e6UL, 0xcd20c7f0UL, 0x164849c4UL, 0x80c1f5ccUL, 0x40168538UL,
+ 0x48a8b015UL, 0xcb188be6UL, 0xffdeaa4cUL,
+ 0x010a485fUL, 0xaab21204UL, 0xfc149825UL, 0xe2efd041UL, 0x8db4404eUL,
+ 0xfbb68e24UL, 0xfe1cba8dUL, 0x029ba941UL,
+ 0x040a551aUL, 0xcb658fbaUL, 0xe7f45172UL, 0x2517a595UL, 0xd7ec06c1UL,
+ 0x0a98a597UL, 0xaab939c5UL, 0x6afe794dUL,
+ 0x63f7f3f2UL, 0x4080af68UL, 0x569e0cedUL, 0x8b95b411UL, 0x885aebe1UL,
+ 0xb0e60987UL, 0x5671e0d7UL, 0xa7fe294eUL,
+ 0x2de56663UL, 0x00c0d102UL, 0x058eacc4UL, 0x71f57793UL, 0x2a37050cUL,
+ 0xf2358557UL, 0x02be6122UL, 0xc9a042d6UL,
+ 0x80a213dfUL, 0xd25bb574UL, 0xc0992168UL, 0xece521d4UL, 0xe83cfb53UL,
+ 0xb3edadc8UL, 0xc97fa828UL, 0x8199953dUL,
+ 0x00f91f5cUL, 0x99d338feUL, 0x0bff4e0cUL, 0xea072406UL, 0xb14f2faaUL,
+ 0x7669b94fUL, 0x0595c790UL, 0x74a7a8b0UL,
+ 0xffa155efUL, 0xc2a29ce5UL, 0x272db6a6UL, 0x63426ae6UL, 0x1f0065dfUL,
+ 0x6609c50eUL, 0xbc55dddfUL, 0x5506de29UL,
+ 0x9a731e91UL, 0x7589af17UL, 0x1c91c732UL, 0x6894f889UL, 0x80e9010dUL,
+ 0xf4554752UL, 0xc93cb603UL, 0xb244c80cUL,
+ 0xaaf0f3bcUL, 0xe936ac87UL, 0x26743ae5UL, 0x2bd8b301UL, 0x49749e1aUL,
+ 0x7e2dee64UL, 0xdab1dbcdUL, 0x1049c901UL,
+ 0x80bf68b8UL, 0xfdf3260dUL, 0xe7ed4293UL, 0x84c2a504UL, 0xb6376763UL,
+ 0x16b6f550UL, 0xe36647f2UL, 0xc136ca8eUL,
+ 0xdb056e13UL, 0x9183f1feUL, 0x377a88fbUL, 0xd4f7e7d6UL, 0xc97dfbc7UL,
+ 0xdffc6330UL, 0xde89f5b6UL, 0xda4129ecUL,
+ 0x9566e426UL, 0x196456b7UL, 0xc5ef54f6UL, 0xb7588dd0UL, 0x01549248UL,
+ 0x7fcbbac1UL, 0x0f55ffe5UL, 0x493008b6UL,
+ 0xe8d0b55bUL, 0x5a2ed787UL, 0xe16e6aabUL, 0xce663a22UL, 0xcdf32bc6UL,
+ 0xf985089eUL, 0x473ecb68UL, 0x0f016c08UL,
+ 0x20e81da2UL, 0xde698bd1UL, 0x7757f6f3UL, 0xf6c302faUL, 0xc3da7e40UL,
+ 0x50d5b3cbUL, 0x4d089317UL, 0xba0ed7b0UL,
+ 0xd578b30aUL, 0x0cfb51d9UL, 0x56dad7deUL, 0xe4bb2441UL, 0x560bca94UL,
+ 0xd155570fUL, 0x6ee5e1e0UL, 0xbeb58461UL,
+ 0x9f240a58UL, 0xc04bf794UL, 0x8e8827e3UL, 0x61557b9fUL, 0x8002dcc3UL,
+ 0x15776805UL, 0xd76b6c64UL, 0xb34d9044UL,
+ 0xa3f0b466UL, 0x8a64f1c0UL, 0xafd57e69UL, 0xf62fe949UL, 0x4f379e30UL,
+ 0x6a35b62cUL, 0x73858085UL, 0x40f89149UL,
+ 0x02aef076UL, 0x4de83b08UL, 0x9a1c4228UL, 0x06944844UL, 0xb84c6e73UL,
+ 0x102909c1UL, 0xc65fc98bUL, 0xf49c867dUL,
+ 0x6f614f13UL, 0x8d11772eUL, 0xe12b1bb3UL, 0x72b490aaUL, 0x17d7a53cUL,
+ 0xba1b167dUL, 0x1090ad9cUL, 0xa22b46afUL,
+ 0xd259e49fUL, 0x5945d345UL, 0x13daf2d9UL, 0x8754c6dbUL, 0x4ef9e4f3UL,
+ 0x6f486d17UL, 0xea137c09UL, 0xc7a51d63UL,
+ 0x82735f44UL, 0xf4835617UL, 0x976ac6cdUL, 0x8802be70UL, 0x72cfcdb3UL,
+ 0xf3d25d6eUL, 0x79609320UL, 0xa5809b45UL,
+ 0xdbe260beUL, 0x0131c2a9UL, 0x5c31a5ebUL, 0xf2424e22UL, 0x72155c1cUL,
+ 0x2c1b72f6UL, 0xf3ffd21aUL, 0x4e40258cUL,
+ 0x2fd74e32UL, 0xfdb76740UL, 0x8e132305UL, 0x78bca35cUL, 0x6ed60fdcUL,
+ 0x83229275UL, 0x176b4d78UL, 0x6eb1eb58UL,
+ 0x854f0944UL, 0x871d483fUL, 0x7baefefcUL, 0x76ffb577UL, 0xbf02238cUL,
+ 0x5675f4aaUL, 0x2ab0465fUL, 0x0128092bUL,
+ 0xf7f5383dUL, 0x361fa80cUL, 0x8a4aaf52UL, 0xc0e7d566UL, 0x74083bdfUL,
+ 0x10510595UL, 0xa8d75a1bUL, 0xadd51ef6UL,
+ 0x79e4f66cUL, 0x84817520UL, 0x65faced0UL, 0x58bef788UL, 0x2668044aUL,
+ 0xf3f8f60fUL, 0x707f9ca0UL, 0xa0ab4653UL,
+ 0x286ce95cUL, 0xa3ed76e1UL, 0x7f30ac6bUL, 0xd2296837UL, 0xa90f3685UL,
+ 0x2afee317UL, 0x6797b724UL, 0x206ba9f5UL,
+ 0x9525cdd6UL, 0xbf1eff68UL, 0x2c445575UL, 0xbe069ff1UL, 0x9a65e0f9UL,
+ 0x1d49b9eeUL, 0x18070134UL, 0xb8ca30bbUL,
+ 0x15fe22e8UL, 0x83095788UL, 0x49620e75UL, 0x557e62daUL, 0xa8ff765eUL,
+ 0x464553b1UL, 0x08de476dUL, 0xd4e7e9efUL };
const uint32_t s6[] PROGMEM = {
-0x9d8ffaf6UL, 0xe16cac2cUL, 0x6748a34cUL, 0x7c7f33e2UL, 0xe708db95UL, 0xb4436801UL, 0xbc5cedecUL, 0xac535532UL,
-0x60099fbfUL, 0xede2a1dfUL, 0x9d57f083UL, 0xb986ed63UL, 0xb8a6b61aUL, 0x39be5edeUL, 0x32f78ff3UL, 0x38b18989UL,
-0x6149f133UL, 0xbd3719c0UL, 0xdac606f5UL, 0x7e5e62e4UL, 0x99ea08a3UL, 0x3ce3234eUL, 0xccd7cb79UL, 0x6743a148UL,
-0x199614a3UL, 0xd54bc9feUL, 0x4a1714a1UL, 0x6618a0eaUL, 0x2ddb84a0UL, 0x6f48a809UL, 0x4a6188a8UL, 0x98af0029UL,
-0x91596601UL, 0x632899e1UL, 0x600cf3c8UL, 0x3cef782eUL, 0x3219d5d0UL, 0x14ec0fcfUL, 0xd207caf7UL, 0x7220a8d0UL,
-0x7e1941fdUL, 0xb0a60593UL, 0xdae36be8UL, 0xcdd3be74UL, 0x3ca52d37UL, 0x48447f4cUL, 0x40d4b5daUL, 0xc30eba6dUL,
-0xa7193908UL, 0xd9eeba9fUL, 0xb0cfdb49UL, 0x530c674eUL, 0x019c3d5cUL, 0x41b9bd64UL, 0x6a630e2cUL, 0xcdd97dbaUL,
-0x88736feaUL, 0x62c70be7UL, 0xdb9af235UL, 0x8ddd4c5cUL, 0x8c8dd4f0UL, 0xe25381b8UL, 0x6698a108UL, 0xc8eae21aUL,
-0x89af4c28UL, 0x238292aaUL, 0x53be3493UL, 0xbf213a3bUL, 0xe34b4316UL, 0x0639ea9aUL, 0x6ec3e8efUL, 0xd9cd90f8UL,
-0xae6d2280UL, 0xa3a440c3UL, 0x099c7edfUL, 0x07a894a6UL, 0xcc5e7c5bUL, 0xa6b31d22UL, 0x2fa0699aUL, 0x548a8168UL,
-0x6f29b2ceUL, 0x3a84c053UL, 0x553689feUL, 0x8ae6bf25UL, 0xbc8a62b4UL, 0xbf2e22cfUL, 0x486fac25UL, 0x8793a9a9UL,
-0x65dbbd53UL, 0xe7fb6fe7UL, 0x78fd67e9UL, 0x6335a90bUL, 0xc12b348eUL, 0xe91ba1e8UL, 0x0d748049UL, 0xfc7d08c8UL,
-0x99bfe48dUL, 0xa00111a1UL, 0x7579d37fUL, 0xc0265adaUL, 0x4f991fe8UL, 0x89cd2895UL, 0xed9f33fdUL, 0xbf3478b8UL,
-0x6d45045fUL, 0x98862522UL, 0x3bc8c4c9UL, 0xbe56c12dUL, 0xaa8d624fUL, 0xc55ef557UL, 0xbe0a22e2UL, 0xbf6e91d2UL,
-0x955bc74eUL, 0xc0c3f224UL, 0x995dd142UL, 0xa07f0dcdUL, 0xff276e7bUL, 0xf08adca8UL, 0x06c14573UL, 0x2f231ef4UL,
-0x86231635UL, 0x2689eae6UL, 0x94b03333UL, 0xf2c67e15UL, 0xaf742b37UL, 0xe4732569UL, 0x48d8a9e9UL, 0x890216f3UL,
-0x1def623aUL, 0x38e287a7UL, 0x76f6a5f3UL, 0x53483674UL, 0x63109520UL, 0x8d697645UL, 0x07d4fab6UL, 0x50f92a59UL,
-0x2335f736UL, 0x876efb4cUL, 0xc0cea47dUL, 0xaa2d156cUL, 0xa89603cbUL, 0x5dfe0dc5UL, 0xab07d7fcUL, 0x2fc42109UL,
-0xbbf0df89UL, 0x78bee25fUL, 0x334f8f44UL, 0xc9134675UL, 0x8dd0052bUL, 0x85d5b948UL, 0x419404dcUL, 0x9b8f09c8UL,
-0x86e7ed7dUL, 0x73339ac3UL, 0x05004142UL, 0x5117096aUL, 0xa6c8f30eUL, 0xd6720089UL, 0x82762028UL, 0xbef7a9a9UL,
-0x9d6732bfUL, 0x755b5bd4UL, 0x00fd53b3UL, 0x58e3b0cbUL, 0x0a220f83UL, 0x14b28f1fUL, 0x08cf72d3UL, 0x134a3cccUL,
-0x6631f68cUL, 0xbe871c06UL, 0x888fc988UL, 0x97e36260UL, 0x7a8ecf47UL, 0x8352c8b6UL, 0xfbacc23cUL, 0x7669c03fUL,
-0x52028f4eUL, 0x4d31d864UL, 0xe37038daUL, 0x5954661eUL, 0xf00809c1UL, 0xa5213051UL, 0xb7685b6cUL, 0xa08a2f82UL,
-0x3ecd0730UL, 0xef9e7174UL, 0x812687dcUL, 0xd4403307UL, 0xd92f437eUL, 0x41c25e0cUL, 0x6c280988UL, 0x91d892f5UL,
-0xf630a908UL, 0x05f37e95UL, 0xbdfffbb7UL, 0x6fe966c2UL, 0x98ace46fUL, 0xc0ec73b1UL, 0x2ab460bcUL, 0xda983495UL,
-0x12aea1fbUL, 0x36d74b2dUL, 0xabfa250fUL, 0xebfcf3a4UL, 0x239196e2UL, 0x3d0c7f25UL, 0x49af4893UL, 0xbc001436UL,
-0x4a6f81e8UL, 0x00f21438UL, 0x4340f9a3UL, 0xc2547a9cUL, 0x574f70bcUL, 0xf9e741daUL, 0x3ad35ac2UL, 0x84a0f454UL,
-0x05557fb1UL, 0xbe7c3559UL, 0xc815bdedUL, 0xabc5977fUL, 0xb5c75abaUL, 0xafdef6b6UL, 0x3a9c473aUL, 0x25da0253UL,
-0x6a7e3d65UL, 0x498d2654UL, 0xea77a451UL, 0x5bd51750UL, 0x885dd2d7UL, 0x766c1344UL, 0xc8a80404UL, 0x21a1e5b8UL,
-0x8a921ab8UL, 0x6958ed60UL, 0x965bc597UL, 0x1b99eceaUL, 0x13599329UL, 0xf1b7fd01UL, 0xfa8d8e08UL, 0xf5f6b69aUL,
-0x9fbf4c3bUL, 0xabe35d4aUL, 0x351d05e6UL, 0x55d8e1a0UL, 0xf14c6bd3UL, 0xebed44f5UL, 0x2435e9b0UL, 0xbd8fbbbeUL,
-0xcf62d7a2UL, 0x542fc949UL, 0x31f3b538UL, 0x54a42871UL, 0x05293948UL, 0xb81d5ba6UL, 0xbd971c85UL, 0x2fcf75d6UL};
-
+ 0x9d8ffaf6UL, 0xe16cac2cUL, 0x6748a34cUL, 0x7c7f33e2UL, 0xe708db95UL,
+ 0xb4436801UL, 0xbc5cedecUL, 0xac535532UL,
+ 0x60099fbfUL, 0xede2a1dfUL, 0x9d57f083UL, 0xb986ed63UL, 0xb8a6b61aUL,
+ 0x39be5edeUL, 0x32f78ff3UL, 0x38b18989UL,
+ 0x6149f133UL, 0xbd3719c0UL, 0xdac606f5UL, 0x7e5e62e4UL, 0x99ea08a3UL,
+ 0x3ce3234eUL, 0xccd7cb79UL, 0x6743a148UL,
+ 0x199614a3UL, 0xd54bc9feUL, 0x4a1714a1UL, 0x6618a0eaUL, 0x2ddb84a0UL,
+ 0x6f48a809UL, 0x4a6188a8UL, 0x98af0029UL,
+ 0x91596601UL, 0x632899e1UL, 0x600cf3c8UL, 0x3cef782eUL, 0x3219d5d0UL,
+ 0x14ec0fcfUL, 0xd207caf7UL, 0x7220a8d0UL,
+ 0x7e1941fdUL, 0xb0a60593UL, 0xdae36be8UL, 0xcdd3be74UL, 0x3ca52d37UL,
+ 0x48447f4cUL, 0x40d4b5daUL, 0xc30eba6dUL,
+ 0xa7193908UL, 0xd9eeba9fUL, 0xb0cfdb49UL, 0x530c674eUL, 0x019c3d5cUL,
+ 0x41b9bd64UL, 0x6a630e2cUL, 0xcdd97dbaUL,
+ 0x88736feaUL, 0x62c70be7UL, 0xdb9af235UL, 0x8ddd4c5cUL, 0x8c8dd4f0UL,
+ 0xe25381b8UL, 0x6698a108UL, 0xc8eae21aUL,
+ 0x89af4c28UL, 0x238292aaUL, 0x53be3493UL, 0xbf213a3bUL, 0xe34b4316UL,
+ 0x0639ea9aUL, 0x6ec3e8efUL, 0xd9cd90f8UL,
+ 0xae6d2280UL, 0xa3a440c3UL, 0x099c7edfUL, 0x07a894a6UL, 0xcc5e7c5bUL,
+ 0xa6b31d22UL, 0x2fa0699aUL, 0x548a8168UL,
+ 0x6f29b2ceUL, 0x3a84c053UL, 0x553689feUL, 0x8ae6bf25UL, 0xbc8a62b4UL,
+ 0xbf2e22cfUL, 0x486fac25UL, 0x8793a9a9UL,
+ 0x65dbbd53UL, 0xe7fb6fe7UL, 0x78fd67e9UL, 0x6335a90bUL, 0xc12b348eUL,
+ 0xe91ba1e8UL, 0x0d748049UL, 0xfc7d08c8UL,
+ 0x99bfe48dUL, 0xa00111a1UL, 0x7579d37fUL, 0xc0265adaUL, 0x4f991fe8UL,
+ 0x89cd2895UL, 0xed9f33fdUL, 0xbf3478b8UL,
+ 0x6d45045fUL, 0x98862522UL, 0x3bc8c4c9UL, 0xbe56c12dUL, 0xaa8d624fUL,
+ 0xc55ef557UL, 0xbe0a22e2UL, 0xbf6e91d2UL,
+ 0x955bc74eUL, 0xc0c3f224UL, 0x995dd142UL, 0xa07f0dcdUL, 0xff276e7bUL,
+ 0xf08adca8UL, 0x06c14573UL, 0x2f231ef4UL,
+ 0x86231635UL, 0x2689eae6UL, 0x94b03333UL, 0xf2c67e15UL, 0xaf742b37UL,
+ 0xe4732569UL, 0x48d8a9e9UL, 0x890216f3UL,
+ 0x1def623aUL, 0x38e287a7UL, 0x76f6a5f3UL, 0x53483674UL, 0x63109520UL,
+ 0x8d697645UL, 0x07d4fab6UL, 0x50f92a59UL,
+ 0x2335f736UL, 0x876efb4cUL, 0xc0cea47dUL, 0xaa2d156cUL, 0xa89603cbUL,
+ 0x5dfe0dc5UL, 0xab07d7fcUL, 0x2fc42109UL,
+ 0xbbf0df89UL, 0x78bee25fUL, 0x334f8f44UL, 0xc9134675UL, 0x8dd0052bUL,
+ 0x85d5b948UL, 0x419404dcUL, 0x9b8f09c8UL,
+ 0x86e7ed7dUL, 0x73339ac3UL, 0x05004142UL, 0x5117096aUL, 0xa6c8f30eUL,
+ 0xd6720089UL, 0x82762028UL, 0xbef7a9a9UL,
+ 0x9d6732bfUL, 0x755b5bd4UL, 0x00fd53b3UL, 0x58e3b0cbUL, 0x0a220f83UL,
+ 0x14b28f1fUL, 0x08cf72d3UL, 0x134a3cccUL,
+ 0x6631f68cUL, 0xbe871c06UL, 0x888fc988UL, 0x97e36260UL, 0x7a8ecf47UL,
+ 0x8352c8b6UL, 0xfbacc23cUL, 0x7669c03fUL,
+ 0x52028f4eUL, 0x4d31d864UL, 0xe37038daUL, 0x5954661eUL, 0xf00809c1UL,
+ 0xa5213051UL, 0xb7685b6cUL, 0xa08a2f82UL,
+ 0x3ecd0730UL, 0xef9e7174UL, 0x812687dcUL, 0xd4403307UL, 0xd92f437eUL,
+ 0x41c25e0cUL, 0x6c280988UL, 0x91d892f5UL,
+ 0xf630a908UL, 0x05f37e95UL, 0xbdfffbb7UL, 0x6fe966c2UL, 0x98ace46fUL,
+ 0xc0ec73b1UL, 0x2ab460bcUL, 0xda983495UL,
+ 0x12aea1fbUL, 0x36d74b2dUL, 0xabfa250fUL, 0xebfcf3a4UL, 0x239196e2UL,
+ 0x3d0c7f25UL, 0x49af4893UL, 0xbc001436UL,
+ 0x4a6f81e8UL, 0x00f21438UL, 0x4340f9a3UL, 0xc2547a9cUL, 0x574f70bcUL,
+ 0xf9e741daUL, 0x3ad35ac2UL, 0x84a0f454UL,
+ 0x05557fb1UL, 0xbe7c3559UL, 0xc815bdedUL, 0xabc5977fUL, 0xb5c75abaUL,
+ 0xafdef6b6UL, 0x3a9c473aUL, 0x25da0253UL,
+ 0x6a7e3d65UL, 0x498d2654UL, 0xea77a451UL, 0x5bd51750UL, 0x885dd2d7UL,
+ 0x766c1344UL, 0xc8a80404UL, 0x21a1e5b8UL,
+ 0x8a921ab8UL, 0x6958ed60UL, 0x965bc597UL, 0x1b99eceaUL, 0x13599329UL,
+ 0xf1b7fd01UL, 0xfa8d8e08UL, 0xf5f6b69aUL,
+ 0x9fbf4c3bUL, 0xabe35d4aUL, 0x351d05e6UL, 0x55d8e1a0UL, 0xf14c6bd3UL,
+ 0xebed44f5UL, 0x2435e9b0UL, 0xbd8fbbbeUL,
+ 0xcf62d7a2UL, 0x542fc949UL, 0x31f3b538UL, 0x54a42871UL, 0x05293948UL,
+ 0xb81d5ba6UL, 0xbd971c85UL, 0x2fcf75d6UL };
const uint32_t s7[] PROGMEM = {
-0x1940e085UL, 0x67f52b33UL, 0xffbf2d66UL, 0x9356c6cfUL, 0x6f7f8d2aUL, 0x12c99babUL, 0xa10860deUL, 0x1fda2820UL,
-0xe7bc2702UL, 0x1629644dUL, 0x00c3fa18UL, 0x828bf150UL, 0x11cbb22cUL, 0x5ce732b2UL, 0xf295364bUL, 0xde0787b2UL,
-0xf6bc5fa0UL, 0xe98141cdUL, 0x0c2150e1UL, 0xbdf14ee2UL, 0x81c368b1UL, 0x89e7e4fdUL, 0xd8b0795cUL, 0x43fd8b1eUL,
-0x0150494dUL, 0x4143be38UL, 0x1dee3c91UL, 0x3f9ca792UL, 0xbe669708UL, 0xf4adeebaUL, 0xcfbe8612UL, 0x19cbeab6UL,
-0x00c26026UL, 0xe4bd6575UL, 0x7a1f2464UL, 0xa9dc4882UL, 0x66adb3c3UL, 0x86601328UL, 0xa8dfd80bUL, 0xf21c6d35UL,
-0xbe897710UL, 0xcee9b2b3UL, 0x8faa0205UL, 0x1e35c00bUL, 0x2af56b16UL, 0x82ff12ebUL, 0x116948e3UL, 0x16754dd3UL,
-0xff3a7b4eUL, 0x1b67435fUL, 0x37e0f69cUL, 0x83ac8149UL, 0xce664233UL, 0xb741938cUL, 0xc054d8d0UL, 0x886c3acbUL,
-0x2928bc47UL, 0x37ba2547UL, 0x2bd26aa6UL, 0x1e1fd67aUL, 0xfaba5c0cUL, 0x07f13744UL, 0x6299e7b6UL, 0x16d8d242UL,
-0x8812960aUL, 0x6ec0a5e1UL, 0x679e7413UL, 0x1a08fc72UL, 0xf739d1b1UL, 0x453758f9UL, 0x58df19cfUL, 0x56f7c3beUL,
-0x30ba6ec0UL, 0x241b2107UL, 0x2988c245UL, 0x7f315ec9UL, 0x11c58ebcUL, 0xe946bc38UL, 0x14fae6c6UL, 0x4a58e8baUL,
-0x46bc4eadUL, 0x8b508f46UL, 0x5f432978UL, 0x3b1824f1UL, 0x9fba1d82UL, 0xf40ff6afUL, 0x6d4e2ceaUL, 0x6492e316UL,
-0x8b4a5492UL, 0xc34f9b00UL, 0xed8ca6abUL, 0x786fc99aUL, 0x9ab7a506UL, 0x6e6e85b2UL, 0xa93cec1aUL, 0x888683beUL,
-0xe904080eUL, 0x56bef155UL, 0x3b36e5e7UL, 0x5df2a1b3UL, 0x85bbdef7UL, 0x3c03fe61UL, 0x33627416UL, 0x284c033cUL,
-0x740c6ddaUL, 0x6cc5aa79UL, 0xade1e43cUL, 0x02c8f051UL, 0x5af3f898UL, 0x9fa42616UL, 0x292bd8eeUL, 0xe32f381dUL,
-0x9ab94f0cUL, 0x785732bbUL, 0x7bd9c63eUL, 0xa9a6776eUL, 0x5c8b65cbUL, 0xc73052d4UL, 0x8b40d12bUL, 0xb73ec060UL,
-0x788d06b9UL, 0xf45437a3UL, 0x7dc830f4UL, 0x0213a7c8UL, 0x328c6db9UL, 0xbee7d4ebUL, 0x2d9d8bbeUL, 0x06fb7979UL,
-0x085322e7UL, 0x77cf758bUL, 0xa48def11UL, 0x58c883e0UL, 0x6f786b8dUL, 0xa617635aUL, 0xa0f75cfaUL, 0x3300da5dUL,
-0xb0bf8ef2UL, 0x10c3b9f5UL, 0x80c2eaa0UL, 0x7a76b908UL, 0xb0d2d9a3UL, 0x1742d379UL, 0x8d711a02UL, 0x6a33c69aUL,
-0x60fd1127UL, 0xe3508043UL, 0xa8089906UL, 0xc4ed7f3dUL, 0xef2b6d82UL, 0x7684eb4eUL, 0x25cf8d48UL, 0x66d5c936UL,
-0x414ee728UL, 0xca0a61c2UL, 0xcfa9493dUL, 0xdfb9e3baUL, 0xe68d5fb6UL, 0x64afae92UL, 0xe6d5c73aUL, 0x0905a89eUL,
-0x7d012bf2UL, 0x703f17a4UL, 0xc3161eddUL, 0xf9d7e015UL, 0x87b8b150UL, 0xd54f9f2bUL, 0x82ba5a62UL, 0x6279016aUL,
-0x9c1bc02eUL, 0xa98a4815UL, 0x40e716d7UL, 0x2c5a0540UL, 0x229ad293UL, 0x9abf2de3UL, 0xb9458705UL, 0x1edc5334UL,
-0x6e2999d6UL, 0x6fff6c49UL, 0x86499f1cUL, 0x07ede2dfUL, 0xd14272b8UL, 0xae7ede19UL, 0x1a563e05UL, 0x8c6fad15UL,
-0x1c6c6266UL, 0x4cc25471UL, 0x2a2b08eaUL, 0x3929eb93UL, 0xf0b0dc17UL, 0xaef2d458UL, 0xfb94a29eUL, 0x4c56cf52UL,
-0x66fe8398UL, 0x8105c42eUL, 0xc3533976UL, 0x2e69d601UL, 0x08c1a0d3UL, 0x0e16e7a1UL, 0xa6dff2e4UL, 0x85d23e69UL,
-0x98469074UL, 0xdd0e2b4cUL, 0x5676754fUL, 0x7833395dUL, 0x4f2332a1UL, 0x5d1c323dUL, 0x94e1f5c3UL, 0x0193264bUL,
-0x2f029fc7UL, 0x7e7e993cUL, 0x04954f5eUL, 0xbdfbfa3fUL, 0x0eadf776UL, 0xf4936629UL, 0x6fce1f3dUL, 0xbe451ec6UL,
-0x34abb5d3UL, 0xb7f92bf7UL, 0xc034041bUL, 0x67b5724eUL, 0x3da39255UL, 0x019322b5UL, 0x7fa8d2cfUL, 0x67b7ae60UL,
-0x6b381418UL, 0x3dc3bc30UL, 0x7dc0a038UL, 0xf20616fdUL, 0x9b5163c3UL, 0x90d39d58UL, 0xe6f87954UL, 0x47d6b81cUL,
-0xa961fd97UL, 0xf45977eaUL, 0x9d53572dUL, 0xcf589a56UL, 0xad634ee8UL, 0x781b2e46UL, 0x7ef88065UL, 0x147981f3UL,
-0xf455da91UL, 0xf330a240UL, 0x358f98d1UL, 0xd218e3b6UL, 0xbc50fa3fUL, 0x21f0403dUL, 0xaebdc0c3UL, 0x4cc25849UL,
-0xb2368f51UL, 0x70d3b184UL, 0x83ceed0fUL, 0xdada8d87UL, 0xc779a2f2UL, 0xe81be094UL, 0x4b6f7190UL, 0xa38a4b95UL};
-
+ 0x1940e085UL, 0x67f52b33UL, 0xffbf2d66UL, 0x9356c6cfUL, 0x6f7f8d2aUL,
+ 0x12c99babUL, 0xa10860deUL, 0x1fda2820UL,
+ 0xe7bc2702UL, 0x1629644dUL, 0x00c3fa18UL, 0x828bf150UL, 0x11cbb22cUL,
+ 0x5ce732b2UL, 0xf295364bUL, 0xde0787b2UL,
+ 0xf6bc5fa0UL, 0xe98141cdUL, 0x0c2150e1UL, 0xbdf14ee2UL, 0x81c368b1UL,
+ 0x89e7e4fdUL, 0xd8b0795cUL, 0x43fd8b1eUL,
+ 0x0150494dUL, 0x4143be38UL, 0x1dee3c91UL, 0x3f9ca792UL, 0xbe669708UL,
+ 0xf4adeebaUL, 0xcfbe8612UL, 0x19cbeab6UL,
+ 0x00c26026UL, 0xe4bd6575UL, 0x7a1f2464UL, 0xa9dc4882UL, 0x66adb3c3UL,
+ 0x86601328UL, 0xa8dfd80bUL, 0xf21c6d35UL,
+ 0xbe897710UL, 0xcee9b2b3UL, 0x8faa0205UL, 0x1e35c00bUL, 0x2af56b16UL,
+ 0x82ff12ebUL, 0x116948e3UL, 0x16754dd3UL,
+ 0xff3a7b4eUL, 0x1b67435fUL, 0x37e0f69cUL, 0x83ac8149UL, 0xce664233UL,
+ 0xb741938cUL, 0xc054d8d0UL, 0x886c3acbUL,
+ 0x2928bc47UL, 0x37ba2547UL, 0x2bd26aa6UL, 0x1e1fd67aUL, 0xfaba5c0cUL,
+ 0x07f13744UL, 0x6299e7b6UL, 0x16d8d242UL,
+ 0x8812960aUL, 0x6ec0a5e1UL, 0x679e7413UL, 0x1a08fc72UL, 0xf739d1b1UL,
+ 0x453758f9UL, 0x58df19cfUL, 0x56f7c3beUL,
+ 0x30ba6ec0UL, 0x241b2107UL, 0x2988c245UL, 0x7f315ec9UL, 0x11c58ebcUL,
+ 0xe946bc38UL, 0x14fae6c6UL, 0x4a58e8baUL,
+ 0x46bc4eadUL, 0x8b508f46UL, 0x5f432978UL, 0x3b1824f1UL, 0x9fba1d82UL,
+ 0xf40ff6afUL, 0x6d4e2ceaUL, 0x6492e316UL,
+ 0x8b4a5492UL, 0xc34f9b00UL, 0xed8ca6abUL, 0x786fc99aUL, 0x9ab7a506UL,
+ 0x6e6e85b2UL, 0xa93cec1aUL, 0x888683beUL,
+ 0xe904080eUL, 0x56bef155UL, 0x3b36e5e7UL, 0x5df2a1b3UL, 0x85bbdef7UL,
+ 0x3c03fe61UL, 0x33627416UL, 0x284c033cUL,
+ 0x740c6ddaUL, 0x6cc5aa79UL, 0xade1e43cUL, 0x02c8f051UL, 0x5af3f898UL,
+ 0x9fa42616UL, 0x292bd8eeUL, 0xe32f381dUL,
+ 0x9ab94f0cUL, 0x785732bbUL, 0x7bd9c63eUL, 0xa9a6776eUL, 0x5c8b65cbUL,
+ 0xc73052d4UL, 0x8b40d12bUL, 0xb73ec060UL,
+ 0x788d06b9UL, 0xf45437a3UL, 0x7dc830f4UL, 0x0213a7c8UL, 0x328c6db9UL,
+ 0xbee7d4ebUL, 0x2d9d8bbeUL, 0x06fb7979UL,
+ 0x085322e7UL, 0x77cf758bUL, 0xa48def11UL, 0x58c883e0UL, 0x6f786b8dUL,
+ 0xa617635aUL, 0xa0f75cfaUL, 0x3300da5dUL,
+ 0xb0bf8ef2UL, 0x10c3b9f5UL, 0x80c2eaa0UL, 0x7a76b908UL, 0xb0d2d9a3UL,
+ 0x1742d379UL, 0x8d711a02UL, 0x6a33c69aUL,
+ 0x60fd1127UL, 0xe3508043UL, 0xa8089906UL, 0xc4ed7f3dUL, 0xef2b6d82UL,
+ 0x7684eb4eUL, 0x25cf8d48UL, 0x66d5c936UL,
+ 0x414ee728UL, 0xca0a61c2UL, 0xcfa9493dUL, 0xdfb9e3baUL, 0xe68d5fb6UL,
+ 0x64afae92UL, 0xe6d5c73aUL, 0x0905a89eUL,
+ 0x7d012bf2UL, 0x703f17a4UL, 0xc3161eddUL, 0xf9d7e015UL, 0x87b8b150UL,
+ 0xd54f9f2bUL, 0x82ba5a62UL, 0x6279016aUL,
+ 0x9c1bc02eUL, 0xa98a4815UL, 0x40e716d7UL, 0x2c5a0540UL, 0x229ad293UL,
+ 0x9abf2de3UL, 0xb9458705UL, 0x1edc5334UL,
+ 0x6e2999d6UL, 0x6fff6c49UL, 0x86499f1cUL, 0x07ede2dfUL, 0xd14272b8UL,
+ 0xae7ede19UL, 0x1a563e05UL, 0x8c6fad15UL,
+ 0x1c6c6266UL, 0x4cc25471UL, 0x2a2b08eaUL, 0x3929eb93UL, 0xf0b0dc17UL,
+ 0xaef2d458UL, 0xfb94a29eUL, 0x4c56cf52UL,
+ 0x66fe8398UL, 0x8105c42eUL, 0xc3533976UL, 0x2e69d601UL, 0x08c1a0d3UL,
+ 0x0e16e7a1UL, 0xa6dff2e4UL, 0x85d23e69UL,
+ 0x98469074UL, 0xdd0e2b4cUL, 0x5676754fUL, 0x7833395dUL, 0x4f2332a1UL,
+ 0x5d1c323dUL, 0x94e1f5c3UL, 0x0193264bUL,
+ 0x2f029fc7UL, 0x7e7e993cUL, 0x04954f5eUL, 0xbdfbfa3fUL, 0x0eadf776UL,
+ 0xf4936629UL, 0x6fce1f3dUL, 0xbe451ec6UL,
+ 0x34abb5d3UL, 0xb7f92bf7UL, 0xc034041bUL, 0x67b5724eUL, 0x3da39255UL,
+ 0x019322b5UL, 0x7fa8d2cfUL, 0x67b7ae60UL,
+ 0x6b381418UL, 0x3dc3bc30UL, 0x7dc0a038UL, 0xf20616fdUL, 0x9b5163c3UL,
+ 0x90d39d58UL, 0xe6f87954UL, 0x47d6b81cUL,
+ 0xa961fd97UL, 0xf45977eaUL, 0x9d53572dUL, 0xcf589a56UL, 0xad634ee8UL,
+ 0x781b2e46UL, 0x7ef88065UL, 0x147981f3UL,
+ 0xf455da91UL, 0xf330a240UL, 0x358f98d1UL, 0xd218e3b6UL, 0xbc50fa3fUL,
+ 0x21f0403dUL, 0xaebdc0c3UL, 0x4cc25849UL,
+ 0xb2368f51UL, 0x70d3b184UL, 0x83ceed0fUL, 0xdada8d87UL, 0xc779a2f2UL,
+ 0xe81be094UL, 0x4b6f7190UL, 0xa38a4b95UL };
const uint32_t s8[] PROGMEM = {
-0x0d3016e2UL, 0xfcffddbbUL, 0xbddaeba7UL, 0x95806435UL, 0xb7f88977UL, 0x1b12c1e6UL, 0x0016240eUL, 0xb5e82c05UL,
-0xb0cfa911UL, 0x112f95e5UL, 0x0a99e7ecUL, 0x74d18693UL, 0x1c93422aUL, 0x1181e376UL, 0x3aef2db1UL, 0xfcdddd37UL,
-0xb1de9adeUL, 0x2cc30c0aUL, 0x297019beUL, 0x4009a084UL, 0x0f3a24bbUL, 0xcf37d1b4UL, 0xf0794eb4UL, 0xfded9e04UL,
-0x5da1150bUL, 0x68310d48UL, 0x5adebb8bUL, 0x42ed9d66UL, 0x31e8ecc7UL, 0xe7958f3fUL, 0x1b19df72UL, 0x0d338075UL,
-0x51420794UL, 0xfacd7d5cUL, 0x636dbeabUL, 0x642140aaUL, 0x0ad401b3UL, 0xcad1e702UL, 0xae1d5753UL, 0xa282317aUL,
-0xecdda812UL, 0x5d33aafdUL, 0xe8436f17UL, 0xd446fb71UL, 0x22901238UL, 0xd49a94ceUL, 0xad6947b8UL, 0x62d85b96UL,
-0x55d0f382UL, 0x6797fb66UL, 0x4e0bb815UL, 0xa0475b1dUL, 0x6fe0fd4cUL, 0xb8c48ec2UL, 0x6e72e857UL, 0xfc787a64UL,
-0x445d8699UL, 0x93d58b60UL, 0x030e206cUL, 0xf65fdc39UL, 0xa3000b5dUL, 0xf2af63aeUL, 0x32d68b7eUL, 0x0c8c1070UL,
-0x4950d3bbUL, 0x04df9829UL, 0x2af40c98UL, 0x91f46d9bUL, 0x53dd7e9eUL, 0x48859106UL, 0x077ecb58UL, 0x2eef743bUL,
-0xb1ff2f52UL, 0xcc0847d2UL, 0xcd277e1cUL, 0x5b21eba4UL, 0xe2d2f13cUL, 0x387ab419UL, 0x18764f42UL, 0x39608535UL,
-0xe7de179dUL, 0xe635eb27UL, 0x7bf6afc9UL, 0xb8f5ba36UL, 0xcd67c409UL, 0xb11089c1UL, 0x7bbf1de1UL, 0xf81acd06UL,
-0x08c67071UL, 0x54335e2dUL, 0x5a49ded4UL, 0x06d0c664UL, 0x2cc6c0bcUL, 0xb30dd03dUL, 0x348f8f70UL, 0x421bd577UL,
-0x0f624f26UL, 0xbfd2b824UL, 0x9eb7c115UL, 0x6425a546UL, 0x4ee5d7f8UL, 0x6081373eUL, 0xa5cd9578UL, 0xa5159c85UL,
-0x889745e6UL, 0x5fc77bc3UL, 0x0cba07dbUL, 0xaba37606UL, 0x1e9b227fUL, 0x7b2e8431UL, 0xd79f2524UL, 0x72f4bef8UL,
-0xb8fc5f83UL, 0xf2c1f46dUL, 0x95b1f596UL, 0xfcf00afdUL, 0x4c13feb0UL, 0x3d6d50e2UL, 0xea129b4fUL, 0x25f215f2UL,
-0x6f7323a2UL, 0x28c4b49fUL, 0x7949d025UL, 0xf813c734UL, 0x878161c4UL, 0x986e7aeaUL, 0xfc6ed17cUL, 0x6c873614UL,
-0x074154f1UL, 0x14eedebeUL, 0x27afe956UL, 0x41a44aa0UL, 0x99c8f73cUL, 0xe6baec92UL, 0x6d0167ddUL, 0xeb821615UL,
-0xdfee42a8UL, 0xb460bafdUL, 0x757b90f1UL, 0x0f03e320UL, 0x9ec2d824UL, 0x3b6739e1UL, 0xb83fa6efUL, 0x54308771UL,
-0x3bcff2b6UL, 0x4264329fUL, 0xcca415cbUL, 0x04451ab0UL, 0x8d7de4f1UL, 0xe51b4a84UL, 0xdcdfe7baUL, 0x70dacb42UL,
-0x0aae7dcdUL, 0x7a5be857UL, 0xf65a3fd5UL, 0x8c4dcf20UL, 0x28d4a4ceUL, 0xa430d179UL, 0xfbeb8634UL, 0xdccdd333UL,
-0x533b8577UL, 0xb5fcef37UL, 0x788706c5UL, 0xe6b380e5UL, 0xf4b8684eUL, 0x7eb3c8c5UL, 0xa29e800dUL, 0x7ceb8f39UL,
-0x944f2a13UL, 0x0e95b743UL, 0x1c7dee2fUL, 0xbd133622UL, 0xa2ca06ddUL, 0x2b93df37UL, 0x898224c4UL, 0xc3ebf3acUL,
-0xb7f61557UL, 0xdd7834efUL, 0x6f6167f2UL, 0xe4cb48c1UL, 0x5e815290UL, 0xab0f415eUL, 0x65248ab4UL, 0xa47fda2eUL,
-0xe4407be8UL, 0x84a08ee9UL, 0xe1e98958UL, 0xfc90d3efUL, 0x5bd307ddUL, 0x945648dbUL, 0xb2e5d738UL, 0x01017257UL,
-0xbcde0e73UL, 0x1331645bUL, 0x4f7e9194UL, 0xba2f3c50UL, 0x82126f64UL, 0x4ad22375UL, 0x959677e0UL, 0x8f7ac1f9UL,
-0x21215b7aUL, 0x96b887d1UL, 0x4d3a2629UL, 0xdf0c51baUL, 0x9f7cf481UL, 0xed6311adUL, 0x65597beaUL, 0x6e72001aUL,
-0x92304011UL, 0x776dda00UL, 0x61dd0c4aUL, 0x03461fadUL, 0xb0df5b60UL, 0x64c3ed9eUL, 0xa8e6eb22UL, 0x8ad2e7ceUL,
-0xa036e7a0UL, 0xb9a66455UL, 0x09328510UL, 0x378febc7UL, 0xca05e72dUL, 0x0f575189UL, 0x2b8209dfUL, 0x6c1a69bdUL,
-0xf2e412aaUL, 0x0f1c4587UL, 0x7aa2f6e0UL, 0x1948da3aUL, 0x4f76f14cUL, 0x2b1c770dUL, 0x56b1cd67UL, 0x84830d35UL,
-0x0ffa3859UL, 0xf39e3942UL, 0x077b9936UL, 0x3d09840eUL, 0x613ea94aUL, 0x7bd86083UL, 0x0c8ba91fUL, 0x2c384911UL,
-0xa52576e9UL, 0xb7d11406UL, 0x4b24250eUL, 0x4783760cUL, 0x828d9e58UL, 0xd159200dUL, 0x1ebb66a4UL, 0x820adaf8UL,
-0x3091f104UL, 0xc04e6ebaUL, 0x64512699UL, 0x0d23e71eUL, 0x80adb250UL, 0x0168eeeaUL, 0x83a2b28dUL, 0x9ef58beaUL};
-
+ 0x0d3016e2UL, 0xfcffddbbUL, 0xbddaeba7UL, 0x95806435UL, 0xb7f88977UL,
+ 0x1b12c1e6UL, 0x0016240eUL, 0xb5e82c05UL,
+ 0xb0cfa911UL, 0x112f95e5UL, 0x0a99e7ecUL, 0x74d18693UL, 0x1c93422aUL,
+ 0x1181e376UL, 0x3aef2db1UL, 0xfcdddd37UL,
+ 0xb1de9adeUL, 0x2cc30c0aUL, 0x297019beUL, 0x4009a084UL, 0x0f3a24bbUL,
+ 0xcf37d1b4UL, 0xf0794eb4UL, 0xfded9e04UL,
+ 0x5da1150bUL, 0x68310d48UL, 0x5adebb8bUL, 0x42ed9d66UL, 0x31e8ecc7UL,
+ 0xe7958f3fUL, 0x1b19df72UL, 0x0d338075UL,
+ 0x51420794UL, 0xfacd7d5cUL, 0x636dbeabUL, 0x642140aaUL, 0x0ad401b3UL,
+ 0xcad1e702UL, 0xae1d5753UL, 0xa282317aUL,
+ 0xecdda812UL, 0x5d33aafdUL, 0xe8436f17UL, 0xd446fb71UL, 0x22901238UL,
+ 0xd49a94ceUL, 0xad6947b8UL, 0x62d85b96UL,
+ 0x55d0f382UL, 0x6797fb66UL, 0x4e0bb815UL, 0xa0475b1dUL, 0x6fe0fd4cUL,
+ 0xb8c48ec2UL, 0x6e72e857UL, 0xfc787a64UL,
+ 0x445d8699UL, 0x93d58b60UL, 0x030e206cUL, 0xf65fdc39UL, 0xa3000b5dUL,
+ 0xf2af63aeUL, 0x32d68b7eUL, 0x0c8c1070UL,
+ 0x4950d3bbUL, 0x04df9829UL, 0x2af40c98UL, 0x91f46d9bUL, 0x53dd7e9eUL,
+ 0x48859106UL, 0x077ecb58UL, 0x2eef743bUL,
+ 0xb1ff2f52UL, 0xcc0847d2UL, 0xcd277e1cUL, 0x5b21eba4UL, 0xe2d2f13cUL,
+ 0x387ab419UL, 0x18764f42UL, 0x39608535UL,
+ 0xe7de179dUL, 0xe635eb27UL, 0x7bf6afc9UL, 0xb8f5ba36UL, 0xcd67c409UL,
+ 0xb11089c1UL, 0x7bbf1de1UL, 0xf81acd06UL,
+ 0x08c67071UL, 0x54335e2dUL, 0x5a49ded4UL, 0x06d0c664UL, 0x2cc6c0bcUL,
+ 0xb30dd03dUL, 0x348f8f70UL, 0x421bd577UL,
+ 0x0f624f26UL, 0xbfd2b824UL, 0x9eb7c115UL, 0x6425a546UL, 0x4ee5d7f8UL,
+ 0x6081373eUL, 0xa5cd9578UL, 0xa5159c85UL,
+ 0x889745e6UL, 0x5fc77bc3UL, 0x0cba07dbUL, 0xaba37606UL, 0x1e9b227fUL,
+ 0x7b2e8431UL, 0xd79f2524UL, 0x72f4bef8UL,
+ 0xb8fc5f83UL, 0xf2c1f46dUL, 0x95b1f596UL, 0xfcf00afdUL, 0x4c13feb0UL,
+ 0x3d6d50e2UL, 0xea129b4fUL, 0x25f215f2UL,
+ 0x6f7323a2UL, 0x28c4b49fUL, 0x7949d025UL, 0xf813c734UL, 0x878161c4UL,
+ 0x986e7aeaUL, 0xfc6ed17cUL, 0x6c873614UL,
+ 0x074154f1UL, 0x14eedebeUL, 0x27afe956UL, 0x41a44aa0UL, 0x99c8f73cUL,
+ 0xe6baec92UL, 0x6d0167ddUL, 0xeb821615UL,
+ 0xdfee42a8UL, 0xb460bafdUL, 0x757b90f1UL, 0x0f03e320UL, 0x9ec2d824UL,
+ 0x3b6739e1UL, 0xb83fa6efUL, 0x54308771UL,
+ 0x3bcff2b6UL, 0x4264329fUL, 0xcca415cbUL, 0x04451ab0UL, 0x8d7de4f1UL,
+ 0xe51b4a84UL, 0xdcdfe7baUL, 0x70dacb42UL,
+ 0x0aae7dcdUL, 0x7a5be857UL, 0xf65a3fd5UL, 0x8c4dcf20UL, 0x28d4a4ceUL,
+ 0xa430d179UL, 0xfbeb8634UL, 0xdccdd333UL,
+ 0x533b8577UL, 0xb5fcef37UL, 0x788706c5UL, 0xe6b380e5UL, 0xf4b8684eUL,
+ 0x7eb3c8c5UL, 0xa29e800dUL, 0x7ceb8f39UL,
+ 0x944f2a13UL, 0x0e95b743UL, 0x1c7dee2fUL, 0xbd133622UL, 0xa2ca06ddUL,
+ 0x2b93df37UL, 0x898224c4UL, 0xc3ebf3acUL,
+ 0xb7f61557UL, 0xdd7834efUL, 0x6f6167f2UL, 0xe4cb48c1UL, 0x5e815290UL,
+ 0xab0f415eUL, 0x65248ab4UL, 0xa47fda2eUL,
+ 0xe4407be8UL, 0x84a08ee9UL, 0xe1e98958UL, 0xfc90d3efUL, 0x5bd307ddUL,
+ 0x945648dbUL, 0xb2e5d738UL, 0x01017257UL,
+ 0xbcde0e73UL, 0x1331645bUL, 0x4f7e9194UL, 0xba2f3c50UL, 0x82126f64UL,
+ 0x4ad22375UL, 0x959677e0UL, 0x8f7ac1f9UL,
+ 0x21215b7aUL, 0x96b887d1UL, 0x4d3a2629UL, 0xdf0c51baUL, 0x9f7cf481UL,
+ 0xed6311adUL, 0x65597beaUL, 0x6e72001aUL,
+ 0x92304011UL, 0x776dda00UL, 0x61dd0c4aUL, 0x03461fadUL, 0xb0df5b60UL,
+ 0x64c3ed9eUL, 0xa8e6eb22UL, 0x8ad2e7ceUL,
+ 0xa036e7a0UL, 0xb9a66455UL, 0x09328510UL, 0x378febc7UL, 0xca05e72dUL,
+ 0x0f575189UL, 0x2b8209dfUL, 0x6c1a69bdUL,
+ 0xf2e412aaUL, 0x0f1c4587UL, 0x7aa2f6e0UL, 0x1948da3aUL, 0x4f76f14cUL,
+ 0x2b1c770dUL, 0x56b1cd67UL, 0x84830d35UL,
+ 0x0ffa3859UL, 0xf39e3942UL, 0x077b9936UL, 0x3d09840eUL, 0x613ea94aUL,
+ 0x7bd86083UL, 0x0c8ba91fUL, 0x2c384911UL,
+ 0xa52576e9UL, 0xb7d11406UL, 0x4b24250eUL, 0x4783760cUL, 0x828d9e58UL,
+ 0xd159200dUL, 0x1ebb66a4UL, 0x820adaf8UL,
+ 0x3091f104UL, 0xc04e6ebaUL, 0x64512699UL, 0x0d23e71eUL, 0x80adb250UL,
+ 0x0168eeeaUL, 0x83a2b28dUL, 0x9ef58beaUL };
#endif
-
#endif
/* cast5-sbox.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/*
* File: cast5-sbox.h
* Author: Daniel Otte
* Description: sboxes for CAST5 (aka CAST-128) cipher algorithm as described in RFC 2144.
*
*/
-
+
#ifndef CAST5_SBOX_H_
#define CAST5_SBOX_H_
/* cast5.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/*
* \file cast5.c
* \author Daniel Otte
* \brief Implementation of the CAST5 (aka CAST-128) cipher algorithm as described in RFC 2144
*
*/
-
+
#include <stdint.h>
#include <string.h>
#include "cast5.h"
#include <avr/pgmspace.h>
#undef DEBUG
-
+
#ifdef DEBUG
- #include "cli.h"
+#include "cli.h"
#endif
-
-#include "cast5-sbox.h"
+#include "cast5-sbox.h"
-
#define S5(x) pgm_read_dword(&s5[(x)])
#define S6(x) pgm_read_dword(&s6[(x)])
#define S7(x) pgm_read_dword(&s7[(x)])
#define S8(x) pgm_read_dword(&s8[(x)])
-static
-void cast5_init_A(uint8_t *dest, uint8_t *src, bool bmode){
- uint8_t mask = bmode?0x8:0;
- *((uint32_t*)(&dest[0x0])) = *((uint32_t*)(&src[0x0^mask]))
- ^ S5(src[0xD^mask]) ^ S6(src[0xF^mask])
- ^ S7(src[0xC^mask]) ^ S8(src[0xE^mask])
- ^ S7(src[0x8^mask]);
- *((uint32_t*)(&dest[0x4])) = *((uint32_t*)(&src[0x8^mask]))
- ^ S5(dest[0x0]) ^ S6(dest[0x2])
- ^ S7(dest[0x1]) ^ S8(dest[0x3])
- ^ S8(src[0xA^mask]);
- *((uint32_t*)(&dest[0x8])) = *((uint32_t*)(&src[0xC^mask]))
- ^ S5(dest[0x7]) ^ S6(dest[0x6])
- ^ S7(dest[0x5]) ^ S8(dest[0x4])
- ^ S5(src[0x9^mask]);
- *((uint32_t*)(&dest[0xC])) = *((uint32_t*)(&src[0x4^mask]))
- ^ S5(dest[0xA])
- ^ S6(dest[0x9])
- ^ S7(dest[0xB])
- ^ S8(dest[0x8])
- ^ S6(src[0xB^mask]);
+static
+void cast5_init_A(uint8_t *dest, uint8_t *src, bool bmode)
+{
+ uint8_t mask = bmode ? 0x8 : 0;
+ *((uint32_t*) (&dest[0x0])) = *((uint32_t*) (&src[0x0 ^ mask]))
+ ^ S5(src[0xD ^ mask]) ^ S6(src[0xF ^ mask])
+ ^ S7(src[0xC ^ mask]) ^ S8(src[0xE ^ mask])
+ ^ S7(src[0x8 ^ mask]);
+ *((uint32_t*) (&dest[0x4])) = *((uint32_t*) (&src[0x8 ^ mask]))
+ ^ S5(dest[0x0]) ^ S6(dest[0x2])
+ ^ S7(dest[0x1]) ^ S8(dest[0x3])
+ ^ S8(src[0xA ^ mask]);
+ *((uint32_t*) (&dest[0x8])) = *((uint32_t*) (&src[0xC ^ mask]))
+ ^ S5(dest[0x7]) ^ S6(dest[0x6])
+ ^ S7(dest[0x5]) ^ S8(dest[0x4])
+ ^ S5(src[0x9 ^ mask]);
+ *((uint32_t*) (&dest[0xC])) = *((uint32_t*) (&src[0x4 ^ mask]))
+ ^ S5(dest[0xA])
+ ^ S6(dest[0x9])
+ ^ S7(dest[0xB])
+ ^ S8(dest[0x8])
+ ^ S6(src[0xB ^ mask]);
}
static
-void cast5_init_M(uint8_t *dest, uint8_t *src, bool nmode, bool xmode){
- uint8_t nmt[] = {0xB, 0xA, 0x9, 0x8,
- 0xF, 0xE, 0xD, 0xC,
- 0x3, 0x2, 0x1, 0x0,
- 0x7, 0x6, 0x5, 0x4}; /* nmode table */
- uint8_t xmt[4][4] = {{0x2, 0x6, 0x9, 0xC},
- {0x8, 0xD, 0x3, 0x7},
- {0x3, 0x7, 0x8, 0xD},
- {0x9, 0xC, 0x2, 0x6}};
- #define NMT(x) (src[nmode?nmt[(x)]:(x)])
- #define XMT(x) (src[xmt[(xmode<<1) + nmode][(x)]])
- *((uint32_t*)(&dest[0x0])) = S5(NMT(0x8)) ^ S6(NMT(0x9)) ^ S7(NMT(0x7)) ^ S8(NMT(0x6)) ^ S5(XMT(0));
- *((uint32_t*)(&dest[0x4])) = S5(NMT(0xA)) ^ S6(NMT(0xB)) ^ S7(NMT(0x5)) ^ S8(NMT(0x4)) ^ S6(XMT(1));
- *((uint32_t*)(&dest[0x8])) = S5(NMT(0xC)) ^ S6(NMT(0xD)) ^ S7(NMT(0x3)) ^ S8(NMT(0x2)) ^ S7(XMT(2));
- *((uint32_t*)(&dest[0xC])) = S5(NMT(0xE)) ^ S6(NMT(0xF)) ^ S7(NMT(0x1)) ^ S8(NMT(0x0)) ^ S8(XMT(3));
+void cast5_init_M(uint8_t *dest, uint8_t *src, bool nmode, bool xmode)
+{
+ uint8_t nmt[] = { 0xB, 0xA, 0x9, 0x8,
+ 0xF, 0xE, 0xD, 0xC,
+ 0x3, 0x2, 0x1, 0x0,
+ 0x7, 0x6, 0x5, 0x4 }; /* nmode table */
+ uint8_t xmt[4][4] = { { 0x2, 0x6, 0x9, 0xC },
+ { 0x8, 0xD, 0x3, 0x7 },
+ { 0x3, 0x7, 0x8, 0xD },
+ { 0x9, 0xC, 0x2, 0x6 } };
+#define NMT(x) (src[nmode?nmt[(x)]:(x)])
+#define XMT(x) (src[xmt[(xmode<<1) + nmode][(x)]])
+ *((uint32_t*) (&dest[0x0])) =
+ S5(NMT(0x8)) ^ S6(NMT(0x9)) ^ S7(NMT(0x7)) ^ S8(NMT(0x6)) ^ S5(XMT(0));
+ *((uint32_t*) (&dest[0x4])) =
+ S5(NMT(0xA)) ^ S6(NMT(0xB)) ^ S7(NMT(0x5)) ^ S8(NMT(0x4)) ^ S6(XMT(1));
+ *((uint32_t*) (&dest[0x8])) =
+ S5(NMT(0xC)) ^ S6(NMT(0xD)) ^ S7(NMT(0x3)) ^ S8(NMT(0x2)) ^ S7(XMT(2));
+ *((uint32_t*) (&dest[0xC])) =
+ S5(NMT(0xE)) ^ S6(NMT(0xF)) ^ S7(NMT(0x1)) ^ S8(NMT(0x0)) ^ S8(XMT(3));
}
#define S5B(x) pgm_read_byte(3+(uint8_t*)(&s5[(x)]))
#define S8B(x) pgm_read_byte(3+(uint8_t*)(&s8[(x)]))
static
-void cast5_init_rM(uint8_t *klo, uint8_t *khi, uint8_t offset, uint8_t *src, bool nmode, bool xmode){
- uint8_t nmt[] = {0xB, 0xA, 0x9, 0x8, 0xF, 0xE, 0xD, 0xC, 0x3, 0x2, 0x1, 0x0, 0x7, 0x6, 0x5, 0x4}; /* nmode table */
- uint8_t xmt[4][4] = {{0x2, 0x6, 0x9, 0xC}, {0x8, 0xD, 0x3, 0x7}, {0x3, 0x7, 0x8, 0xD}, {0x9, 0xC, 0x2, 0x6}};
- uint8_t t, h=0;
- t = S5B(NMT(0x8)) ^ S6B(NMT(0x9)) ^ S7B(NMT(0x7)) ^ S8B(NMT(0x6)) ^ S5B(XMT(0));
- klo[offset*2] |= (t & 0x0f);
- h |= (t&0x10); h>>=1;
- t = S5B(NMT(0xA)) ^ S6B(NMT(0xB)) ^ S7B(NMT(0x5)) ^ S8B(NMT(0x4)) ^ S6B(XMT(1));
- klo[offset*2] |= (t<<4) & 0xf0;
- h |= t&0x10; h>>=1;
- t = S5B(NMT(0xC)) ^ S6B(NMT(0xD)) ^ S7B(NMT(0x3)) ^ S8B(NMT(0x2)) ^ S7B(XMT(2));
- klo[offset*2+1] |= t&0xf;
- h |= t&0x10; h>>=1;
- t = S5B(NMT(0xE)) ^ S6B(NMT(0xF)) ^ S7B(NMT(0x1)) ^ S8B(NMT(0x0)) ^ S8B(XMT(3));
- klo[offset*2+1] |= t<<4;
- h |= t&0x10; h >>=1;
- #ifdef DEBUG
- cli_putstr("\r\n\t h="); cli_hexdump(&h,1);
- #endif
- khi[offset>>1] |= h<<((offset&0x1)?4:0);
+void cast5_init_rM(uint8_t *klo, uint8_t *khi, uint8_t offset, uint8_t *src,
+ bool nmode, bool xmode)
+{
+ uint8_t nmt[] = { 0xB, 0xA, 0x9, 0x8, 0xF, 0xE, 0xD, 0xC, 0x3, 0x2, 0x1,
+ 0x0, 0x7, 0x6, 0x5, 0x4 }; /* nmode table */
+ uint8_t xmt[4][4] = { { 0x2, 0x6, 0x9, 0xC }, { 0x8, 0xD, 0x3, 0x7 }, { 0x3,
+ 0x7, 0x8, 0xD }, { 0x9, 0xC, 0x2, 0x6 } };
+ uint8_t t, h = 0;
+ t =
+ S5B(NMT(0x8)) ^ S6B(NMT(0x9)) ^ S7B(NMT(0x7)) ^ S8B(NMT(0x6)) ^ S5B(XMT(0));
+ klo[offset * 2] |= (t & 0x0f);
+ h |= (t & 0x10);
+ h >>= 1;
+ t =
+ S5B(NMT(0xA)) ^ S6B(NMT(0xB)) ^ S7B(NMT(0x5)) ^ S8B(NMT(0x4)) ^ S6B(XMT(1));
+ klo[offset * 2] |= (t << 4) & 0xf0;
+ h |= t & 0x10;
+ h >>= 1;
+ t =
+ S5B(NMT(0xC)) ^ S6B(NMT(0xD)) ^ S7B(NMT(0x3)) ^ S8B(NMT(0x2)) ^ S7B(XMT(2));
+ klo[offset * 2 + 1] |= t & 0xf;
+ h |= t & 0x10;
+ h >>= 1;
+ t =
+ S5B(NMT(0xE)) ^ S6B(NMT(0xF)) ^ S7B(NMT(0x1)) ^ S8B(NMT(0x0)) ^ S8B(XMT(3));
+ klo[offset * 2 + 1] |= t << 4;
+ h |= t & 0x10;
+ h >>= 1;
+#ifdef DEBUG
+ cli_putstr("\r\n\t h="); cli_hexdump(&h,1);
+#endif
+ khi[offset >> 1] |= h << ((offset & 0x1) ? 4 : 0);
}
#define S_5X(s) pgm_read_dword(&s5[BPX[(s)]])
#define S_7Z(s) pgm_read_dword(&s7[BPZ[(s)]])
#define S_8Z(s) pgm_read_dword(&s8[BPZ[(s)]])
-
-
-
-void cast5_init(const void *key, uint16_t keylength_b, cast5_ctx_t *s){
- /* we migth return if the key is valid and if setup was successful */
- uint32_t x[4], z[4];
- #define BPX ((uint8_t*)&(x[0]))
- #define BPZ ((uint8_t*)&(z[0]))
- s->shortkey = (keylength_b<=80);
- /* littel endian only! */
- memset(&(x[0]), 0 ,16); /* set x to zero */
- if(keylength_b > 128)
- keylength_b=128;
- memcpy(&(x[0]), key, (keylength_b+7)/8);
-
-
- /* todo: merge a and b and compress the whole stuff */
- /***** A *****/
- cast5_init_A((uint8_t*)(&z[0]), (uint8_t*)(&x[0]), false);
- /***** M *****/
- cast5_init_M((uint8_t*)(&(s->mask[0])), (uint8_t*)(&z[0]), false, false);
- /***** B *****/
- cast5_init_A((uint8_t*)(&x[0]), (uint8_t*)(&z[0]), true);
- /***** N *****/
- cast5_init_M((uint8_t*)(&(s->mask[4])), (uint8_t*)(&x[0]), true, false);
- /***** A *****/
- cast5_init_A((uint8_t*)(&z[0]), (uint8_t*)(&x[0]), false);
- /***** N' *****/
- cast5_init_M((uint8_t*)(&(s->mask[8])), (uint8_t*)(&z[0]), true, true);
- /***** B *****/
- cast5_init_A((uint8_t*)(&x[0]), (uint8_t*)(&z[0]), true);
- /***** M' *****/
- cast5_init_M((uint8_t*)(&(s->mask[12])), (uint8_t*)(&x[0]), false, true);
-
- /* that were the masking keys, now the rotation keys */
- /* set the keys to zero */
- memset(&(s->rotl[0]),0,8);
- s->roth[0]=s->roth[1]=0;
- /***** A *****/
- cast5_init_A((uint8_t*)(&z[0]), (uint8_t*)(&x[0]), false);
- /***** M *****/
- cast5_init_rM(&(s->rotl[0]), &(s->roth[0]), 0, (uint8_t*)(&z[0]), false, false);
- /***** B *****/
- cast5_init_A((uint8_t*)(&x[0]), (uint8_t*)(&z[0]), true);
- /***** N *****/
- cast5_init_rM(&(s->rotl[0]), &(s->roth[0]), 1, (uint8_t*)(&x[0]), true, false);
- /***** A *****/
- cast5_init_A((uint8_t*)(&z[0]), (uint8_t*)(&x[0]), false);
- /***** N' *****/
- cast5_init_rM(&(s->rotl[0]), &(s->roth[0]), 2, (uint8_t*)(&z[0]), true, true);
- /***** B *****/
- cast5_init_A((uint8_t*)(&x[0]), (uint8_t*)(&z[0]), true);
- /***** M' *****/
- cast5_init_rM(&(s->rotl[0]), &(s->roth[0]), 3, (uint8_t*)(&x[0]), false, true);
- /* done ;-) */
+void cast5_init(const void *key, uint16_t keylength_b, cast5_ctx_t *s)
+{
+ /* we migth return if the key is valid and if setup was successful */
+ uint32_t x[4], z[4];
+#define BPX ((uint8_t*)&(x[0]))
+#define BPZ ((uint8_t*)&(z[0]))
+ s->shortkey = (keylength_b <= 80);
+ /* littel endian only! */
+ memset(&(x[0]), 0, 16); /* set x to zero */
+ if (keylength_b > 128)
+ keylength_b = 128;
+ memcpy(&(x[0]), key, (keylength_b + 7) / 8);
+
+ /* todo: merge a and b and compress the whole stuff */
+ /***** A *****/
+ cast5_init_A((uint8_t*) (&z[0]), (uint8_t*) (&x[0]), false);
+ /***** M *****/
+ cast5_init_M((uint8_t*) (&(s->mask[0])), (uint8_t*) (&z[0]), false, false);
+ /***** B *****/
+ cast5_init_A((uint8_t*) (&x[0]), (uint8_t*) (&z[0]), true);
+ /***** N *****/
+ cast5_init_M((uint8_t*) (&(s->mask[4])), (uint8_t*) (&x[0]), true, false);
+ /***** A *****/
+ cast5_init_A((uint8_t*) (&z[0]), (uint8_t*) (&x[0]), false);
+ /***** N' *****/
+ cast5_init_M((uint8_t*) (&(s->mask[8])), (uint8_t*) (&z[0]), true, true);
+ /***** B *****/
+ cast5_init_A((uint8_t*) (&x[0]), (uint8_t*) (&z[0]), true);
+ /***** M' *****/
+ cast5_init_M((uint8_t*) (&(s->mask[12])), (uint8_t*) (&x[0]), false, true);
+
+ /* that were the masking keys, now the rotation keys */
+ /* set the keys to zero */
+ memset(&(s->rotl[0]), 0, 8);
+ s->roth[0] = s->roth[1] = 0;
+ /***** A *****/
+ cast5_init_A((uint8_t*) (&z[0]), (uint8_t*) (&x[0]), false);
+ /***** M *****/
+ cast5_init_rM(&(s->rotl[0]), &(s->roth[0]), 0, (uint8_t*) (&z[0]), false, false);
+ /***** B *****/
+ cast5_init_A((uint8_t*) (&x[0]), (uint8_t*) (&z[0]), true);
+ /***** N *****/
+ cast5_init_rM(&(s->rotl[0]), &(s->roth[0]), 1, (uint8_t*) (&x[0]), true, false);
+ /***** A *****/
+ cast5_init_A((uint8_t*) (&z[0]), (uint8_t*) (&x[0]), false);
+ /***** N' *****/
+ cast5_init_rM(&(s->rotl[0]), &(s->roth[0]), 2, (uint8_t*) (&z[0]), true, true);
+ /***** B *****/
+ cast5_init_A((uint8_t*) (&x[0]), (uint8_t*) (&z[0]), true);
+ /***** M' *****/
+ cast5_init_rM(&(s->rotl[0]), &(s->roth[0]), 3, (uint8_t*) (&x[0]), false, true);
+ /* done ;-) */
}
-
-
/********************************************************************************************************/
#define ROTL32(a,n) ((a)<<(n) | (a)>>(32-(n)))
#define CHANGE_ENDIAN32(x) ((x)<<24 | (x)>>24 | ((x)&0xff00)<<8 | ((x)&0xff0000)>>8 )
-typedef uint32_t cast5_f_t(uint32_t,uint32_t,uint8_t);
+typedef uint32_t cast5_f_t(uint32_t, uint32_t, uint8_t);
#define IA 3
#define IB 2
#define IC 1
#define ID 0
-static
-uint32_t cast5_f1(uint32_t d, uint32_t m, uint8_t r){
- uint32_t t;
- t = ROTL32((d + m),r);
+static uint32_t cast5_f1(uint32_t d, uint32_t m, uint8_t r)
+{
+ uint32_t t;
+ t = ROTL32((d + m), r);
#ifdef DEBUG
- uint32_t ia,ib,ic,id;
- cli_putstr("\r\n f1("); cli_hexdump(&d, 4); cli_putc(',');
- cli_hexdump(&m , 4); cli_putc(','); cli_hexdump(&r, 1);cli_putstr("): I=");
- cli_hexdump(&t, 4);
- ia = pgm_read_dword(&s1[((uint8_t*)&t)[IA]] );
- ib = pgm_read_dword(&s2[((uint8_t*)&t)[IB]] );
- ic = pgm_read_dword(&s3[((uint8_t*)&t)[IC]] );
- id = pgm_read_dword(&s4[((uint8_t*)&t)[ID]] );
- cli_putstr("\r\n\tIA="); cli_hexdump(&ia, 4);
- cli_putstr("\r\n\tIB="); cli_hexdump(&ib, 4);
- cli_putstr("\r\n\tIC="); cli_hexdump(&ic, 4);
- cli_putstr("\r\n\tID="); cli_hexdump(&id, 4);
-
- return (((ia ^ ib) - ic) + id);
+ uint32_t ia,ib,ic,id;
+ cli_putstr("\r\n f1("); cli_hexdump(&d, 4); cli_putc(',');
+ cli_hexdump(&m , 4); cli_putc(','); cli_hexdump(&r, 1);cli_putstr("): I=");
+ cli_hexdump(&t, 4);
+ ia = pgm_read_dword(&s1[((uint8_t*)&t)[IA]] );
+ ib = pgm_read_dword(&s2[((uint8_t*)&t)[IB]] );
+ ic = pgm_read_dword(&s3[((uint8_t*)&t)[IC]] );
+ id = pgm_read_dword(&s4[((uint8_t*)&t)[ID]] );
+ cli_putstr("\r\n\tIA="); cli_hexdump(&ia, 4);
+ cli_putstr("\r\n\tIB="); cli_hexdump(&ib, 4);
+ cli_putstr("\r\n\tIC="); cli_hexdump(&ic, 4);
+ cli_putstr("\r\n\tID="); cli_hexdump(&id, 4);
+
+ return (((ia ^ ib) - ic) + id);
#else
-
- return ((( pgm_read_dword(&s1[((uint8_t*)&t)[IA]])
- ^ pgm_read_dword(&s2[((uint8_t*)&t)[IB]]) )
- - pgm_read_dword(&s3[((uint8_t*)&t)[IC]]) )
- + pgm_read_dword(&s4[((uint8_t*)&t)[ID]]) );
+
+ return ((( pgm_read_dword(&s1[((uint8_t*)&t)[IA]])
+ ^ pgm_read_dword(&s2[((uint8_t*)&t)[IB]]))
+ - pgm_read_dword(&s3[((uint8_t*)&t)[IC]]))
+ + pgm_read_dword(&s4[((uint8_t*)&t)[ID]]));
#endif
}
-static
-uint32_t cast5_f2(uint32_t d, uint32_t m, uint8_t r){
- uint32_t t;
- t = ROTL32((d ^ m),r);
+static uint32_t cast5_f2(uint32_t d, uint32_t m, uint8_t r)
+{
+ uint32_t t;
+ t = ROTL32((d ^ m), r);
#ifdef DEBUG
- uint32_t ia,ib,ic,id;
- cli_putstr("\r\n f2("); cli_hexdump(&d, 4); cli_putc(',');
- cli_hexdump(&m , 4); cli_putc(','); cli_hexdump(&r, 1);cli_putstr("): I=");
- cli_hexdump(&t, 4);
-
- ia = pgm_read_dword(&s1[((uint8_t*)&t)[IA]] );
- ib = pgm_read_dword(&s2[((uint8_t*)&t)[IB]] );
- ic = pgm_read_dword(&s3[((uint8_t*)&t)[IC]] );
- id = pgm_read_dword(&s4[((uint8_t*)&t)[ID]] );
-
- cli_putstr("\r\n\tIA="); cli_hexdump(&ia, 4);
- cli_putstr("\r\n\tIB="); cli_hexdump(&ib, 4);
- cli_putstr("\r\n\tIC="); cli_hexdump(&ic, 4);
- cli_putstr("\r\n\tID="); cli_hexdump(&id, 4);
-
- return (((ia - ib) + ic) ^ id);
+ uint32_t ia,ib,ic,id;
+ cli_putstr("\r\n f2("); cli_hexdump(&d, 4); cli_putc(',');
+ cli_hexdump(&m , 4); cli_putc(','); cli_hexdump(&r, 1);cli_putstr("): I=");
+ cli_hexdump(&t, 4);
+
+ ia = pgm_read_dword(&s1[((uint8_t*)&t)[IA]] );
+ ib = pgm_read_dword(&s2[((uint8_t*)&t)[IB]] );
+ ic = pgm_read_dword(&s3[((uint8_t*)&t)[IC]] );
+ id = pgm_read_dword(&s4[((uint8_t*)&t)[ID]] );
+
+ cli_putstr("\r\n\tIA="); cli_hexdump(&ia, 4);
+ cli_putstr("\r\n\tIB="); cli_hexdump(&ib, 4);
+ cli_putstr("\r\n\tIC="); cli_hexdump(&ic, 4);
+ cli_putstr("\r\n\tID="); cli_hexdump(&id, 4);
+
+ return (((ia - ib) + ic) ^ id);
#else
-
- return ((( pgm_read_dword(&s1[((uint8_t*)&t)[IA]])
- - pgm_read_dword(&s2[((uint8_t*)&t)[IB]]) )
- + pgm_read_dword(&s3[((uint8_t*)&t)[IC]]) )
- ^ pgm_read_dword(&s4[((uint8_t*)&t)[ID]]) );
+
+ return ((( pgm_read_dword(&s1[((uint8_t*)&t)[IA]])
+ - pgm_read_dword(&s2[((uint8_t*)&t)[IB]]))
+ + pgm_read_dword(&s3[((uint8_t*)&t)[IC]]))
+ ^ pgm_read_dword(&s4[((uint8_t*)&t)[ID]]));
#endif
}
-static
-uint32_t cast5_f3(uint32_t d, uint32_t m, uint8_t r){
- uint32_t t;
- t = ROTL32((m - d),r);
+static uint32_t cast5_f3(uint32_t d, uint32_t m, uint8_t r)
+{
+ uint32_t t;
+ t = ROTL32((m - d), r);
#ifdef DEBUG
- uint32_t ia,ib,ic,id;
-
- cli_putstr("\r\n f3("); cli_hexdump(&d, 4); cli_putc(',');
- cli_hexdump(&m , 4); cli_putc(','); cli_hexdump(&r, 1);cli_putstr("): I=");
- cli_hexdump(&t, 4);
-
- ia = pgm_read_dword(&s1[((uint8_t*)&t)[IA]] );
- ib = pgm_read_dword(&s2[((uint8_t*)&t)[IB]] );
- ic = pgm_read_dword(&s3[((uint8_t*)&t)[IC]] );
- id = pgm_read_dword(&s4[((uint8_t*)&t)[ID]] );
-
- cli_putstr("\r\n\tIA="); cli_hexdump(&ia, 4);
- cli_putstr("\r\n\tIB="); cli_hexdump(&ib, 4);
- cli_putstr("\r\n\tIC="); cli_hexdump(&ic, 4);
- cli_putstr("\r\n\tID="); cli_hexdump(&id, 4);
- return (((ia + ib) ^ ic) - id);
+ uint32_t ia,ib,ic,id;
+
+ cli_putstr("\r\n f3("); cli_hexdump(&d, 4); cli_putc(',');
+ cli_hexdump(&m , 4); cli_putc(','); cli_hexdump(&r, 1);cli_putstr("): I=");
+ cli_hexdump(&t, 4);
+
+ ia = pgm_read_dword(&s1[((uint8_t*)&t)[IA]] );
+ ib = pgm_read_dword(&s2[((uint8_t*)&t)[IB]] );
+ ic = pgm_read_dword(&s3[((uint8_t*)&t)[IC]] );
+ id = pgm_read_dword(&s4[((uint8_t*)&t)[ID]] );
+
+ cli_putstr("\r\n\tIA="); cli_hexdump(&ia, 4);
+ cli_putstr("\r\n\tIB="); cli_hexdump(&ib, 4);
+ cli_putstr("\r\n\tIC="); cli_hexdump(&ic, 4);
+ cli_putstr("\r\n\tID="); cli_hexdump(&id, 4);
+ return (((ia + ib) ^ ic) - id);
#else
- return (( pgm_read_dword(&s1[((uint8_t*)&t)[IA]] )
- + pgm_read_dword(&s2[((uint8_t*)&t)[IB]] ))
- ^ pgm_read_dword(&s3[((uint8_t*)&t)[IC]] ))
- - pgm_read_dword(&s4[((uint8_t*)&t)[ID]] );
+ return (( pgm_read_dword(&s1[((uint8_t*)&t)[IA]] )
+ + pgm_read_dword(&s2[((uint8_t*)&t)[IB]]))
+ ^ pgm_read_dword(&s3[((uint8_t*)&t)[IC]]))
+ - pgm_read_dword(&s4[((uint8_t*)&t)[ID]]);
#endif
}
/******************************************************************************/
-void cast5_enc(void *block, const cast5_ctx_t *s){
- uint32_t l,r, x, y;
- uint8_t i;
- cast5_f_t *f[]={cast5_f1,cast5_f2,cast5_f3};
- l=((uint32_t*)block)[0];
- r=((uint32_t*)block)[1];
+void cast5_enc(void *block, const cast5_ctx_t *s)
+{
+ uint32_t l, r, x, y;
+ uint8_t i;
+ cast5_f_t *f[] = { cast5_f1, cast5_f2, cast5_f3 };
+ l = ((uint32_t*) block)[0];
+ r = ((uint32_t*) block)[1];
// cli_putstr("\r\n round[-1] = ");
// cli_hexdump(&r, 4);
- for (i=0;i<(s->shortkey?12:16);++i){
- x = r;
- y = (f[i%3])(CHANGE_ENDIAN32(r), CHANGE_ENDIAN32(s->mask[i]),
- (((s->roth[i>>3]) & (1<<(i&0x7)))?0x10:0x00)
- + ( ((s->rotl[i>>1])>>((i&1)?4:0)) & 0x0f) );
- r = l ^ CHANGE_ENDIAN32(y);
+ for (i = 0; i < (s->shortkey ? 12 : 16); ++i) {
+ x = r;
+ y = (f[i % 3])(CHANGE_ENDIAN32(r), CHANGE_ENDIAN32(s->mask[i]),
+ (((s->roth[i >> 3]) & (1 << (i & 0x7))) ? 0x10 : 0x00)
+ + (((s->rotl[i >> 1]) >> ((i & 1) ? 4 : 0)) & 0x0f));
+ r = l ^ CHANGE_ENDIAN32(y);
// cli_putstr("\r\n round["); DEBUG_B(i); cli_putstr("] = ");
// cli_hexdump(&r, 4);
- l = x;
- }
- ((uint32_t*)block)[0]=r;
- ((uint32_t*)block)[1]=l;
+ l = x;
+ }
+ ((uint32_t*) block)[0] = r;
+ ((uint32_t*) block)[1] = l;
}
/******************************************************************************/
-void cast5_dec(void *block, const cast5_ctx_t *s){
- uint32_t l,r, x, y;
- int8_t i, rounds;
- cast5_f_t *f[]={cast5_f1,cast5_f2,cast5_f3};
- l=((uint32_t*)block)[0];
- r=((uint32_t*)block)[1];
- rounds = (s->shortkey?12:16);
- for (i=rounds-1; i>=0 ;--i){
- x = r;
- y = (f[i%3])(CHANGE_ENDIAN32(r), CHANGE_ENDIAN32(s->mask[i]),
- (((s->roth[i>>3]) & (1<<(i&0x7)))?0x10:0x00)
- + ( ((s->rotl[i>>1])>>((i&1)?4:0)) & 0x0f) );
- r = l ^ CHANGE_ENDIAN32(y);
- l = x;
- }
- ((uint32_t*)block)[0]=r;
- ((uint32_t*)block)[1]=l;
+void cast5_dec(void *block, const cast5_ctx_t *s)
+{
+ uint32_t l, r, x, y;
+ int8_t i, rounds;
+ cast5_f_t *f[] = { cast5_f1, cast5_f2, cast5_f3 };
+ l = ((uint32_t*) block)[0];
+ r = ((uint32_t*) block)[1];
+ rounds = (s->shortkey ? 12 : 16);
+ for (i = rounds - 1; i >= 0; --i) {
+ x = r;
+ y = (f[i % 3])(CHANGE_ENDIAN32(r), CHANGE_ENDIAN32(s->mask[i]),
+ (((s->roth[i >> 3]) & (1 << (i & 0x7))) ? 0x10 : 0x00)
+ + (((s->rotl[i >> 1]) >> ((i & 1) ? 4 : 0)) & 0x0f));
+ r = l ^ CHANGE_ENDIAN32(y);
+ l = x;
+ }
+ ((uint32_t*) block)[0] = r;
+ ((uint32_t*) block)[1] = l;
}
-
/******************************************************************************/
-
-
-
/* cast5.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file cast5.h
* \author Daniel Otte
#ifndef BOOL
#define BOOL
- #ifndef __BOOL
- #define __BOOL
- #ifndef __BOOL__
- #define __BOOL__
- typedef enum{false=0,true=1} bool;
- #endif
- #endif
+#ifndef __BOOL
+#define __BOOL
+#ifndef __BOOL__
+#define __BOOL__
+typedef enum {
+ false = 0, true = 1
+} bool;
+#endif
+#endif
#endif
/** \typedef cast5_ctx_t
* This context is regulary generated by the
* cast5_init(uint8_t *key, uint8_t keylength_b, cast5_ctx_t *s) function.
*/
-typedef struct cast5_ctx_st{
- uint32_t mask[16];
- uint8_t rotl[8]; /* 4 bit from every rotation key is stored here */
- uint8_t roth[2]; /* 1 bit from every rotation key is stored here */
- bool shortkey;
+typedef struct cast5_ctx_st {
+ uint32_t mask[16];
+ uint8_t rotl[8]; /* 4 bit from every rotation key is stored here */
+ uint8_t roth[2]; /* 1 bit from every rotation key is stored here */
+ bool shortkey;
} cast5_ctx_t;
-
/** \fn void cast5_init(const void *key, uint16_t keylength_b, cast5_ctx_t *s);
* \brief generate keyschedule/contex for CAST-5
*
*/
void cast5_dec(void *block, const cast5_ctx_t *s);
-
-
#endif
/* cast6-sbox.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/*
* File: cast6-sbox.c
* Author: Daniel Otte
* Description: sboxes for CAST6 (aka CAST-256) cipher algorithm as described in RFC 2612.
*
*/
-
+
#include <avr/pgmspace.h>
#include <stdint.h>
#ifndef BIG_ENDIAN
const uint32_t s1[] PROGMEM = {
-0x30fb40d4UL, 0x9fa0ff0bUL, 0x6beccd2fUL, 0x3f258c7aUL, 0x1e213f2fUL, 0x9c004dd3UL, 0x6003e540UL, 0xcf9fc949UL,
-0xbfd4af27UL, 0x88bbbdb5UL, 0xe2034090UL, 0x98d09675UL, 0x6e63a0e0UL, 0x15c361d2UL, 0xc2e7661dUL, 0x22d4ff8eUL,
-0x28683b6fUL, 0xc07fd059UL, 0xff2379c8UL, 0x775f50e2UL, 0x43c340d3UL, 0xdf2f8656UL, 0x887ca41aUL, 0xa2d2bd2dUL,
-0xa1c9e0d6UL, 0x346c4819UL, 0x61b76d87UL, 0x22540f2fUL, 0x2abe32e1UL, 0xaa54166bUL, 0x22568e3aUL, 0xa2d341d0UL,
-0x66db40c8UL, 0xa784392fUL, 0x004dff2fUL, 0x2db9d2deUL, 0x97943facUL, 0x4a97c1d8UL, 0x527644b7UL, 0xb5f437a7UL,
-0xb82cbaefUL, 0xd751d159UL, 0x6ff7f0edUL, 0x5a097a1fUL, 0x827b68d0UL, 0x90ecf52eUL, 0x22b0c054UL, 0xbc8e5935UL,
-0x4b6d2f7fUL, 0x50bb64a2UL, 0xd2664910UL, 0xbee5812dUL, 0xb7332290UL, 0xe93b159fUL, 0xb48ee411UL, 0x4bff345dUL,
-0xfd45c240UL, 0xad31973fUL, 0xc4f6d02eUL, 0x55fc8165UL, 0xd5b1caadUL, 0xa1ac2daeUL, 0xa2d4b76dUL, 0xc19b0c50UL,
-0x882240f2UL, 0x0c6e4f38UL, 0xa4e4bfd7UL, 0x4f5ba272UL, 0x564c1d2fUL, 0xc59c5319UL, 0xb949e354UL, 0xb04669feUL,
-0xb1b6ab8aUL, 0xc71358ddUL, 0x6385c545UL, 0x110f935dUL, 0x57538ad5UL, 0x6a390493UL, 0xe63d37e0UL, 0x2a54f6b3UL,
-0x3a787d5fUL, 0x6276a0b5UL, 0x19a6fcdfUL, 0x7a42206aUL, 0x29f9d4d5UL, 0xf61b1891UL, 0xbb72275eUL, 0xaa508167UL,
-0x38901091UL, 0xc6b505ebUL, 0x84c7cb8cUL, 0x2ad75a0fUL, 0x874a1427UL, 0xa2d1936bUL, 0x2ad286afUL, 0xaa56d291UL,
-0xd7894360UL, 0x425c750dUL, 0x93b39e26UL, 0x187184c9UL, 0x6c00b32dUL, 0x73e2bb14UL, 0xa0bebc3cUL, 0x54623779UL,
-0x64459eabUL, 0x3f328b82UL, 0x7718cf82UL, 0x59a2cea6UL, 0x04ee002eUL, 0x89fe78e6UL, 0x3fab0950UL, 0x325ff6c2UL,
-0x81383f05UL, 0x6963c5c8UL, 0x76cb5ad6UL, 0xd49974c9UL, 0xca180dcfUL, 0x380782d5UL, 0xc7fa5cf6UL, 0x8ac31511UL,
-0x35e79e13UL, 0x47da91d0UL, 0xf40f9086UL, 0xa7e2419eUL, 0x31366241UL, 0x051ef495UL, 0xaa573b04UL, 0x4a805d8dUL,
-0x548300d0UL, 0x00322a3cUL, 0xbf64cddfUL, 0xba57a68eUL, 0x75c6372bUL, 0x50afd341UL, 0xa7c13275UL, 0x915a0bf5UL,
-0x6b54bfabUL, 0x2b0b1426UL, 0xab4cc9d7UL, 0x449ccd82UL, 0xf7fbf265UL, 0xab85c5f3UL, 0x1b55db94UL, 0xaad4e324UL,
-0xcfa4bd3fUL, 0x2deaa3e2UL, 0x9e204d02UL, 0xc8bd25acUL, 0xeadf55b3UL, 0xd5bd9e98UL, 0xe31231b2UL, 0x2ad5ad6cUL,
-0x954329deUL, 0xadbe4528UL, 0xd8710f69UL, 0xaa51c90fUL, 0xaa786bf6UL, 0x22513f1eUL, 0xaa51a79bUL, 0x2ad344ccUL,
-0x7b5a41f0UL, 0xd37cfbadUL, 0x1b069505UL, 0x41ece491UL, 0xb4c332e6UL, 0x032268d4UL, 0xc9600accUL, 0xce387e6dUL,
-0xbf6bb16cUL, 0x6a70fb78UL, 0x0d03d9c9UL, 0xd4df39deUL, 0xe01063daUL, 0x4736f464UL, 0x5ad328d8UL, 0xb347cc96UL,
-0x75bb0fc3UL, 0x98511bfbUL, 0x4ffbcc35UL, 0xb58bcf6aUL, 0xe11f0abcUL, 0xbfc5fe4aUL, 0xa70aec10UL, 0xac39570aUL,
-0x3f04442fUL, 0x6188b153UL, 0xe0397a2eUL, 0x5727cb79UL, 0x9ceb418fUL, 0x1cacd68dUL, 0x2ad37c96UL, 0x0175cb9dUL,
-0xc69dff09UL, 0xc75b65f0UL, 0xd9db40d8UL, 0xec0e7779UL, 0x4744ead4UL, 0xb11c3274UL, 0xdd24cb9eUL, 0x7e1c54bdUL,
-0xf01144f9UL, 0xd2240eb1UL, 0x9675b3fdUL, 0xa3ac3755UL, 0xd47c27afUL, 0x51c85f4dUL, 0x56907596UL, 0xa5bb15e6UL,
-0x580304f0UL, 0xca042cf1UL, 0x011a37eaUL, 0x8dbfaadbUL, 0x35ba3e4aUL, 0x3526ffa0UL, 0xc37b4d09UL, 0xbc306ed9UL,
-0x98a52666UL, 0x5648f725UL, 0xff5e569dUL, 0x0ced63d0UL, 0x7c63b2cfUL, 0x700b45e1UL, 0xd5ea50f1UL, 0x85a92872UL,
-0xaf1fbda7UL, 0xd4234870UL, 0xa7870bf3UL, 0x2d3b4d79UL, 0x42e04198UL, 0x0cd0ede7UL, 0x26470db8UL, 0xf881814cUL,
-0x474d6ad7UL, 0x7c0c5e5cUL, 0xd1231959UL, 0x381b7298UL, 0xf5d2f4dbUL, 0xab838653UL, 0x6e2f1e23UL, 0x83719c9eUL,
-0xbd91e046UL, 0x9a56456eUL, 0xdc39200cUL, 0x20c8c571UL, 0x962bda1cUL, 0xe1e696ffUL, 0xb141ab08UL, 0x7cca89b9UL,
-0x1a69e783UL, 0x02cc4843UL, 0xa2f7c579UL, 0x429ef47dUL, 0x427b169cUL, 0x5ac9f049UL, 0xdd8f0f00UL, 0x5c8165bfUL};
+ 0x30fb40d4UL, 0x9fa0ff0bUL, 0x6beccd2fUL, 0x3f258c7aUL, 0x1e213f2fUL,
+ 0x9c004dd3UL, 0x6003e540UL, 0xcf9fc949UL,
+ 0xbfd4af27UL, 0x88bbbdb5UL, 0xe2034090UL, 0x98d09675UL, 0x6e63a0e0UL,
+ 0x15c361d2UL, 0xc2e7661dUL, 0x22d4ff8eUL,
+ 0x28683b6fUL, 0xc07fd059UL, 0xff2379c8UL, 0x775f50e2UL, 0x43c340d3UL,
+ 0xdf2f8656UL, 0x887ca41aUL, 0xa2d2bd2dUL,
+ 0xa1c9e0d6UL, 0x346c4819UL, 0x61b76d87UL, 0x22540f2fUL, 0x2abe32e1UL,
+ 0xaa54166bUL, 0x22568e3aUL, 0xa2d341d0UL,
+ 0x66db40c8UL, 0xa784392fUL, 0x004dff2fUL, 0x2db9d2deUL, 0x97943facUL,
+ 0x4a97c1d8UL, 0x527644b7UL, 0xb5f437a7UL,
+ 0xb82cbaefUL, 0xd751d159UL, 0x6ff7f0edUL, 0x5a097a1fUL, 0x827b68d0UL,
+ 0x90ecf52eUL, 0x22b0c054UL, 0xbc8e5935UL,
+ 0x4b6d2f7fUL, 0x50bb64a2UL, 0xd2664910UL, 0xbee5812dUL, 0xb7332290UL,
+ 0xe93b159fUL, 0xb48ee411UL, 0x4bff345dUL,
+ 0xfd45c240UL, 0xad31973fUL, 0xc4f6d02eUL, 0x55fc8165UL, 0xd5b1caadUL,
+ 0xa1ac2daeUL, 0xa2d4b76dUL, 0xc19b0c50UL,
+ 0x882240f2UL, 0x0c6e4f38UL, 0xa4e4bfd7UL, 0x4f5ba272UL, 0x564c1d2fUL,
+ 0xc59c5319UL, 0xb949e354UL, 0xb04669feUL,
+ 0xb1b6ab8aUL, 0xc71358ddUL, 0x6385c545UL, 0x110f935dUL, 0x57538ad5UL,
+ 0x6a390493UL, 0xe63d37e0UL, 0x2a54f6b3UL,
+ 0x3a787d5fUL, 0x6276a0b5UL, 0x19a6fcdfUL, 0x7a42206aUL, 0x29f9d4d5UL,
+ 0xf61b1891UL, 0xbb72275eUL, 0xaa508167UL,
+ 0x38901091UL, 0xc6b505ebUL, 0x84c7cb8cUL, 0x2ad75a0fUL, 0x874a1427UL,
+ 0xa2d1936bUL, 0x2ad286afUL, 0xaa56d291UL,
+ 0xd7894360UL, 0x425c750dUL, 0x93b39e26UL, 0x187184c9UL, 0x6c00b32dUL,
+ 0x73e2bb14UL, 0xa0bebc3cUL, 0x54623779UL,
+ 0x64459eabUL, 0x3f328b82UL, 0x7718cf82UL, 0x59a2cea6UL, 0x04ee002eUL,
+ 0x89fe78e6UL, 0x3fab0950UL, 0x325ff6c2UL,
+ 0x81383f05UL, 0x6963c5c8UL, 0x76cb5ad6UL, 0xd49974c9UL, 0xca180dcfUL,
+ 0x380782d5UL, 0xc7fa5cf6UL, 0x8ac31511UL,
+ 0x35e79e13UL, 0x47da91d0UL, 0xf40f9086UL, 0xa7e2419eUL, 0x31366241UL,
+ 0x051ef495UL, 0xaa573b04UL, 0x4a805d8dUL,
+ 0x548300d0UL, 0x00322a3cUL, 0xbf64cddfUL, 0xba57a68eUL, 0x75c6372bUL,
+ 0x50afd341UL, 0xa7c13275UL, 0x915a0bf5UL,
+ 0x6b54bfabUL, 0x2b0b1426UL, 0xab4cc9d7UL, 0x449ccd82UL, 0xf7fbf265UL,
+ 0xab85c5f3UL, 0x1b55db94UL, 0xaad4e324UL,
+ 0xcfa4bd3fUL, 0x2deaa3e2UL, 0x9e204d02UL, 0xc8bd25acUL, 0xeadf55b3UL,
+ 0xd5bd9e98UL, 0xe31231b2UL, 0x2ad5ad6cUL,
+ 0x954329deUL, 0xadbe4528UL, 0xd8710f69UL, 0xaa51c90fUL, 0xaa786bf6UL,
+ 0x22513f1eUL, 0xaa51a79bUL, 0x2ad344ccUL,
+ 0x7b5a41f0UL, 0xd37cfbadUL, 0x1b069505UL, 0x41ece491UL, 0xb4c332e6UL,
+ 0x032268d4UL, 0xc9600accUL, 0xce387e6dUL,
+ 0xbf6bb16cUL, 0x6a70fb78UL, 0x0d03d9c9UL, 0xd4df39deUL, 0xe01063daUL,
+ 0x4736f464UL, 0x5ad328d8UL, 0xb347cc96UL,
+ 0x75bb0fc3UL, 0x98511bfbUL, 0x4ffbcc35UL, 0xb58bcf6aUL, 0xe11f0abcUL,
+ 0xbfc5fe4aUL, 0xa70aec10UL, 0xac39570aUL,
+ 0x3f04442fUL, 0x6188b153UL, 0xe0397a2eUL, 0x5727cb79UL, 0x9ceb418fUL,
+ 0x1cacd68dUL, 0x2ad37c96UL, 0x0175cb9dUL,
+ 0xc69dff09UL, 0xc75b65f0UL, 0xd9db40d8UL, 0xec0e7779UL, 0x4744ead4UL,
+ 0xb11c3274UL, 0xdd24cb9eUL, 0x7e1c54bdUL,
+ 0xf01144f9UL, 0xd2240eb1UL, 0x9675b3fdUL, 0xa3ac3755UL, 0xd47c27afUL,
+ 0x51c85f4dUL, 0x56907596UL, 0xa5bb15e6UL,
+ 0x580304f0UL, 0xca042cf1UL, 0x011a37eaUL, 0x8dbfaadbUL, 0x35ba3e4aUL,
+ 0x3526ffa0UL, 0xc37b4d09UL, 0xbc306ed9UL,
+ 0x98a52666UL, 0x5648f725UL, 0xff5e569dUL, 0x0ced63d0UL, 0x7c63b2cfUL,
+ 0x700b45e1UL, 0xd5ea50f1UL, 0x85a92872UL,
+ 0xaf1fbda7UL, 0xd4234870UL, 0xa7870bf3UL, 0x2d3b4d79UL, 0x42e04198UL,
+ 0x0cd0ede7UL, 0x26470db8UL, 0xf881814cUL,
+ 0x474d6ad7UL, 0x7c0c5e5cUL, 0xd1231959UL, 0x381b7298UL, 0xf5d2f4dbUL,
+ 0xab838653UL, 0x6e2f1e23UL, 0x83719c9eUL,
+ 0xbd91e046UL, 0x9a56456eUL, 0xdc39200cUL, 0x20c8c571UL, 0x962bda1cUL,
+ 0xe1e696ffUL, 0xb141ab08UL, 0x7cca89b9UL,
+ 0x1a69e783UL, 0x02cc4843UL, 0xa2f7c579UL, 0x429ef47dUL, 0x427b169cUL,
+ 0x5ac9f049UL, 0xdd8f0f00UL, 0x5c8165bfUL };
const uint32_t s2[] PROGMEM = {
-0x1f201094UL, 0xef0ba75bUL, 0x69e3cf7eUL, 0x393f4380UL, 0xfe61cf7aUL, 0xeec5207aUL, 0x55889c94UL, 0x72fc0651UL,
-0xada7ef79UL, 0x4e1d7235UL, 0xd55a63ceUL, 0xde0436baUL, 0x99c430efUL, 0x5f0c0794UL, 0x18dcdb7dUL, 0xa1d6eff3UL,
-0xa0b52f7bUL, 0x59e83605UL, 0xee15b094UL, 0xe9ffd909UL, 0xdc440086UL, 0xef944459UL, 0xba83ccb3UL, 0xe0c3cdfbUL,
-0xd1da4181UL, 0x3b092ab1UL, 0xf997f1c1UL, 0xa5e6cf7bUL, 0x01420ddbUL, 0xe4e7ef5bUL, 0x25a1ff41UL, 0xe180f806UL,
-0x1fc41080UL, 0x179bee7aUL, 0xd37ac6a9UL, 0xfe5830a4UL, 0x98de8b7fUL, 0x77e83f4eUL, 0x79929269UL, 0x24fa9f7bUL,
-0xe113c85bUL, 0xacc40083UL, 0xd7503525UL, 0xf7ea615fUL, 0x62143154UL, 0x0d554b63UL, 0x5d681121UL, 0xc866c359UL,
-0x3d63cf73UL, 0xcee234c0UL, 0xd4d87e87UL, 0x5c672b21UL, 0x071f6181UL, 0x39f7627fUL, 0x361e3084UL, 0xe4eb573bUL,
-0x602f64a4UL, 0xd63acd9cUL, 0x1bbc4635UL, 0x9e81032dUL, 0x2701f50cUL, 0x99847ab4UL, 0xa0e3df79UL, 0xba6cf38cUL,
-0x10843094UL, 0x2537a95eUL, 0xf46f6ffeUL, 0xa1ff3b1fUL, 0x208cfb6aUL, 0x8f458c74UL, 0xd9e0a227UL, 0x4ec73a34UL,
-0xfc884f69UL, 0x3e4de8dfUL, 0xef0e0088UL, 0x3559648dUL, 0x8a45388cUL, 0x1d804366UL, 0x721d9bfdUL, 0xa58684bbUL,
-0xe8256333UL, 0x844e8212UL, 0x128d8098UL, 0xfed33fb4UL, 0xce280ae1UL, 0x27e19ba5UL, 0xd5a6c252UL, 0xe49754bdUL,
-0xc5d655ddUL, 0xeb667064UL, 0x77840b4dUL, 0xa1b6a801UL, 0x84db26a9UL, 0xe0b56714UL, 0x21f043b7UL, 0xe5d05860UL,
-0x54f03084UL, 0x066ff472UL, 0xa31aa153UL, 0xdadc4755UL, 0xb5625dbfUL, 0x68561be6UL, 0x83ca6b94UL, 0x2d6ed23bUL,
-0xeccf01dbUL, 0xa6d3d0baUL, 0xb6803d5cUL, 0xaf77a709UL, 0x33b4a34cUL, 0x397bc8d6UL, 0x5ee22b95UL, 0x5f0e5304UL,
-0x81ed6f61UL, 0x20e74364UL, 0xb45e1378UL, 0xde18639bUL, 0x881ca122UL, 0xb96726d1UL, 0x8049a7e8UL, 0x22b7da7bUL,
-0x5e552d25UL, 0x5272d237UL, 0x79d2951cUL, 0xc60d894cUL, 0x488cb402UL, 0x1ba4fe5bUL, 0xa4b09f6bUL, 0x1ca815cfUL,
-0xa20c3005UL, 0x8871df63UL, 0xb9de2fcbUL, 0x0cc6c9e9UL, 0x0beeff53UL, 0xe3214517UL, 0xb4542835UL, 0x9f63293cUL,
-0xee41e729UL, 0x6e1d2d7cUL, 0x50045286UL, 0x1e6685f3UL, 0xf33401c6UL, 0x30a22c95UL, 0x31a70850UL, 0x60930f13UL,
-0x73f98417UL, 0xa1269859UL, 0xec645c44UL, 0x52c877a9UL, 0xcdff33a6UL, 0xa02b1741UL, 0x7cbad9a2UL, 0x2180036fUL,
-0x50d99c08UL, 0xcb3f4861UL, 0xc26bd765UL, 0x64a3f6abUL, 0x80342676UL, 0x25a75e7bUL, 0xe4e6d1fcUL, 0x20c710e6UL,
-0xcdf0b680UL, 0x17844d3bUL, 0x31eef84dUL, 0x7e0824e4UL, 0x2ccb49ebUL, 0x846a3baeUL, 0x8ff77888UL, 0xee5d60f6UL,
-0x7af75673UL, 0x2fdd5cdbUL, 0xa11631c1UL, 0x30f66f43UL, 0xb3faec54UL, 0x157fd7faUL, 0xef8579ccUL, 0xd152de58UL,
-0xdb2ffd5eUL, 0x8f32ce19UL, 0x306af97aUL, 0x02f03ef8UL, 0x99319ad5UL, 0xc242fa0fUL, 0xa7e3ebb0UL, 0xc68e4906UL,
-0xb8da230cUL, 0x80823028UL, 0xdcdef3c8UL, 0xd35fb171UL, 0x088a1bc8UL, 0xbec0c560UL, 0x61a3c9e8UL, 0xbca8f54dUL,
-0xc72feffaUL, 0x22822e99UL, 0x82c570b4UL, 0xd8d94e89UL, 0x8b1c34bcUL, 0x301e16e6UL, 0x273be979UL, 0xb0ffeaa6UL,
-0x61d9b8c6UL, 0x00b24869UL, 0xb7ffce3fUL, 0x08dc283bUL, 0x43daf65aUL, 0xf7e19798UL, 0x7619b72fUL, 0x8f1c9ba4UL,
-0xdc8637a0UL, 0x16a7d3b1UL, 0x9fc393b7UL, 0xa7136eebUL, 0xc6bcc63eUL, 0x1a513742UL, 0xef6828bcUL, 0x520365d6UL,
-0x2d6a77abUL, 0x3527ed4bUL, 0x821fd216UL, 0x095c6e2eUL, 0xdb92f2fbUL, 0x5eea29cbUL, 0x145892f5UL, 0x91584f7fUL,
-0x5483697bUL, 0x2667a8ccUL, 0x85196048UL, 0x8c4baceaUL, 0x833860d4UL, 0x0d23e0f9UL, 0x6c387e8aUL, 0x0ae6d249UL,
-0xb284600cUL, 0xd835731dUL, 0xdcb1c647UL, 0xac4c56eaUL, 0x3ebd81b3UL, 0x230eabb0UL, 0x6438bc87UL, 0xf0b5b1faUL,
-0x8f5ea2b3UL, 0xfc184642UL, 0x0a036b7aUL, 0x4fb089bdUL, 0x649da589UL, 0xa345415eUL, 0x5c038323UL, 0x3e5d3bb9UL,
-0x43d79572UL, 0x7e6dd07cUL, 0x06dfdf1eUL, 0x6c6cc4efUL, 0x7160a539UL, 0x73bfbe70UL, 0x83877605UL, 0x4523ecf1UL};
+ 0x1f201094UL, 0xef0ba75bUL, 0x69e3cf7eUL, 0x393f4380UL, 0xfe61cf7aUL,
+ 0xeec5207aUL, 0x55889c94UL, 0x72fc0651UL,
+ 0xada7ef79UL, 0x4e1d7235UL, 0xd55a63ceUL, 0xde0436baUL, 0x99c430efUL,
+ 0x5f0c0794UL, 0x18dcdb7dUL, 0xa1d6eff3UL,
+ 0xa0b52f7bUL, 0x59e83605UL, 0xee15b094UL, 0xe9ffd909UL, 0xdc440086UL,
+ 0xef944459UL, 0xba83ccb3UL, 0xe0c3cdfbUL,
+ 0xd1da4181UL, 0x3b092ab1UL, 0xf997f1c1UL, 0xa5e6cf7bUL, 0x01420ddbUL,
+ 0xe4e7ef5bUL, 0x25a1ff41UL, 0xe180f806UL,
+ 0x1fc41080UL, 0x179bee7aUL, 0xd37ac6a9UL, 0xfe5830a4UL, 0x98de8b7fUL,
+ 0x77e83f4eUL, 0x79929269UL, 0x24fa9f7bUL,
+ 0xe113c85bUL, 0xacc40083UL, 0xd7503525UL, 0xf7ea615fUL, 0x62143154UL,
+ 0x0d554b63UL, 0x5d681121UL, 0xc866c359UL,
+ 0x3d63cf73UL, 0xcee234c0UL, 0xd4d87e87UL, 0x5c672b21UL, 0x071f6181UL,
+ 0x39f7627fUL, 0x361e3084UL, 0xe4eb573bUL,
+ 0x602f64a4UL, 0xd63acd9cUL, 0x1bbc4635UL, 0x9e81032dUL, 0x2701f50cUL,
+ 0x99847ab4UL, 0xa0e3df79UL, 0xba6cf38cUL,
+ 0x10843094UL, 0x2537a95eUL, 0xf46f6ffeUL, 0xa1ff3b1fUL, 0x208cfb6aUL,
+ 0x8f458c74UL, 0xd9e0a227UL, 0x4ec73a34UL,
+ 0xfc884f69UL, 0x3e4de8dfUL, 0xef0e0088UL, 0x3559648dUL, 0x8a45388cUL,
+ 0x1d804366UL, 0x721d9bfdUL, 0xa58684bbUL,
+ 0xe8256333UL, 0x844e8212UL, 0x128d8098UL, 0xfed33fb4UL, 0xce280ae1UL,
+ 0x27e19ba5UL, 0xd5a6c252UL, 0xe49754bdUL,
+ 0xc5d655ddUL, 0xeb667064UL, 0x77840b4dUL, 0xa1b6a801UL, 0x84db26a9UL,
+ 0xe0b56714UL, 0x21f043b7UL, 0xe5d05860UL,
+ 0x54f03084UL, 0x066ff472UL, 0xa31aa153UL, 0xdadc4755UL, 0xb5625dbfUL,
+ 0x68561be6UL, 0x83ca6b94UL, 0x2d6ed23bUL,
+ 0xeccf01dbUL, 0xa6d3d0baUL, 0xb6803d5cUL, 0xaf77a709UL, 0x33b4a34cUL,
+ 0x397bc8d6UL, 0x5ee22b95UL, 0x5f0e5304UL,
+ 0x81ed6f61UL, 0x20e74364UL, 0xb45e1378UL, 0xde18639bUL, 0x881ca122UL,
+ 0xb96726d1UL, 0x8049a7e8UL, 0x22b7da7bUL,
+ 0x5e552d25UL, 0x5272d237UL, 0x79d2951cUL, 0xc60d894cUL, 0x488cb402UL,
+ 0x1ba4fe5bUL, 0xa4b09f6bUL, 0x1ca815cfUL,
+ 0xa20c3005UL, 0x8871df63UL, 0xb9de2fcbUL, 0x0cc6c9e9UL, 0x0beeff53UL,
+ 0xe3214517UL, 0xb4542835UL, 0x9f63293cUL,
+ 0xee41e729UL, 0x6e1d2d7cUL, 0x50045286UL, 0x1e6685f3UL, 0xf33401c6UL,
+ 0x30a22c95UL, 0x31a70850UL, 0x60930f13UL,
+ 0x73f98417UL, 0xa1269859UL, 0xec645c44UL, 0x52c877a9UL, 0xcdff33a6UL,
+ 0xa02b1741UL, 0x7cbad9a2UL, 0x2180036fUL,
+ 0x50d99c08UL, 0xcb3f4861UL, 0xc26bd765UL, 0x64a3f6abUL, 0x80342676UL,
+ 0x25a75e7bUL, 0xe4e6d1fcUL, 0x20c710e6UL,
+ 0xcdf0b680UL, 0x17844d3bUL, 0x31eef84dUL, 0x7e0824e4UL, 0x2ccb49ebUL,
+ 0x846a3baeUL, 0x8ff77888UL, 0xee5d60f6UL,
+ 0x7af75673UL, 0x2fdd5cdbUL, 0xa11631c1UL, 0x30f66f43UL, 0xb3faec54UL,
+ 0x157fd7faUL, 0xef8579ccUL, 0xd152de58UL,
+ 0xdb2ffd5eUL, 0x8f32ce19UL, 0x306af97aUL, 0x02f03ef8UL, 0x99319ad5UL,
+ 0xc242fa0fUL, 0xa7e3ebb0UL, 0xc68e4906UL,
+ 0xb8da230cUL, 0x80823028UL, 0xdcdef3c8UL, 0xd35fb171UL, 0x088a1bc8UL,
+ 0xbec0c560UL, 0x61a3c9e8UL, 0xbca8f54dUL,
+ 0xc72feffaUL, 0x22822e99UL, 0x82c570b4UL, 0xd8d94e89UL, 0x8b1c34bcUL,
+ 0x301e16e6UL, 0x273be979UL, 0xb0ffeaa6UL,
+ 0x61d9b8c6UL, 0x00b24869UL, 0xb7ffce3fUL, 0x08dc283bUL, 0x43daf65aUL,
+ 0xf7e19798UL, 0x7619b72fUL, 0x8f1c9ba4UL,
+ 0xdc8637a0UL, 0x16a7d3b1UL, 0x9fc393b7UL, 0xa7136eebUL, 0xc6bcc63eUL,
+ 0x1a513742UL, 0xef6828bcUL, 0x520365d6UL,
+ 0x2d6a77abUL, 0x3527ed4bUL, 0x821fd216UL, 0x095c6e2eUL, 0xdb92f2fbUL,
+ 0x5eea29cbUL, 0x145892f5UL, 0x91584f7fUL,
+ 0x5483697bUL, 0x2667a8ccUL, 0x85196048UL, 0x8c4baceaUL, 0x833860d4UL,
+ 0x0d23e0f9UL, 0x6c387e8aUL, 0x0ae6d249UL,
+ 0xb284600cUL, 0xd835731dUL, 0xdcb1c647UL, 0xac4c56eaUL, 0x3ebd81b3UL,
+ 0x230eabb0UL, 0x6438bc87UL, 0xf0b5b1faUL,
+ 0x8f5ea2b3UL, 0xfc184642UL, 0x0a036b7aUL, 0x4fb089bdUL, 0x649da589UL,
+ 0xa345415eUL, 0x5c038323UL, 0x3e5d3bb9UL,
+ 0x43d79572UL, 0x7e6dd07cUL, 0x06dfdf1eUL, 0x6c6cc4efUL, 0x7160a539UL,
+ 0x73bfbe70UL, 0x83877605UL, 0x4523ecf1UL };
const uint32_t s3[] PROGMEM = {
-0x8defc240UL, 0x25fa5d9fUL, 0xeb903dbfUL, 0xe810c907UL, 0x47607fffUL, 0x369fe44bUL, 0x8c1fc644UL, 0xaececa90UL,
-0xbeb1f9bfUL, 0xeefbcaeaUL, 0xe8cf1950UL, 0x51df07aeUL, 0x920e8806UL, 0xf0ad0548UL, 0xe13c8d83UL, 0x927010d5UL,
-0x11107d9fUL, 0x07647db9UL, 0xb2e3e4d4UL, 0x3d4f285eUL, 0xb9afa820UL, 0xfade82e0UL, 0xa067268bUL, 0x8272792eUL,
-0x553fb2c0UL, 0x489ae22bUL, 0xd4ef9794UL, 0x125e3fbcUL, 0x21fffceeUL, 0x825b1bfdUL, 0x9255c5edUL, 0x1257a240UL,
-0x4e1a8302UL, 0xbae07fffUL, 0x528246e7UL, 0x8e57140eUL, 0x3373f7bfUL, 0x8c9f8188UL, 0xa6fc4ee8UL, 0xc982b5a5UL,
-0xa8c01db7UL, 0x579fc264UL, 0x67094f31UL, 0xf2bd3f5fUL, 0x40fff7c1UL, 0x1fb78dfcUL, 0x8e6bd2c1UL, 0x437be59bUL,
-0x99b03dbfUL, 0xb5dbc64bUL, 0x638dc0e6UL, 0x55819d99UL, 0xa197c81cUL, 0x4a012d6eUL, 0xc5884a28UL, 0xccc36f71UL,
-0xb843c213UL, 0x6c0743f1UL, 0x8309893cUL, 0x0feddd5fUL, 0x2f7fe850UL, 0xd7c07f7eUL, 0x02507fbfUL, 0x5afb9a04UL,
-0xa747d2d0UL, 0x1651192eUL, 0xaf70bf3eUL, 0x58c31380UL, 0x5f98302eUL, 0x727cc3c4UL, 0x0a0fb402UL, 0x0f7fef82UL,
-0x8c96fdadUL, 0x5d2c2aaeUL, 0x8ee99a49UL, 0x50da88b8UL, 0x8427f4a0UL, 0x1eac5790UL, 0x796fb449UL, 0x8252dc15UL,
-0xefbd7d9bUL, 0xa672597dUL, 0xada840d8UL, 0x45f54504UL, 0xfa5d7403UL, 0xe83ec305UL, 0x4f91751aUL, 0x925669c2UL,
-0x23efe941UL, 0xa903f12eUL, 0x60270df2UL, 0x0276e4b6UL, 0x94fd6574UL, 0x927985b2UL, 0x8276dbcbUL, 0x02778176UL,
-0xf8af918dUL, 0x4e48f79eUL, 0x8f616ddfUL, 0xe29d840eUL, 0x842f7d83UL, 0x340ce5c8UL, 0x96bbb682UL, 0x93b4b148UL,
-0xef303cabUL, 0x984faf28UL, 0x779faf9bUL, 0x92dc560dUL, 0x224d1e20UL, 0x8437aa88UL, 0x7d29dc96UL, 0x2756d3dcUL,
-0x8b907ceeUL, 0xb51fd240UL, 0xe7c07ce3UL, 0xe566b4a1UL, 0xc3e9615eUL, 0x3cf8209dUL, 0x6094d1e3UL, 0xcd9ca341UL,
-0x5c76460eUL, 0x00ea983bUL, 0xd4d67881UL, 0xfd47572cUL, 0xf76cedd9UL, 0xbda8229cUL, 0x127dadaaUL, 0x438a074eUL,
-0x1f97c090UL, 0x081bdb8aUL, 0x93a07ebeUL, 0xb938ca15UL, 0x97b03cffUL, 0x3dc2c0f8UL, 0x8d1ab2ecUL, 0x64380e51UL,
-0x68cc7bfbUL, 0xd90f2788UL, 0x12490181UL, 0x5de5ffd4UL, 0xdd7ef86aUL, 0x76a2e214UL, 0xb9a40368UL, 0x925d958fUL,
-0x4b39fffaUL, 0xba39aee9UL, 0xa4ffd30bUL, 0xfaf7933bUL, 0x6d498623UL, 0x193cbcfaUL, 0x27627545UL, 0x825cf47aUL,
-0x61bd8ba0UL, 0xd11e42d1UL, 0xcead04f4UL, 0x127ea392UL, 0x10428db7UL, 0x8272a972UL, 0x9270c4a8UL, 0x127de50bUL,
-0x285ba1c8UL, 0x3c62f44fUL, 0x35c0eaa5UL, 0xe805d231UL, 0x428929fbUL, 0xb4fcdf82UL, 0x4fb66a53UL, 0x0e7dc15bUL,
-0x1f081fabUL, 0x108618aeUL, 0xfcfd086dUL, 0xf9ff2889UL, 0x694bcc11UL, 0x236a5caeUL, 0x12deca4dUL, 0x2c3f8cc5UL,
-0xd2d02dfeUL, 0xf8ef5896UL, 0xe4cf52daUL, 0x95155b67UL, 0x494a488cUL, 0xb9b6a80cUL, 0x5c8f82bcUL, 0x89d36b45UL,
-0x3a609437UL, 0xec00c9a9UL, 0x44715253UL, 0x0a874b49UL, 0xd773bc40UL, 0x7c34671cUL, 0x02717ef6UL, 0x4feb5536UL,
-0xa2d02fffUL, 0xd2bf60c4UL, 0xd43f03c0UL, 0x50b4ef6dUL, 0x07478cd1UL, 0x006e1888UL, 0xa2e53f55UL, 0xb9e6d4bcUL,
-0xa2048016UL, 0x97573833UL, 0xd7207d67UL, 0xde0f8f3dUL, 0x72f87b33UL, 0xabcc4f33UL, 0x7688c55dUL, 0x7b00a6b0UL,
-0x947b0001UL, 0x570075d2UL, 0xf9bb88f8UL, 0x8942019eUL, 0x4264a5ffUL, 0x856302e0UL, 0x72dbd92bUL, 0xee971b69UL,
-0x6ea22fdeUL, 0x5f08ae2bUL, 0xaf7a616dUL, 0xe5c98767UL, 0xcf1febd2UL, 0x61efc8c2UL, 0xf1ac2571UL, 0xcc8239c2UL,
-0x67214cb8UL, 0xb1e583d1UL, 0xb7dc3e62UL, 0x7f10bdceUL, 0xf90a5c38UL, 0x0ff0443dUL, 0x606e6dc6UL, 0x60543a49UL,
-0x5727c148UL, 0x2be98a1dUL, 0x8ab41738UL, 0x20e1be24UL, 0xaf96da0fUL, 0x68458425UL, 0x99833be5UL, 0x600d457dUL,
-0x282f9350UL, 0x8334b362UL, 0xd91d1120UL, 0x2b6d8da0UL, 0x642b1e31UL, 0x9c305a00UL, 0x52bce688UL, 0x1b03588aUL,
-0xf7baefd5UL, 0x4142ed9cUL, 0xa4315c11UL, 0x83323ec5UL, 0xdfef4636UL, 0xa133c501UL, 0xe9d3531cUL, 0xee353783UL};
+ 0x8defc240UL, 0x25fa5d9fUL, 0xeb903dbfUL, 0xe810c907UL, 0x47607fffUL,
+ 0x369fe44bUL, 0x8c1fc644UL, 0xaececa90UL,
+ 0xbeb1f9bfUL, 0xeefbcaeaUL, 0xe8cf1950UL, 0x51df07aeUL, 0x920e8806UL,
+ 0xf0ad0548UL, 0xe13c8d83UL, 0x927010d5UL,
+ 0x11107d9fUL, 0x07647db9UL, 0xb2e3e4d4UL, 0x3d4f285eUL, 0xb9afa820UL,
+ 0xfade82e0UL, 0xa067268bUL, 0x8272792eUL,
+ 0x553fb2c0UL, 0x489ae22bUL, 0xd4ef9794UL, 0x125e3fbcUL, 0x21fffceeUL,
+ 0x825b1bfdUL, 0x9255c5edUL, 0x1257a240UL,
+ 0x4e1a8302UL, 0xbae07fffUL, 0x528246e7UL, 0x8e57140eUL, 0x3373f7bfUL,
+ 0x8c9f8188UL, 0xa6fc4ee8UL, 0xc982b5a5UL,
+ 0xa8c01db7UL, 0x579fc264UL, 0x67094f31UL, 0xf2bd3f5fUL, 0x40fff7c1UL,
+ 0x1fb78dfcUL, 0x8e6bd2c1UL, 0x437be59bUL,
+ 0x99b03dbfUL, 0xb5dbc64bUL, 0x638dc0e6UL, 0x55819d99UL, 0xa197c81cUL,
+ 0x4a012d6eUL, 0xc5884a28UL, 0xccc36f71UL,
+ 0xb843c213UL, 0x6c0743f1UL, 0x8309893cUL, 0x0feddd5fUL, 0x2f7fe850UL,
+ 0xd7c07f7eUL, 0x02507fbfUL, 0x5afb9a04UL,
+ 0xa747d2d0UL, 0x1651192eUL, 0xaf70bf3eUL, 0x58c31380UL, 0x5f98302eUL,
+ 0x727cc3c4UL, 0x0a0fb402UL, 0x0f7fef82UL,
+ 0x8c96fdadUL, 0x5d2c2aaeUL, 0x8ee99a49UL, 0x50da88b8UL, 0x8427f4a0UL,
+ 0x1eac5790UL, 0x796fb449UL, 0x8252dc15UL,
+ 0xefbd7d9bUL, 0xa672597dUL, 0xada840d8UL, 0x45f54504UL, 0xfa5d7403UL,
+ 0xe83ec305UL, 0x4f91751aUL, 0x925669c2UL,
+ 0x23efe941UL, 0xa903f12eUL, 0x60270df2UL, 0x0276e4b6UL, 0x94fd6574UL,
+ 0x927985b2UL, 0x8276dbcbUL, 0x02778176UL,
+ 0xf8af918dUL, 0x4e48f79eUL, 0x8f616ddfUL, 0xe29d840eUL, 0x842f7d83UL,
+ 0x340ce5c8UL, 0x96bbb682UL, 0x93b4b148UL,
+ 0xef303cabUL, 0x984faf28UL, 0x779faf9bUL, 0x92dc560dUL, 0x224d1e20UL,
+ 0x8437aa88UL, 0x7d29dc96UL, 0x2756d3dcUL,
+ 0x8b907ceeUL, 0xb51fd240UL, 0xe7c07ce3UL, 0xe566b4a1UL, 0xc3e9615eUL,
+ 0x3cf8209dUL, 0x6094d1e3UL, 0xcd9ca341UL,
+ 0x5c76460eUL, 0x00ea983bUL, 0xd4d67881UL, 0xfd47572cUL, 0xf76cedd9UL,
+ 0xbda8229cUL, 0x127dadaaUL, 0x438a074eUL,
+ 0x1f97c090UL, 0x081bdb8aUL, 0x93a07ebeUL, 0xb938ca15UL, 0x97b03cffUL,
+ 0x3dc2c0f8UL, 0x8d1ab2ecUL, 0x64380e51UL,
+ 0x68cc7bfbUL, 0xd90f2788UL, 0x12490181UL, 0x5de5ffd4UL, 0xdd7ef86aUL,
+ 0x76a2e214UL, 0xb9a40368UL, 0x925d958fUL,
+ 0x4b39fffaUL, 0xba39aee9UL, 0xa4ffd30bUL, 0xfaf7933bUL, 0x6d498623UL,
+ 0x193cbcfaUL, 0x27627545UL, 0x825cf47aUL,
+ 0x61bd8ba0UL, 0xd11e42d1UL, 0xcead04f4UL, 0x127ea392UL, 0x10428db7UL,
+ 0x8272a972UL, 0x9270c4a8UL, 0x127de50bUL,
+ 0x285ba1c8UL, 0x3c62f44fUL, 0x35c0eaa5UL, 0xe805d231UL, 0x428929fbUL,
+ 0xb4fcdf82UL, 0x4fb66a53UL, 0x0e7dc15bUL,
+ 0x1f081fabUL, 0x108618aeUL, 0xfcfd086dUL, 0xf9ff2889UL, 0x694bcc11UL,
+ 0x236a5caeUL, 0x12deca4dUL, 0x2c3f8cc5UL,
+ 0xd2d02dfeUL, 0xf8ef5896UL, 0xe4cf52daUL, 0x95155b67UL, 0x494a488cUL,
+ 0xb9b6a80cUL, 0x5c8f82bcUL, 0x89d36b45UL,
+ 0x3a609437UL, 0xec00c9a9UL, 0x44715253UL, 0x0a874b49UL, 0xd773bc40UL,
+ 0x7c34671cUL, 0x02717ef6UL, 0x4feb5536UL,
+ 0xa2d02fffUL, 0xd2bf60c4UL, 0xd43f03c0UL, 0x50b4ef6dUL, 0x07478cd1UL,
+ 0x006e1888UL, 0xa2e53f55UL, 0xb9e6d4bcUL,
+ 0xa2048016UL, 0x97573833UL, 0xd7207d67UL, 0xde0f8f3dUL, 0x72f87b33UL,
+ 0xabcc4f33UL, 0x7688c55dUL, 0x7b00a6b0UL,
+ 0x947b0001UL, 0x570075d2UL, 0xf9bb88f8UL, 0x8942019eUL, 0x4264a5ffUL,
+ 0x856302e0UL, 0x72dbd92bUL, 0xee971b69UL,
+ 0x6ea22fdeUL, 0x5f08ae2bUL, 0xaf7a616dUL, 0xe5c98767UL, 0xcf1febd2UL,
+ 0x61efc8c2UL, 0xf1ac2571UL, 0xcc8239c2UL,
+ 0x67214cb8UL, 0xb1e583d1UL, 0xb7dc3e62UL, 0x7f10bdceUL, 0xf90a5c38UL,
+ 0x0ff0443dUL, 0x606e6dc6UL, 0x60543a49UL,
+ 0x5727c148UL, 0x2be98a1dUL, 0x8ab41738UL, 0x20e1be24UL, 0xaf96da0fUL,
+ 0x68458425UL, 0x99833be5UL, 0x600d457dUL,
+ 0x282f9350UL, 0x8334b362UL, 0xd91d1120UL, 0x2b6d8da0UL, 0x642b1e31UL,
+ 0x9c305a00UL, 0x52bce688UL, 0x1b03588aUL,
+ 0xf7baefd5UL, 0x4142ed9cUL, 0xa4315c11UL, 0x83323ec5UL, 0xdfef4636UL,
+ 0xa133c501UL, 0xe9d3531cUL, 0xee353783UL };
const uint32_t s4[] PROGMEM = {
-0x9db30420UL, 0x1fb6e9deUL, 0xa7be7befUL, 0xd273a298UL, 0x4a4f7bdbUL, 0x64ad8c57UL, 0x85510443UL, 0xfa020ed1UL,
-0x7e287affUL, 0xe60fb663UL, 0x095f35a1UL, 0x79ebf120UL, 0xfd059d43UL, 0x6497b7b1UL, 0xf3641f63UL, 0x241e4adfUL,
-0x28147f5fUL, 0x4fa2b8cdUL, 0xc9430040UL, 0x0cc32220UL, 0xfdd30b30UL, 0xc0a5374fUL, 0x1d2d00d9UL, 0x24147b15UL,
-0xee4d111aUL, 0x0fca5167UL, 0x71ff904cUL, 0x2d195ffeUL, 0x1a05645fUL, 0x0c13fefeUL, 0x081b08caUL, 0x05170121UL,
-0x80530100UL, 0xe83e5efeUL, 0xac9af4f8UL, 0x7fe72701UL, 0xd2b8ee5fUL, 0x06df4261UL, 0xbb9e9b8aUL, 0x7293ea25UL,
-0xce84ffdfUL, 0xf5718801UL, 0x3dd64b04UL, 0xa26f263bUL, 0x7ed48400UL, 0x547eebe6UL, 0x446d4ca0UL, 0x6cf3d6f5UL,
-0x2649abdfUL, 0xaea0c7f5UL, 0x36338cc1UL, 0x503f7e93UL, 0xd3772061UL, 0x11b638e1UL, 0x72500e03UL, 0xf80eb2bbUL,
-0xabe0502eUL, 0xec8d77deUL, 0x57971e81UL, 0xe14f6746UL, 0xc9335400UL, 0x6920318fUL, 0x081dbb99UL, 0xffc304a5UL,
-0x4d351805UL, 0x7f3d5ce3UL, 0xa6c866c6UL, 0x5d5bcca9UL, 0xdaec6feaUL, 0x9f926f91UL, 0x9f46222fUL, 0x3991467dUL,
-0xa5bf6d8eUL, 0x1143c44fUL, 0x43958302UL, 0xd0214eebUL, 0x022083b8UL, 0x3fb6180cUL, 0x18f8931eUL, 0x281658e6UL,
-0x26486e3eUL, 0x8bd78a70UL, 0x7477e4c1UL, 0xb506e07cUL, 0xf32d0a25UL, 0x79098b02UL, 0xe4eabb81UL, 0x28123b23UL,
-0x69dead38UL, 0x1574ca16UL, 0xdf871b62UL, 0x211c40b7UL, 0xa51a9ef9UL, 0x0014377bUL, 0x041e8ac8UL, 0x09114003UL,
-0xbd59e4d2UL, 0xe3d156d5UL, 0x4fe876d5UL, 0x2f91a340UL, 0x557be8deUL, 0x00eae4a7UL, 0x0ce5c2ecUL, 0x4db4bba6UL,
-0xe756bdffUL, 0xdd3369acUL, 0xec17b035UL, 0x06572327UL, 0x99afc8b0UL, 0x56c8c391UL, 0x6b65811cUL, 0x5e146119UL,
-0x6e85cb75UL, 0xbe07c002UL, 0xc2325577UL, 0x893ff4ecUL, 0x5bbfc92dUL, 0xd0ec3b25UL, 0xb7801ab7UL, 0x8d6d3b24UL,
-0x20c763efUL, 0xc366a5fcUL, 0x9c382880UL, 0x0ace3205UL, 0xaac9548aUL, 0xeca1d7c7UL, 0x041afa32UL, 0x1d16625aUL,
-0x6701902cUL, 0x9b757a54UL, 0x31d477f7UL, 0x9126b031UL, 0x36cc6fdbUL, 0xc70b8b46UL, 0xd9e66a48UL, 0x56e55a79UL,
-0x026a4cebUL, 0x52437effUL, 0x2f8f76b4UL, 0x0df980a5UL, 0x8674cde3UL, 0xedda04ebUL, 0x17a9be04UL, 0x2c18f4dfUL,
-0xb7747f9dUL, 0xab2af7b4UL, 0xefc34d20UL, 0x2e096b7cUL, 0x1741a254UL, 0xe5b6a035UL, 0x213d42f6UL, 0x2c1c7c26UL,
-0x61c2f50fUL, 0x6552daf9UL, 0xd2c231f8UL, 0x25130f69UL, 0xd8167fa2UL, 0x0418f2c8UL, 0x001a96a6UL, 0x0d1526abUL,
-0x63315c21UL, 0x5e0a72ecUL, 0x49bafefdUL, 0x187908d9UL, 0x8d0dbd86UL, 0x311170a7UL, 0x3e9b640cUL, 0xcc3e10d7UL,
-0xd5cad3b6UL, 0x0caec388UL, 0xf73001e1UL, 0x6c728affUL, 0x71eae2a1UL, 0x1f9af36eUL, 0xcfcbd12fUL, 0xc1de8417UL,
-0xac07be6bUL, 0xcb44a1d8UL, 0x8b9b0f56UL, 0x013988c3UL, 0xb1c52fcaUL, 0xb4be31cdUL, 0xd8782806UL, 0x12a3a4e2UL,
-0x6f7de532UL, 0x58fd7eb6UL, 0xd01ee900UL, 0x24adffc2UL, 0xf4990fc5UL, 0x9711aac5UL, 0x001d7b95UL, 0x82e5e7d2UL,
-0x109873f6UL, 0x00613096UL, 0xc32d9521UL, 0xada121ffUL, 0x29908415UL, 0x7fbb977fUL, 0xaf9eb3dbUL, 0x29c9ed2aUL,
-0x5ce2a465UL, 0xa730f32cUL, 0xd0aa3fe8UL, 0x8a5cc091UL, 0xd49e2ce7UL, 0x0ce454a9UL, 0xd60acd86UL, 0x015f1919UL,
-0x77079103UL, 0xdea03af6UL, 0x78a8565eUL, 0xdee356dfUL, 0x21f05cbeUL, 0x8b75e387UL, 0xb3c50651UL, 0xb8a5c3efUL,
-0xd8eeb6d2UL, 0xe523be77UL, 0xc2154529UL, 0x2f69efdfUL, 0xafe67afbUL, 0xf470c4b2UL, 0xf3e0eb5bUL, 0xd6cc9876UL,
-0x39e4460cUL, 0x1fda8538UL, 0x1987832fUL, 0xca007367UL, 0xa99144f8UL, 0x296b299eUL, 0x492fc295UL, 0x9266beabUL,
-0xb5676e69UL, 0x9bd3dddaUL, 0xdf7e052fUL, 0xdb25701cUL, 0x1b5e51eeUL, 0xf65324e6UL, 0x6afce36cUL, 0x0316cc04UL,
-0x8644213eUL, 0xb7dc59d0UL, 0x7965291fUL, 0xccd6fd43UL, 0x41823979UL, 0x932bcdf6UL, 0xb657c34dUL, 0x4edfd282UL,
-0x7ae5290cUL, 0x3cb9536bUL, 0x851e20feUL, 0x9833557eUL, 0x13ecf0b0UL, 0xd3ffb372UL, 0x3f85c5c1UL, 0x0aef7ed2UL};
+ 0x9db30420UL, 0x1fb6e9deUL, 0xa7be7befUL, 0xd273a298UL, 0x4a4f7bdbUL,
+ 0x64ad8c57UL, 0x85510443UL, 0xfa020ed1UL,
+ 0x7e287affUL, 0xe60fb663UL, 0x095f35a1UL, 0x79ebf120UL, 0xfd059d43UL,
+ 0x6497b7b1UL, 0xf3641f63UL, 0x241e4adfUL,
+ 0x28147f5fUL, 0x4fa2b8cdUL, 0xc9430040UL, 0x0cc32220UL, 0xfdd30b30UL,
+ 0xc0a5374fUL, 0x1d2d00d9UL, 0x24147b15UL,
+ 0xee4d111aUL, 0x0fca5167UL, 0x71ff904cUL, 0x2d195ffeUL, 0x1a05645fUL,
+ 0x0c13fefeUL, 0x081b08caUL, 0x05170121UL,
+ 0x80530100UL, 0xe83e5efeUL, 0xac9af4f8UL, 0x7fe72701UL, 0xd2b8ee5fUL,
+ 0x06df4261UL, 0xbb9e9b8aUL, 0x7293ea25UL,
+ 0xce84ffdfUL, 0xf5718801UL, 0x3dd64b04UL, 0xa26f263bUL, 0x7ed48400UL,
+ 0x547eebe6UL, 0x446d4ca0UL, 0x6cf3d6f5UL,
+ 0x2649abdfUL, 0xaea0c7f5UL, 0x36338cc1UL, 0x503f7e93UL, 0xd3772061UL,
+ 0x11b638e1UL, 0x72500e03UL, 0xf80eb2bbUL,
+ 0xabe0502eUL, 0xec8d77deUL, 0x57971e81UL, 0xe14f6746UL, 0xc9335400UL,
+ 0x6920318fUL, 0x081dbb99UL, 0xffc304a5UL,
+ 0x4d351805UL, 0x7f3d5ce3UL, 0xa6c866c6UL, 0x5d5bcca9UL, 0xdaec6feaUL,
+ 0x9f926f91UL, 0x9f46222fUL, 0x3991467dUL,
+ 0xa5bf6d8eUL, 0x1143c44fUL, 0x43958302UL, 0xd0214eebUL, 0x022083b8UL,
+ 0x3fb6180cUL, 0x18f8931eUL, 0x281658e6UL,
+ 0x26486e3eUL, 0x8bd78a70UL, 0x7477e4c1UL, 0xb506e07cUL, 0xf32d0a25UL,
+ 0x79098b02UL, 0xe4eabb81UL, 0x28123b23UL,
+ 0x69dead38UL, 0x1574ca16UL, 0xdf871b62UL, 0x211c40b7UL, 0xa51a9ef9UL,
+ 0x0014377bUL, 0x041e8ac8UL, 0x09114003UL,
+ 0xbd59e4d2UL, 0xe3d156d5UL, 0x4fe876d5UL, 0x2f91a340UL, 0x557be8deUL,
+ 0x00eae4a7UL, 0x0ce5c2ecUL, 0x4db4bba6UL,
+ 0xe756bdffUL, 0xdd3369acUL, 0xec17b035UL, 0x06572327UL, 0x99afc8b0UL,
+ 0x56c8c391UL, 0x6b65811cUL, 0x5e146119UL,
+ 0x6e85cb75UL, 0xbe07c002UL, 0xc2325577UL, 0x893ff4ecUL, 0x5bbfc92dUL,
+ 0xd0ec3b25UL, 0xb7801ab7UL, 0x8d6d3b24UL,
+ 0x20c763efUL, 0xc366a5fcUL, 0x9c382880UL, 0x0ace3205UL, 0xaac9548aUL,
+ 0xeca1d7c7UL, 0x041afa32UL, 0x1d16625aUL,
+ 0x6701902cUL, 0x9b757a54UL, 0x31d477f7UL, 0x9126b031UL, 0x36cc6fdbUL,
+ 0xc70b8b46UL, 0xd9e66a48UL, 0x56e55a79UL,
+ 0x026a4cebUL, 0x52437effUL, 0x2f8f76b4UL, 0x0df980a5UL, 0x8674cde3UL,
+ 0xedda04ebUL, 0x17a9be04UL, 0x2c18f4dfUL,
+ 0xb7747f9dUL, 0xab2af7b4UL, 0xefc34d20UL, 0x2e096b7cUL, 0x1741a254UL,
+ 0xe5b6a035UL, 0x213d42f6UL, 0x2c1c7c26UL,
+ 0x61c2f50fUL, 0x6552daf9UL, 0xd2c231f8UL, 0x25130f69UL, 0xd8167fa2UL,
+ 0x0418f2c8UL, 0x001a96a6UL, 0x0d1526abUL,
+ 0x63315c21UL, 0x5e0a72ecUL, 0x49bafefdUL, 0x187908d9UL, 0x8d0dbd86UL,
+ 0x311170a7UL, 0x3e9b640cUL, 0xcc3e10d7UL,
+ 0xd5cad3b6UL, 0x0caec388UL, 0xf73001e1UL, 0x6c728affUL, 0x71eae2a1UL,
+ 0x1f9af36eUL, 0xcfcbd12fUL, 0xc1de8417UL,
+ 0xac07be6bUL, 0xcb44a1d8UL, 0x8b9b0f56UL, 0x013988c3UL, 0xb1c52fcaUL,
+ 0xb4be31cdUL, 0xd8782806UL, 0x12a3a4e2UL,
+ 0x6f7de532UL, 0x58fd7eb6UL, 0xd01ee900UL, 0x24adffc2UL, 0xf4990fc5UL,
+ 0x9711aac5UL, 0x001d7b95UL, 0x82e5e7d2UL,
+ 0x109873f6UL, 0x00613096UL, 0xc32d9521UL, 0xada121ffUL, 0x29908415UL,
+ 0x7fbb977fUL, 0xaf9eb3dbUL, 0x29c9ed2aUL,
+ 0x5ce2a465UL, 0xa730f32cUL, 0xd0aa3fe8UL, 0x8a5cc091UL, 0xd49e2ce7UL,
+ 0x0ce454a9UL, 0xd60acd86UL, 0x015f1919UL,
+ 0x77079103UL, 0xdea03af6UL, 0x78a8565eUL, 0xdee356dfUL, 0x21f05cbeUL,
+ 0x8b75e387UL, 0xb3c50651UL, 0xb8a5c3efUL,
+ 0xd8eeb6d2UL, 0xe523be77UL, 0xc2154529UL, 0x2f69efdfUL, 0xafe67afbUL,
+ 0xf470c4b2UL, 0xf3e0eb5bUL, 0xd6cc9876UL,
+ 0x39e4460cUL, 0x1fda8538UL, 0x1987832fUL, 0xca007367UL, 0xa99144f8UL,
+ 0x296b299eUL, 0x492fc295UL, 0x9266beabUL,
+ 0xb5676e69UL, 0x9bd3dddaUL, 0xdf7e052fUL, 0xdb25701cUL, 0x1b5e51eeUL,
+ 0xf65324e6UL, 0x6afce36cUL, 0x0316cc04UL,
+ 0x8644213eUL, 0xb7dc59d0UL, 0x7965291fUL, 0xccd6fd43UL, 0x41823979UL,
+ 0x932bcdf6UL, 0xb657c34dUL, 0x4edfd282UL,
+ 0x7ae5290cUL, 0x3cb9536bUL, 0x851e20feUL, 0x9833557eUL, 0x13ecf0b0UL,
+ 0xd3ffb372UL, 0x3f85c5c1UL, 0x0aef7ed2UL };
#else
const uint32_t s1[] PROGMEM = {
-0xd440fb30UL, 0x0bffa09fUL, 0x2fcdec6bUL, 0x7a8c253fUL, 0x2f3f211eUL, 0xd34d009cUL, 0x40e50360UL, 0x49c99fcfUL,
-0x27afd4bfUL, 0xb5bdbb88UL, 0x904003e2UL, 0x7596d098UL, 0xe0a0636eUL, 0xd261c315UL, 0x1d66e7c2UL, 0x8effd422UL,
-0x6f3b6828UL, 0x59d07fc0UL, 0xc87923ffUL, 0xe2505f77UL, 0xd340c343UL, 0x56862fdfUL, 0x1aa47c88UL, 0x2dbdd2a2UL,
-0xd6e0c9a1UL, 0x19486c34UL, 0x876db761UL, 0x2f0f5422UL, 0xe132be2aUL, 0x6b1654aaUL, 0x3a8e5622UL, 0xd041d3a2UL,
-0xc840db66UL, 0x2f3984a7UL, 0x2fff4d00UL, 0xded2b92dUL, 0xac3f9497UL, 0xd8c1974aUL, 0xb7447652UL, 0xa737f4b5UL,
-0xefba2cb8UL, 0x59d151d7UL, 0xedf0f76fUL, 0x1f7a095aUL, 0xd0687b82UL, 0x2ef5ec90UL, 0x54c0b022UL, 0x35598ebcUL,
-0x7f2f6d4bUL, 0xa264bb50UL, 0x104966d2UL, 0x2d81e5beUL, 0x902233b7UL, 0x9f153be9UL, 0x11e48eb4UL, 0x5d34ff4bUL,
-0x40c245fdUL, 0x3f9731adUL, 0x2ed0f6c4UL, 0x6581fc55UL, 0xadcab1d5UL, 0xae2daca1UL, 0x6db7d4a2UL, 0x500c9bc1UL,
-0xf2402288UL, 0x384f6e0cUL, 0xd7bfe4a4UL, 0x72a25b4fUL, 0x2f1d4c56UL, 0x19539cc5UL, 0x54e349b9UL, 0xfe6946b0UL,
-0x8aabb6b1UL, 0xdd5813c7UL, 0x45c58563UL, 0x5d930f11UL, 0xd58a5357UL, 0x9304396aUL, 0xe0373de6UL, 0xb3f6542aUL,
-0x5f7d783aUL, 0xb5a07662UL, 0xdffca619UL, 0x6a20427aUL, 0xd5d4f929UL, 0x91181bf6UL, 0x5e2772bbUL, 0x678150aaUL,
-0x91109038UL, 0xeb05b5c6UL, 0x8ccbc784UL, 0x0f5ad72aUL, 0x27144a87UL, 0x6b93d1a2UL, 0xaf86d22aUL, 0x91d256aaUL,
-0x604389d7UL, 0x0d755c42UL, 0x269eb393UL, 0xc9847118UL, 0x2db3006cUL, 0x14bbe273UL, 0x3cbcbea0UL, 0x79376254UL,
-0xab9e4564UL, 0x828b323fUL, 0x82cf1877UL, 0xa6cea259UL, 0x2e00ee04UL, 0xe678fe89UL, 0x5009ab3fUL, 0xc2f65f32UL,
-0x053f3881UL, 0xc8c56369UL, 0xd65acb76UL, 0xc97499d4UL, 0xcf0d18caUL, 0xd5820738UL, 0xf65cfac7UL, 0x1115c38aUL,
-0x139ee735UL, 0xd091da47UL, 0x86900ff4UL, 0x9e41e2a7UL, 0x41623631UL, 0x95f41e05UL, 0x043b57aaUL, 0x8d5d804aUL,
-0xd0008354UL, 0x3c2a3200UL, 0xdfcd64bfUL, 0x8ea657baUL, 0x2b37c675UL, 0x41d3af50UL, 0x7532c1a7UL, 0xf50b5a91UL,
-0xabbf546bUL, 0x26140b2bUL, 0xd7c94cabUL, 0x82cd9c44UL, 0x65f2fbf7UL, 0xf3c585abUL, 0x94db551bUL, 0x24e3d4aaUL,
-0x3fbda4cfUL, 0xe2a3ea2dUL, 0x024d209eUL, 0xac25bdc8UL, 0xb355dfeaUL, 0x989ebdd5UL, 0xb23112e3UL, 0x6cadd52aUL,
-0xde294395UL, 0x2845beadUL, 0x690f71d8UL, 0x0fc951aaUL, 0xf66b78aaUL, 0x1e3f5122UL, 0x9ba751aaUL, 0xcc44d32aUL,
-0xf0415a7bUL, 0xadfb7cd3UL, 0x0595061bUL, 0x91e4ec41UL, 0xe632c3b4UL, 0xd4682203UL, 0xcc0a60c9UL, 0x6d7e38ceUL,
-0x6cb16bbfUL, 0x78fb706aUL, 0xc9d9030dUL, 0xde39dfd4UL, 0xda6310e0UL, 0x64f43647UL, 0xd828d35aUL, 0x96cc47b3UL,
-0xc30fbb75UL, 0xfb1b5198UL, 0x35ccfb4fUL, 0x6acf8bb5UL, 0xbc0a1fe1UL, 0x4afec5bfUL, 0x10ec0aa7UL, 0x0a5739acUL,
-0x2f44043fUL, 0x53b18861UL, 0x2e7a39e0UL, 0x79cb2757UL, 0x8f41eb9cUL, 0x8dd6ac1cUL, 0x967cd32aUL, 0x9dcb7501UL,
-0x09ff9dc6UL, 0xf0655bc7UL, 0xd840dbd9UL, 0x79770eecUL, 0xd4ea4447UL, 0x74321cb1UL, 0x9ecb24ddUL, 0xbd541c7eUL,
-0xf94411f0UL, 0xb10e24d2UL, 0xfdb37596UL, 0x5537aca3UL, 0xaf277cd4UL, 0x4d5fc851UL, 0x96759056UL, 0xe615bba5UL,
-0xf0040358UL, 0xf12c04caUL, 0xea371a01UL, 0xdbaabf8dUL, 0x4a3eba35UL, 0xa0ff2635UL, 0x094d7bc3UL, 0xd96e30bcUL,
-0x6626a598UL, 0x25f74856UL, 0x9d565effUL, 0xd063ed0cUL, 0xcfb2637cUL, 0xe1450b70UL, 0xf150ead5UL, 0x7228a985UL,
-0xa7bd1fafUL, 0x704823d4UL, 0xf30b87a7UL, 0x794d3b2dUL, 0x9841e042UL, 0xe7edd00cUL, 0xb80d4726UL, 0x4c8181f8UL,
-0xd76a4d47UL, 0x5c5e0c7cUL, 0x591923d1UL, 0x98721b38UL, 0xdbf4d2f5UL, 0x538683abUL, 0x231e2f6eUL, 0x9e9c7183UL,
-0x46e091bdUL, 0x6e45569aUL, 0x0c2039dcUL, 0x71c5c820UL, 0x1cda2b96UL, 0xff96e6e1UL, 0x08ab41b1UL, 0xb989ca7cUL,
-0x83e7691aUL, 0x4348cc02UL, 0x79c5f7a2UL, 0x7df49e42UL, 0x9c167b42UL, 0x49f0c95aUL, 0x000f8fddUL, 0xbf65815cUL};
+ 0xd440fb30UL, 0x0bffa09fUL, 0x2fcdec6bUL, 0x7a8c253fUL, 0x2f3f211eUL, 0xd34d009cUL, 0x40e50360UL, 0x49c99fcfUL,
+ 0x27afd4bfUL, 0xb5bdbb88UL, 0x904003e2UL, 0x7596d098UL, 0xe0a0636eUL, 0xd261c315UL, 0x1d66e7c2UL, 0x8effd422UL,
+ 0x6f3b6828UL, 0x59d07fc0UL, 0xc87923ffUL, 0xe2505f77UL, 0xd340c343UL, 0x56862fdfUL, 0x1aa47c88UL, 0x2dbdd2a2UL,
+ 0xd6e0c9a1UL, 0x19486c34UL, 0x876db761UL, 0x2f0f5422UL, 0xe132be2aUL, 0x6b1654aaUL, 0x3a8e5622UL, 0xd041d3a2UL,
+ 0xc840db66UL, 0x2f3984a7UL, 0x2fff4d00UL, 0xded2b92dUL, 0xac3f9497UL, 0xd8c1974aUL, 0xb7447652UL, 0xa737f4b5UL,
+ 0xefba2cb8UL, 0x59d151d7UL, 0xedf0f76fUL, 0x1f7a095aUL, 0xd0687b82UL, 0x2ef5ec90UL, 0x54c0b022UL, 0x35598ebcUL,
+ 0x7f2f6d4bUL, 0xa264bb50UL, 0x104966d2UL, 0x2d81e5beUL, 0x902233b7UL, 0x9f153be9UL, 0x11e48eb4UL, 0x5d34ff4bUL,
+ 0x40c245fdUL, 0x3f9731adUL, 0x2ed0f6c4UL, 0x6581fc55UL, 0xadcab1d5UL, 0xae2daca1UL, 0x6db7d4a2UL, 0x500c9bc1UL,
+ 0xf2402288UL, 0x384f6e0cUL, 0xd7bfe4a4UL, 0x72a25b4fUL, 0x2f1d4c56UL, 0x19539cc5UL, 0x54e349b9UL, 0xfe6946b0UL,
+ 0x8aabb6b1UL, 0xdd5813c7UL, 0x45c58563UL, 0x5d930f11UL, 0xd58a5357UL, 0x9304396aUL, 0xe0373de6UL, 0xb3f6542aUL,
+ 0x5f7d783aUL, 0xb5a07662UL, 0xdffca619UL, 0x6a20427aUL, 0xd5d4f929UL, 0x91181bf6UL, 0x5e2772bbUL, 0x678150aaUL,
+ 0x91109038UL, 0xeb05b5c6UL, 0x8ccbc784UL, 0x0f5ad72aUL, 0x27144a87UL, 0x6b93d1a2UL, 0xaf86d22aUL, 0x91d256aaUL,
+ 0x604389d7UL, 0x0d755c42UL, 0x269eb393UL, 0xc9847118UL, 0x2db3006cUL, 0x14bbe273UL, 0x3cbcbea0UL, 0x79376254UL,
+ 0xab9e4564UL, 0x828b323fUL, 0x82cf1877UL, 0xa6cea259UL, 0x2e00ee04UL, 0xe678fe89UL, 0x5009ab3fUL, 0xc2f65f32UL,
+ 0x053f3881UL, 0xc8c56369UL, 0xd65acb76UL, 0xc97499d4UL, 0xcf0d18caUL, 0xd5820738UL, 0xf65cfac7UL, 0x1115c38aUL,
+ 0x139ee735UL, 0xd091da47UL, 0x86900ff4UL, 0x9e41e2a7UL, 0x41623631UL, 0x95f41e05UL, 0x043b57aaUL, 0x8d5d804aUL,
+ 0xd0008354UL, 0x3c2a3200UL, 0xdfcd64bfUL, 0x8ea657baUL, 0x2b37c675UL, 0x41d3af50UL, 0x7532c1a7UL, 0xf50b5a91UL,
+ 0xabbf546bUL, 0x26140b2bUL, 0xd7c94cabUL, 0x82cd9c44UL, 0x65f2fbf7UL, 0xf3c585abUL, 0x94db551bUL, 0x24e3d4aaUL,
+ 0x3fbda4cfUL, 0xe2a3ea2dUL, 0x024d209eUL, 0xac25bdc8UL, 0xb355dfeaUL, 0x989ebdd5UL, 0xb23112e3UL, 0x6cadd52aUL,
+ 0xde294395UL, 0x2845beadUL, 0x690f71d8UL, 0x0fc951aaUL, 0xf66b78aaUL, 0x1e3f5122UL, 0x9ba751aaUL, 0xcc44d32aUL,
+ 0xf0415a7bUL, 0xadfb7cd3UL, 0x0595061bUL, 0x91e4ec41UL, 0xe632c3b4UL, 0xd4682203UL, 0xcc0a60c9UL, 0x6d7e38ceUL,
+ 0x6cb16bbfUL, 0x78fb706aUL, 0xc9d9030dUL, 0xde39dfd4UL, 0xda6310e0UL, 0x64f43647UL, 0xd828d35aUL, 0x96cc47b3UL,
+ 0xc30fbb75UL, 0xfb1b5198UL, 0x35ccfb4fUL, 0x6acf8bb5UL, 0xbc0a1fe1UL, 0x4afec5bfUL, 0x10ec0aa7UL, 0x0a5739acUL,
+ 0x2f44043fUL, 0x53b18861UL, 0x2e7a39e0UL, 0x79cb2757UL, 0x8f41eb9cUL, 0x8dd6ac1cUL, 0x967cd32aUL, 0x9dcb7501UL,
+ 0x09ff9dc6UL, 0xf0655bc7UL, 0xd840dbd9UL, 0x79770eecUL, 0xd4ea4447UL, 0x74321cb1UL, 0x9ecb24ddUL, 0xbd541c7eUL,
+ 0xf94411f0UL, 0xb10e24d2UL, 0xfdb37596UL, 0x5537aca3UL, 0xaf277cd4UL, 0x4d5fc851UL, 0x96759056UL, 0xe615bba5UL,
+ 0xf0040358UL, 0xf12c04caUL, 0xea371a01UL, 0xdbaabf8dUL, 0x4a3eba35UL, 0xa0ff2635UL, 0x094d7bc3UL, 0xd96e30bcUL,
+ 0x6626a598UL, 0x25f74856UL, 0x9d565effUL, 0xd063ed0cUL, 0xcfb2637cUL, 0xe1450b70UL, 0xf150ead5UL, 0x7228a985UL,
+ 0xa7bd1fafUL, 0x704823d4UL, 0xf30b87a7UL, 0x794d3b2dUL, 0x9841e042UL, 0xe7edd00cUL, 0xb80d4726UL, 0x4c8181f8UL,
+ 0xd76a4d47UL, 0x5c5e0c7cUL, 0x591923d1UL, 0x98721b38UL, 0xdbf4d2f5UL, 0x538683abUL, 0x231e2f6eUL, 0x9e9c7183UL,
+ 0x46e091bdUL, 0x6e45569aUL, 0x0c2039dcUL, 0x71c5c820UL, 0x1cda2b96UL, 0xff96e6e1UL, 0x08ab41b1UL, 0xb989ca7cUL,
+ 0x83e7691aUL, 0x4348cc02UL, 0x79c5f7a2UL, 0x7df49e42UL, 0x9c167b42UL, 0x49f0c95aUL, 0x000f8fddUL, 0xbf65815cUL};
const uint32_t s2[] PROGMEM = {
-0x9410201fUL, 0x5ba70befUL, 0x7ecfe369UL, 0x80433f39UL, 0x7acf61feUL, 0x7a20c5eeUL, 0x949c8855UL, 0x5106fc72UL,
-0x79efa7adUL, 0x35721d4eUL, 0xce635ad5UL, 0xba3604deUL, 0xef30c499UL, 0x94070c5fUL, 0x7ddbdc18UL, 0xf3efd6a1UL,
-0x7b2fb5a0UL, 0x0536e859UL, 0x94b015eeUL, 0x09d9ffe9UL, 0x860044dcUL, 0x594494efUL, 0xb3cc83baUL, 0xfbcdc3e0UL,
-0x8141dad1UL, 0xb12a093bUL, 0xc1f197f9UL, 0x7bcfe6a5UL, 0xdb0d4201UL, 0x5befe7e4UL, 0x41ffa125UL, 0x06f880e1UL,
-0x8010c41fUL, 0x7aee9b17UL, 0xa9c67ad3UL, 0xa43058feUL, 0x7f8bde98UL, 0x4e3fe877UL, 0x69929279UL, 0x7b9ffa24UL,
-0x5bc813e1UL, 0x8300c4acUL, 0x253550d7UL, 0x5f61eaf7UL, 0x54311462UL, 0x634b550dUL, 0x2111685dUL, 0x59c366c8UL,
-0x73cf633dUL, 0xc034e2ceUL, 0x877ed8d4UL, 0x212b675cUL, 0x81611f07UL, 0x7f62f739UL, 0x84301e36UL, 0x3b57ebe4UL,
-0xa4642f60UL, 0x9ccd3ad6UL, 0x3546bc1bUL, 0x2d03819eUL, 0x0cf50127UL, 0xb47a8499UL, 0x79dfe3a0UL, 0x8cf36cbaUL,
-0x94308410UL, 0x5ea93725UL, 0xfe6f6ff4UL, 0x1f3bffa1UL, 0x6afb8c20UL, 0x748c458fUL, 0x27a2e0d9UL, 0x343ac74eUL,
-0x694f88fcUL, 0xdfe84d3eUL, 0x88000eefUL, 0x8d645935UL, 0x8c38458aUL, 0x6643801dUL, 0xfd9b1d72UL, 0xbb8486a5UL,
-0x336325e8UL, 0x12824e84UL, 0x98808d12UL, 0xb43fd3feUL, 0xe10a28ceUL, 0xa59be127UL, 0x52c2a6d5UL, 0xbd5497e4UL,
-0xdd55d6c5UL, 0x647066ebUL, 0x4d0b8477UL, 0x01a8b6a1UL, 0xa926db84UL, 0x1467b5e0UL, 0xb743f021UL, 0x6058d0e5UL,
-0x8430f054UL, 0x72f46f06UL, 0x53a11aa3UL, 0x5547dcdaUL, 0xbf5d62b5UL, 0xe61b5668UL, 0x946bca83UL, 0x3bd26e2dUL,
-0xdb01cfecUL, 0xbad0d3a6UL, 0x5c3d80b6UL, 0x09a777afUL, 0x4ca3b433UL, 0xd6c87b39UL, 0x952be25eUL, 0x04530e5fUL,
-0x616fed81UL, 0x6443e720UL, 0x78135eb4UL, 0x9b6318deUL, 0x22a11c88UL, 0xd12667b9UL, 0xe8a74980UL, 0x7bdab722UL,
-0x252d555eUL, 0x37d27252UL, 0x1c95d279UL, 0x4c890dc6UL, 0x02b48c48UL, 0x5bfea41bUL, 0x6b9fb0a4UL, 0xcf15a81cUL,
-0x05300ca2UL, 0x63df7188UL, 0xcb2fdeb9UL, 0xe9c9c60cUL, 0x53ffee0bUL, 0x174521e3UL, 0x352854b4UL, 0x3c29639fUL,
-0x29e741eeUL, 0x7c2d1d6eUL, 0x86520450UL, 0xf385661eUL, 0xc60134f3UL, 0x952ca230UL, 0x5008a731UL, 0x130f9360UL,
-0x1784f973UL, 0x599826a1UL, 0x445c64ecUL, 0xa977c852UL, 0xa633ffcdUL, 0x41172ba0UL, 0xa2d9ba7cUL, 0x6f038021UL,
-0x089cd950UL, 0x61483fcbUL, 0x65d76bc2UL, 0xabf6a364UL, 0x76263480UL, 0x7b5ea725UL, 0xfcd1e6e4UL, 0xe610c720UL,
-0x80b6f0cdUL, 0x3b4d8417UL, 0x4df8ee31UL, 0xe424087eUL, 0xeb49cb2cUL, 0xae3b6a84UL, 0x8878f78fUL, 0xf6605deeUL,
-0x7356f77aUL, 0xdb5cdd2fUL, 0xc13116a1UL, 0x436ff630UL, 0x54ecfab3UL, 0xfad77f15UL, 0xcc7985efUL, 0x58de52d1UL,
-0x5efd2fdbUL, 0x19ce328fUL, 0x7af96a30UL, 0xf83ef002UL, 0xd59a3199UL, 0x0ffa42c2UL, 0xb0ebe3a7UL, 0x06498ec6UL,
-0x0c23dab8UL, 0x28308280UL, 0xc8f3dedcUL, 0x71b15fd3UL, 0xc81b8a08UL, 0x60c5c0beUL, 0xe8c9a361UL, 0x4df5a8bcUL,
-0xfaef2fc7UL, 0x992e8222UL, 0xb470c582UL, 0x894ed9d8UL, 0xbc341c8bUL, 0xe6161e30UL, 0x79e93b27UL, 0xa6eaffb0UL,
-0xc6b8d961UL, 0x6948b200UL, 0x3fceffb7UL, 0x3b28dc08UL, 0x5af6da43UL, 0x9897e1f7UL, 0x2fb71976UL, 0xa49b1c8fUL,
-0xa03786dcUL, 0xb1d3a716UL, 0xb793c39fUL, 0xeb6e13a7UL, 0x3ec6bcc6UL, 0x4237511aUL, 0xbc2868efUL, 0xd6650352UL,
-0xab776a2dUL, 0x4bed2735UL, 0x16d21f82UL, 0x2e6e5c09UL, 0xfbf292dbUL, 0xcb29ea5eUL, 0xf5925814UL, 0x7f4f5891UL,
-0x7b698354UL, 0xcca86726UL, 0x48601985UL, 0xeaac4b8cUL, 0xd4603883UL, 0xf9e0230dUL, 0x8a7e386cUL, 0x49d2e60aUL,
-0x0c6084b2UL, 0x1d7335d8UL, 0x47c6b1dcUL, 0xea564cacUL, 0xb381bd3eUL, 0xb0ab0e23UL, 0x87bc3864UL, 0xfab1b5f0UL,
-0xb3a25e8fUL, 0x424618fcUL, 0x7a6b030aUL, 0xbd89b04fUL, 0x89a59d64UL, 0x5e4145a3UL, 0x2383035cUL, 0xb93b5d3eUL,
-0x7295d743UL, 0x7cd06d7eUL, 0x1edfdf06UL, 0xefc46c6cUL, 0x39a56071UL, 0x70bebf73UL, 0x05768783UL, 0xf1ec2345UL};
+ 0x9410201fUL, 0x5ba70befUL, 0x7ecfe369UL, 0x80433f39UL, 0x7acf61feUL, 0x7a20c5eeUL, 0x949c8855UL, 0x5106fc72UL,
+ 0x79efa7adUL, 0x35721d4eUL, 0xce635ad5UL, 0xba3604deUL, 0xef30c499UL, 0x94070c5fUL, 0x7ddbdc18UL, 0xf3efd6a1UL,
+ 0x7b2fb5a0UL, 0x0536e859UL, 0x94b015eeUL, 0x09d9ffe9UL, 0x860044dcUL, 0x594494efUL, 0xb3cc83baUL, 0xfbcdc3e0UL,
+ 0x8141dad1UL, 0xb12a093bUL, 0xc1f197f9UL, 0x7bcfe6a5UL, 0xdb0d4201UL, 0x5befe7e4UL, 0x41ffa125UL, 0x06f880e1UL,
+ 0x8010c41fUL, 0x7aee9b17UL, 0xa9c67ad3UL, 0xa43058feUL, 0x7f8bde98UL, 0x4e3fe877UL, 0x69929279UL, 0x7b9ffa24UL,
+ 0x5bc813e1UL, 0x8300c4acUL, 0x253550d7UL, 0x5f61eaf7UL, 0x54311462UL, 0x634b550dUL, 0x2111685dUL, 0x59c366c8UL,
+ 0x73cf633dUL, 0xc034e2ceUL, 0x877ed8d4UL, 0x212b675cUL, 0x81611f07UL, 0x7f62f739UL, 0x84301e36UL, 0x3b57ebe4UL,
+ 0xa4642f60UL, 0x9ccd3ad6UL, 0x3546bc1bUL, 0x2d03819eUL, 0x0cf50127UL, 0xb47a8499UL, 0x79dfe3a0UL, 0x8cf36cbaUL,
+ 0x94308410UL, 0x5ea93725UL, 0xfe6f6ff4UL, 0x1f3bffa1UL, 0x6afb8c20UL, 0x748c458fUL, 0x27a2e0d9UL, 0x343ac74eUL,
+ 0x694f88fcUL, 0xdfe84d3eUL, 0x88000eefUL, 0x8d645935UL, 0x8c38458aUL, 0x6643801dUL, 0xfd9b1d72UL, 0xbb8486a5UL,
+ 0x336325e8UL, 0x12824e84UL, 0x98808d12UL, 0xb43fd3feUL, 0xe10a28ceUL, 0xa59be127UL, 0x52c2a6d5UL, 0xbd5497e4UL,
+ 0xdd55d6c5UL, 0x647066ebUL, 0x4d0b8477UL, 0x01a8b6a1UL, 0xa926db84UL, 0x1467b5e0UL, 0xb743f021UL, 0x6058d0e5UL,
+ 0x8430f054UL, 0x72f46f06UL, 0x53a11aa3UL, 0x5547dcdaUL, 0xbf5d62b5UL, 0xe61b5668UL, 0x946bca83UL, 0x3bd26e2dUL,
+ 0xdb01cfecUL, 0xbad0d3a6UL, 0x5c3d80b6UL, 0x09a777afUL, 0x4ca3b433UL, 0xd6c87b39UL, 0x952be25eUL, 0x04530e5fUL,
+ 0x616fed81UL, 0x6443e720UL, 0x78135eb4UL, 0x9b6318deUL, 0x22a11c88UL, 0xd12667b9UL, 0xe8a74980UL, 0x7bdab722UL,
+ 0x252d555eUL, 0x37d27252UL, 0x1c95d279UL, 0x4c890dc6UL, 0x02b48c48UL, 0x5bfea41bUL, 0x6b9fb0a4UL, 0xcf15a81cUL,
+ 0x05300ca2UL, 0x63df7188UL, 0xcb2fdeb9UL, 0xe9c9c60cUL, 0x53ffee0bUL, 0x174521e3UL, 0x352854b4UL, 0x3c29639fUL,
+ 0x29e741eeUL, 0x7c2d1d6eUL, 0x86520450UL, 0xf385661eUL, 0xc60134f3UL, 0x952ca230UL, 0x5008a731UL, 0x130f9360UL,
+ 0x1784f973UL, 0x599826a1UL, 0x445c64ecUL, 0xa977c852UL, 0xa633ffcdUL, 0x41172ba0UL, 0xa2d9ba7cUL, 0x6f038021UL,
+ 0x089cd950UL, 0x61483fcbUL, 0x65d76bc2UL, 0xabf6a364UL, 0x76263480UL, 0x7b5ea725UL, 0xfcd1e6e4UL, 0xe610c720UL,
+ 0x80b6f0cdUL, 0x3b4d8417UL, 0x4df8ee31UL, 0xe424087eUL, 0xeb49cb2cUL, 0xae3b6a84UL, 0x8878f78fUL, 0xf6605deeUL,
+ 0x7356f77aUL, 0xdb5cdd2fUL, 0xc13116a1UL, 0x436ff630UL, 0x54ecfab3UL, 0xfad77f15UL, 0xcc7985efUL, 0x58de52d1UL,
+ 0x5efd2fdbUL, 0x19ce328fUL, 0x7af96a30UL, 0xf83ef002UL, 0xd59a3199UL, 0x0ffa42c2UL, 0xb0ebe3a7UL, 0x06498ec6UL,
+ 0x0c23dab8UL, 0x28308280UL, 0xc8f3dedcUL, 0x71b15fd3UL, 0xc81b8a08UL, 0x60c5c0beUL, 0xe8c9a361UL, 0x4df5a8bcUL,
+ 0xfaef2fc7UL, 0x992e8222UL, 0xb470c582UL, 0x894ed9d8UL, 0xbc341c8bUL, 0xe6161e30UL, 0x79e93b27UL, 0xa6eaffb0UL,
+ 0xc6b8d961UL, 0x6948b200UL, 0x3fceffb7UL, 0x3b28dc08UL, 0x5af6da43UL, 0x9897e1f7UL, 0x2fb71976UL, 0xa49b1c8fUL,
+ 0xa03786dcUL, 0xb1d3a716UL, 0xb793c39fUL, 0xeb6e13a7UL, 0x3ec6bcc6UL, 0x4237511aUL, 0xbc2868efUL, 0xd6650352UL,
+ 0xab776a2dUL, 0x4bed2735UL, 0x16d21f82UL, 0x2e6e5c09UL, 0xfbf292dbUL, 0xcb29ea5eUL, 0xf5925814UL, 0x7f4f5891UL,
+ 0x7b698354UL, 0xcca86726UL, 0x48601985UL, 0xeaac4b8cUL, 0xd4603883UL, 0xf9e0230dUL, 0x8a7e386cUL, 0x49d2e60aUL,
+ 0x0c6084b2UL, 0x1d7335d8UL, 0x47c6b1dcUL, 0xea564cacUL, 0xb381bd3eUL, 0xb0ab0e23UL, 0x87bc3864UL, 0xfab1b5f0UL,
+ 0xb3a25e8fUL, 0x424618fcUL, 0x7a6b030aUL, 0xbd89b04fUL, 0x89a59d64UL, 0x5e4145a3UL, 0x2383035cUL, 0xb93b5d3eUL,
+ 0x7295d743UL, 0x7cd06d7eUL, 0x1edfdf06UL, 0xefc46c6cUL, 0x39a56071UL, 0x70bebf73UL, 0x05768783UL, 0xf1ec2345UL};
const uint32_t s3[] PROGMEM = {
-0x40c2ef8dUL, 0x9f5dfa25UL, 0xbf3d90ebUL, 0x07c910e8UL, 0xff7f6047UL, 0x4be49f36UL, 0x44c61f8cUL, 0x90caceaeUL,
-0xbff9b1beUL, 0xeacafbeeUL, 0x5019cfe8UL, 0xae07df51UL, 0x06880e92UL, 0x4805adf0UL, 0x838d3ce1UL, 0xd5107092UL,
-0x9f7d1011UL, 0xb97d6407UL, 0xd4e4e3b2UL, 0x5e284f3dUL, 0x20a8afb9UL, 0xe082defaUL, 0x8b2667a0UL, 0x2e797282UL,
-0xc0b23f55UL, 0x2be29a48UL, 0x9497efd4UL, 0xbc3f5e12UL, 0xeefcff21UL, 0xfd1b5b82UL, 0xedc55592UL, 0x40a25712UL,
-0x02831a4eUL, 0xff7fe0baUL, 0xe7468252UL, 0x0e14578eUL, 0xbff77333UL, 0x88819f8cUL, 0xe84efca6UL, 0xa5b582c9UL,
-0xb71dc0a8UL, 0x64c29f57UL, 0x314f0967UL, 0x5f3fbdf2UL, 0xc1f7ff40UL, 0xfc8db71fUL, 0xc1d26b8eUL, 0x9be57b43UL,
-0xbf3db099UL, 0x4bc6dbb5UL, 0xe6c08d63UL, 0x999d8155UL, 0x1cc897a1UL, 0x6e2d014aUL, 0x284a88c5UL, 0x716fc3ccUL,
-0x13c243b8UL, 0xf143076cUL, 0x3c890983UL, 0x5fdded0fUL, 0x50e87f2fUL, 0x7e7fc0d7UL, 0xbf7f5002UL, 0x049afb5aUL,
-0xd0d247a7UL, 0x2e195116UL, 0x3ebf70afUL, 0x8013c358UL, 0x2e30985fUL, 0xc4c37c72UL, 0x02b40f0aUL, 0x82ef7f0fUL,
-0xadfd968cUL, 0xae2a2c5dUL, 0x499ae98eUL, 0xb888da50UL, 0xa0f42784UL, 0x9057ac1eUL, 0x49b46f79UL, 0x15dc5282UL,
-0x9b7dbdefUL, 0x7d5972a6UL, 0xd840a8adUL, 0x0445f545UL, 0x03745dfaUL, 0x05c33ee8UL, 0x1a75914fUL, 0xc2695692UL,
-0x41e9ef23UL, 0x2ef103a9UL, 0xf20d2760UL, 0xb6e47602UL, 0x7465fd94UL, 0xb2857992UL, 0xcbdb7682UL, 0x76817702UL,
-0x8d91aff8UL, 0x9ef7484eUL, 0xdf6d618fUL, 0x0e849de2UL, 0x837d2f84UL, 0xc8e50c34UL, 0x82b6bb96UL, 0x48b1b493UL,
-0xab3c30efUL, 0x28af4f98UL, 0x9baf9f77UL, 0x0d56dc92UL, 0x201e4d22UL, 0x88aa3784UL, 0x96dc297dUL, 0xdcd35627UL,
-0xee7c908bUL, 0x40d21fb5UL, 0xe37cc0e7UL, 0xa1b466e5UL, 0x5e61e9c3UL, 0x9d20f83cUL, 0xe3d19460UL, 0x41a39ccdUL,
-0x0e46765cUL, 0x3b98ea00UL, 0x8178d6d4UL, 0x2c5747fdUL, 0xd9ed6cf7UL, 0x9c22a8bdUL, 0xaaad7d12UL, 0x4e078a43UL,
-0x90c0971fUL, 0x8adb1b08UL, 0xbe7ea093UL, 0x15ca38b9UL, 0xff3cb097UL, 0xf8c0c23dUL, 0xecb21a8dUL, 0x510e3864UL,
-0xfb7bcc68UL, 0x88270fd9UL, 0x81014912UL, 0xd4ffe55dUL, 0x6af87eddUL, 0x14e2a276UL, 0x6803a4b9UL, 0x8f955d92UL,
-0xfaff394bUL, 0xe9ae39baUL, 0x0bd3ffa4UL, 0x3b93f7faUL, 0x2386496dUL, 0xfabc3c19UL, 0x45756227UL, 0x7af45c82UL,
-0xa08bbd61UL, 0xd1421ed1UL, 0xf404adceUL, 0x92a37e12UL, 0xb78d4210UL, 0x72a97282UL, 0xa8c47092UL, 0x0be57d12UL,
-0xc8a15b28UL, 0x4ff4623cUL, 0xa5eac035UL, 0x31d205e8UL, 0xfb298942UL, 0x82dffcb4UL, 0x536ab64fUL, 0x5bc17d0eUL,
-0xab1f081fUL, 0xae188610UL, 0x6d08fdfcUL, 0x8928fff9UL, 0x11cc4b69UL, 0xae5c6a23UL, 0x4dcade12UL, 0xc58c3f2cUL,
-0xfe2dd0d2UL, 0x9658eff8UL, 0xda52cfe4UL, 0x675b1595UL, 0x8c484a49UL, 0x0ca8b6b9UL, 0xbc828f5cUL, 0x456bd389UL,
-0x3794603aUL, 0xa9c900ecUL, 0x53527144UL, 0x494b870aUL, 0x40bc73d7UL, 0x1c67347cUL, 0xf67e7102UL, 0x3655eb4fUL,
-0xff2fd0a2UL, 0xc460bfd2UL, 0xc0033fd4UL, 0x6defb450UL, 0xd18c4707UL, 0x88186e00UL, 0x553fe5a2UL, 0xbcd4e6b9UL,
-0x168004a2UL, 0x33385797UL, 0x677d20d7UL, 0x3d8f0fdeUL, 0x337bf872UL, 0x334fccabUL, 0x5dc58876UL, 0xb0a6007bUL,
-0x01007b94UL, 0xd2750057UL, 0xf888bbf9UL, 0x9e014289UL, 0xffa56442UL, 0xe0026385UL, 0x2bd9db72UL, 0x691b97eeUL,
-0xde2fa26eUL, 0x2bae085fUL, 0x6d617aafUL, 0x6787c9e5UL, 0xd2eb1fcfUL, 0xc2c8ef61UL, 0x7125acf1UL, 0xc23982ccUL,
-0xb84c2167UL, 0xd183e5b1UL, 0x623edcb7UL, 0xcebd107fUL, 0x385c0af9UL, 0x3d44f00fUL, 0xc66d6e60UL, 0x493a5460UL,
-0x48c12757UL, 0x1d8ae92bUL, 0x3817b48aUL, 0x24bee120UL, 0x0fda96afUL, 0x25844568UL, 0xe53b8399UL, 0x7d450d60UL,
-0x50932f28UL, 0x62b33483UL, 0x20111dd9UL, 0xa08d6d2bUL, 0x311e2b64UL, 0x005a309cUL, 0x88e6bc52UL, 0x8a58031bUL,
-0xd5efbaf7UL, 0x9ced4241UL, 0x115c31a4UL, 0xc53e3283UL, 0x3646efdfUL, 0x01c533a1UL, 0x1c53d3e9UL, 0x833735eeUL};
+ 0x40c2ef8dUL, 0x9f5dfa25UL, 0xbf3d90ebUL, 0x07c910e8UL, 0xff7f6047UL, 0x4be49f36UL, 0x44c61f8cUL, 0x90caceaeUL,
+ 0xbff9b1beUL, 0xeacafbeeUL, 0x5019cfe8UL, 0xae07df51UL, 0x06880e92UL, 0x4805adf0UL, 0x838d3ce1UL, 0xd5107092UL,
+ 0x9f7d1011UL, 0xb97d6407UL, 0xd4e4e3b2UL, 0x5e284f3dUL, 0x20a8afb9UL, 0xe082defaUL, 0x8b2667a0UL, 0x2e797282UL,
+ 0xc0b23f55UL, 0x2be29a48UL, 0x9497efd4UL, 0xbc3f5e12UL, 0xeefcff21UL, 0xfd1b5b82UL, 0xedc55592UL, 0x40a25712UL,
+ 0x02831a4eUL, 0xff7fe0baUL, 0xe7468252UL, 0x0e14578eUL, 0xbff77333UL, 0x88819f8cUL, 0xe84efca6UL, 0xa5b582c9UL,
+ 0xb71dc0a8UL, 0x64c29f57UL, 0x314f0967UL, 0x5f3fbdf2UL, 0xc1f7ff40UL, 0xfc8db71fUL, 0xc1d26b8eUL, 0x9be57b43UL,
+ 0xbf3db099UL, 0x4bc6dbb5UL, 0xe6c08d63UL, 0x999d8155UL, 0x1cc897a1UL, 0x6e2d014aUL, 0x284a88c5UL, 0x716fc3ccUL,
+ 0x13c243b8UL, 0xf143076cUL, 0x3c890983UL, 0x5fdded0fUL, 0x50e87f2fUL, 0x7e7fc0d7UL, 0xbf7f5002UL, 0x049afb5aUL,
+ 0xd0d247a7UL, 0x2e195116UL, 0x3ebf70afUL, 0x8013c358UL, 0x2e30985fUL, 0xc4c37c72UL, 0x02b40f0aUL, 0x82ef7f0fUL,
+ 0xadfd968cUL, 0xae2a2c5dUL, 0x499ae98eUL, 0xb888da50UL, 0xa0f42784UL, 0x9057ac1eUL, 0x49b46f79UL, 0x15dc5282UL,
+ 0x9b7dbdefUL, 0x7d5972a6UL, 0xd840a8adUL, 0x0445f545UL, 0x03745dfaUL, 0x05c33ee8UL, 0x1a75914fUL, 0xc2695692UL,
+ 0x41e9ef23UL, 0x2ef103a9UL, 0xf20d2760UL, 0xb6e47602UL, 0x7465fd94UL, 0xb2857992UL, 0xcbdb7682UL, 0x76817702UL,
+ 0x8d91aff8UL, 0x9ef7484eUL, 0xdf6d618fUL, 0x0e849de2UL, 0x837d2f84UL, 0xc8e50c34UL, 0x82b6bb96UL, 0x48b1b493UL,
+ 0xab3c30efUL, 0x28af4f98UL, 0x9baf9f77UL, 0x0d56dc92UL, 0x201e4d22UL, 0x88aa3784UL, 0x96dc297dUL, 0xdcd35627UL,
+ 0xee7c908bUL, 0x40d21fb5UL, 0xe37cc0e7UL, 0xa1b466e5UL, 0x5e61e9c3UL, 0x9d20f83cUL, 0xe3d19460UL, 0x41a39ccdUL,
+ 0x0e46765cUL, 0x3b98ea00UL, 0x8178d6d4UL, 0x2c5747fdUL, 0xd9ed6cf7UL, 0x9c22a8bdUL, 0xaaad7d12UL, 0x4e078a43UL,
+ 0x90c0971fUL, 0x8adb1b08UL, 0xbe7ea093UL, 0x15ca38b9UL, 0xff3cb097UL, 0xf8c0c23dUL, 0xecb21a8dUL, 0x510e3864UL,
+ 0xfb7bcc68UL, 0x88270fd9UL, 0x81014912UL, 0xd4ffe55dUL, 0x6af87eddUL, 0x14e2a276UL, 0x6803a4b9UL, 0x8f955d92UL,
+ 0xfaff394bUL, 0xe9ae39baUL, 0x0bd3ffa4UL, 0x3b93f7faUL, 0x2386496dUL, 0xfabc3c19UL, 0x45756227UL, 0x7af45c82UL,
+ 0xa08bbd61UL, 0xd1421ed1UL, 0xf404adceUL, 0x92a37e12UL, 0xb78d4210UL, 0x72a97282UL, 0xa8c47092UL, 0x0be57d12UL,
+ 0xc8a15b28UL, 0x4ff4623cUL, 0xa5eac035UL, 0x31d205e8UL, 0xfb298942UL, 0x82dffcb4UL, 0x536ab64fUL, 0x5bc17d0eUL,
+ 0xab1f081fUL, 0xae188610UL, 0x6d08fdfcUL, 0x8928fff9UL, 0x11cc4b69UL, 0xae5c6a23UL, 0x4dcade12UL, 0xc58c3f2cUL,
+ 0xfe2dd0d2UL, 0x9658eff8UL, 0xda52cfe4UL, 0x675b1595UL, 0x8c484a49UL, 0x0ca8b6b9UL, 0xbc828f5cUL, 0x456bd389UL,
+ 0x3794603aUL, 0xa9c900ecUL, 0x53527144UL, 0x494b870aUL, 0x40bc73d7UL, 0x1c67347cUL, 0xf67e7102UL, 0x3655eb4fUL,
+ 0xff2fd0a2UL, 0xc460bfd2UL, 0xc0033fd4UL, 0x6defb450UL, 0xd18c4707UL, 0x88186e00UL, 0x553fe5a2UL, 0xbcd4e6b9UL,
+ 0x168004a2UL, 0x33385797UL, 0x677d20d7UL, 0x3d8f0fdeUL, 0x337bf872UL, 0x334fccabUL, 0x5dc58876UL, 0xb0a6007bUL,
+ 0x01007b94UL, 0xd2750057UL, 0xf888bbf9UL, 0x9e014289UL, 0xffa56442UL, 0xe0026385UL, 0x2bd9db72UL, 0x691b97eeUL,
+ 0xde2fa26eUL, 0x2bae085fUL, 0x6d617aafUL, 0x6787c9e5UL, 0xd2eb1fcfUL, 0xc2c8ef61UL, 0x7125acf1UL, 0xc23982ccUL,
+ 0xb84c2167UL, 0xd183e5b1UL, 0x623edcb7UL, 0xcebd107fUL, 0x385c0af9UL, 0x3d44f00fUL, 0xc66d6e60UL, 0x493a5460UL,
+ 0x48c12757UL, 0x1d8ae92bUL, 0x3817b48aUL, 0x24bee120UL, 0x0fda96afUL, 0x25844568UL, 0xe53b8399UL, 0x7d450d60UL,
+ 0x50932f28UL, 0x62b33483UL, 0x20111dd9UL, 0xa08d6d2bUL, 0x311e2b64UL, 0x005a309cUL, 0x88e6bc52UL, 0x8a58031bUL,
+ 0xd5efbaf7UL, 0x9ced4241UL, 0x115c31a4UL, 0xc53e3283UL, 0x3646efdfUL, 0x01c533a1UL, 0x1c53d3e9UL, 0x833735eeUL};
const uint32_t s4[] PROGMEM = {
-0x2004b39dUL, 0xdee9b61fUL, 0xef7bbea7UL, 0x98a273d2UL, 0xdb7b4f4aUL, 0x578cad64UL, 0x43045185UL, 0xd10e02faUL,
-0xff7a287eUL, 0x63b60fe6UL, 0xa1355f09UL, 0x20f1eb79UL, 0x439d05fdUL, 0xb1b79764UL, 0x631f64f3UL, 0xdf4a1e24UL,
-0x5f7f1428UL, 0xcdb8a24fUL, 0x400043c9UL, 0x2022c30cUL, 0x300bd3fdUL, 0x4f37a5c0UL, 0xd9002d1dUL, 0x157b1424UL,
-0x1a114deeUL, 0x6751ca0fUL, 0x4c90ff71UL, 0xfe5f192dUL, 0x5f64051aUL, 0xfefe130cUL, 0xca081b08UL, 0x21011705UL,
-0x00015380UL, 0xfe5e3ee8UL, 0xf8f49aacUL, 0x0127e77fUL, 0x5feeb8d2UL, 0x6142df06UL, 0x8a9b9ebbUL, 0x25ea9372UL,
-0xdfff84ceUL, 0x018871f5UL, 0x044bd63dUL, 0x3b266fa2UL, 0x0084d47eUL, 0xe6eb7e54UL, 0xa04c6d44UL, 0xf5d6f36cUL,
-0xdfab4926UL, 0xf5c7a0aeUL, 0xc18c3336UL, 0x937e3f50UL, 0x612077d3UL, 0xe138b611UL, 0x030e5072UL, 0xbbb20ef8UL,
-0x2e50e0abUL, 0xde778decUL, 0x811e9757UL, 0x46674fe1UL, 0x005433c9UL, 0x8f312069UL, 0x99bb1d08UL, 0xa504c3ffUL,
-0x0518354dUL, 0xe35c3d7fUL, 0xc666c8a6UL, 0xa9cc5b5dUL, 0xea6fecdaUL, 0x916f929fUL, 0x2f22469fUL, 0x7d469139UL,
-0x8e6dbfa5UL, 0x4fc44311UL, 0x02839543UL, 0xeb4e21d0UL, 0xb8832002UL, 0x0c18b63fUL, 0x1e93f818UL, 0xe6581628UL,
-0x3e6e4826UL, 0x708ad78bUL, 0xc1e47774UL, 0x7ce006b5UL, 0x250a2df3UL, 0x028b0979UL, 0x81bbeae4UL, 0x233b1228UL,
-0x38adde69UL, 0x16ca7415UL, 0x621b87dfUL, 0xb7401c21UL, 0xf99e1aa5UL, 0x7b371400UL, 0xc88a1e04UL, 0x03401109UL,
-0xd2e459bdUL, 0xd556d1e3UL, 0xd576e84fUL, 0x40a3912fUL, 0xdee87b55UL, 0xa7e4ea00UL, 0xecc2e50cUL, 0xa6bbb44dUL,
-0xffbd56e7UL, 0xac6933ddUL, 0x35b017ecUL, 0x27235706UL, 0xb0c8af99UL, 0x91c3c856UL, 0x1c81656bUL, 0x1961145eUL,
-0x75cb856eUL, 0x02c007beUL, 0x775532c2UL, 0xecf43f89UL, 0x2dc9bf5bUL, 0x253becd0UL, 0xb71a80b7UL, 0x243b6d8dUL,
-0xef63c720UL, 0xfca566c3UL, 0x8028389cUL, 0x0532ce0aUL, 0x8a54c9aaUL, 0xc7d7a1ecUL, 0x32fa1a04UL, 0x5a62161dUL,
-0x2c900167UL, 0x547a759bUL, 0xf777d431UL, 0x31b02691UL, 0xdb6fcc36UL, 0x468b0bc7UL, 0x486ae6d9UL, 0x795ae556UL,
-0xeb4c6a02UL, 0xff7e4352UL, 0xb4768f2fUL, 0xa580f90dUL, 0xe3cd7486UL, 0xeb04daedUL, 0x04bea917UL, 0xdff4182cUL,
-0x9d7f74b7UL, 0xb4f72aabUL, 0x204dc3efUL, 0x7c6b092eUL, 0x54a24117UL, 0x35a0b6e5UL, 0xf6423d21UL, 0x267c1c2cUL,
-0x0ff5c261UL, 0xf9da5265UL, 0xf831c2d2UL, 0x690f1325UL, 0xa27f16d8UL, 0xc8f21804UL, 0xa6961a00UL, 0xab26150dUL,
-0x215c3163UL, 0xec720a5eUL, 0xfdfeba49UL, 0xd9087918UL, 0x86bd0d8dUL, 0xa7701131UL, 0x0c649b3eUL, 0xd7103eccUL,
-0xb6d3cad5UL, 0x88c3ae0cUL, 0xe10130f7UL, 0xff8a726cUL, 0xa1e2ea71UL, 0x6ef39a1fUL, 0x2fd1cbcfUL, 0x1784dec1UL,
-0x6bbe07acUL, 0xd8a144cbUL, 0x560f9b8bUL, 0xc3883901UL, 0xca2fc5b1UL, 0xcd31beb4UL, 0x062878d8UL, 0xe2a4a312UL,
-0x32e57d6fUL, 0xb67efd58UL, 0x00e91ed0UL, 0xc2ffad24UL, 0xc50f99f4UL, 0xc5aa1197UL, 0x957b1d00UL, 0xd2e7e582UL,
-0xf6739810UL, 0x96306100UL, 0x21952dc3UL, 0xff21a1adUL, 0x15849029UL, 0x7f97bb7fUL, 0xdbb39eafUL, 0x2aedc929UL,
-0x65a4e25cUL, 0x2cf330a7UL, 0xe83faad0UL, 0x91c05c8aUL, 0xe72c9ed4UL, 0xa954e40cUL, 0x86cd0ad6UL, 0x19195f01UL,
-0x03910777UL, 0xf63aa0deUL, 0x5e56a878UL, 0xdf56e3deUL, 0xbe5cf021UL, 0x87e3758bUL, 0x5106c5b3UL, 0xefc3a5b8UL,
-0xd2b6eed8UL, 0x77be23e5UL, 0x294515c2UL, 0xdfef692fUL, 0xfb7ae6afUL, 0xb2c470f4UL, 0x5bebe0f3UL, 0x7698ccd6UL,
-0x0c46e439UL, 0x3885da1fUL, 0x2f838719UL, 0x677300caUL, 0xf84491a9UL, 0x9e296b29UL, 0x95c22f49UL, 0xabbe6692UL,
-0x696e67b5UL, 0xdaddd39bUL, 0x2f057edfUL, 0x1c7025dbUL, 0xee515e1bUL, 0xe62453f6UL, 0x6ce3fc6aUL, 0x04cc1603UL,
-0x3e214486UL, 0xd059dcb7UL, 0x1f296579UL, 0x43fdd6ccUL, 0x79398241UL, 0xf6cd2b93UL, 0x4dc357b6UL, 0x82d2df4eUL,
-0x0c29e57aUL, 0x6b53b93cUL, 0xfe201e85UL, 0x7e553398UL, 0xb0f0ec13UL, 0x72b3ffd3UL, 0xc1c5853fUL, 0xd27eef0aUL};
+ 0x2004b39dUL, 0xdee9b61fUL, 0xef7bbea7UL, 0x98a273d2UL, 0xdb7b4f4aUL, 0x578cad64UL, 0x43045185UL, 0xd10e02faUL,
+ 0xff7a287eUL, 0x63b60fe6UL, 0xa1355f09UL, 0x20f1eb79UL, 0x439d05fdUL, 0xb1b79764UL, 0x631f64f3UL, 0xdf4a1e24UL,
+ 0x5f7f1428UL, 0xcdb8a24fUL, 0x400043c9UL, 0x2022c30cUL, 0x300bd3fdUL, 0x4f37a5c0UL, 0xd9002d1dUL, 0x157b1424UL,
+ 0x1a114deeUL, 0x6751ca0fUL, 0x4c90ff71UL, 0xfe5f192dUL, 0x5f64051aUL, 0xfefe130cUL, 0xca081b08UL, 0x21011705UL,
+ 0x00015380UL, 0xfe5e3ee8UL, 0xf8f49aacUL, 0x0127e77fUL, 0x5feeb8d2UL, 0x6142df06UL, 0x8a9b9ebbUL, 0x25ea9372UL,
+ 0xdfff84ceUL, 0x018871f5UL, 0x044bd63dUL, 0x3b266fa2UL, 0x0084d47eUL, 0xe6eb7e54UL, 0xa04c6d44UL, 0xf5d6f36cUL,
+ 0xdfab4926UL, 0xf5c7a0aeUL, 0xc18c3336UL, 0x937e3f50UL, 0x612077d3UL, 0xe138b611UL, 0x030e5072UL, 0xbbb20ef8UL,
+ 0x2e50e0abUL, 0xde778decUL, 0x811e9757UL, 0x46674fe1UL, 0x005433c9UL, 0x8f312069UL, 0x99bb1d08UL, 0xa504c3ffUL,
+ 0x0518354dUL, 0xe35c3d7fUL, 0xc666c8a6UL, 0xa9cc5b5dUL, 0xea6fecdaUL, 0x916f929fUL, 0x2f22469fUL, 0x7d469139UL,
+ 0x8e6dbfa5UL, 0x4fc44311UL, 0x02839543UL, 0xeb4e21d0UL, 0xb8832002UL, 0x0c18b63fUL, 0x1e93f818UL, 0xe6581628UL,
+ 0x3e6e4826UL, 0x708ad78bUL, 0xc1e47774UL, 0x7ce006b5UL, 0x250a2df3UL, 0x028b0979UL, 0x81bbeae4UL, 0x233b1228UL,
+ 0x38adde69UL, 0x16ca7415UL, 0x621b87dfUL, 0xb7401c21UL, 0xf99e1aa5UL, 0x7b371400UL, 0xc88a1e04UL, 0x03401109UL,
+ 0xd2e459bdUL, 0xd556d1e3UL, 0xd576e84fUL, 0x40a3912fUL, 0xdee87b55UL, 0xa7e4ea00UL, 0xecc2e50cUL, 0xa6bbb44dUL,
+ 0xffbd56e7UL, 0xac6933ddUL, 0x35b017ecUL, 0x27235706UL, 0xb0c8af99UL, 0x91c3c856UL, 0x1c81656bUL, 0x1961145eUL,
+ 0x75cb856eUL, 0x02c007beUL, 0x775532c2UL, 0xecf43f89UL, 0x2dc9bf5bUL, 0x253becd0UL, 0xb71a80b7UL, 0x243b6d8dUL,
+ 0xef63c720UL, 0xfca566c3UL, 0x8028389cUL, 0x0532ce0aUL, 0x8a54c9aaUL, 0xc7d7a1ecUL, 0x32fa1a04UL, 0x5a62161dUL,
+ 0x2c900167UL, 0x547a759bUL, 0xf777d431UL, 0x31b02691UL, 0xdb6fcc36UL, 0x468b0bc7UL, 0x486ae6d9UL, 0x795ae556UL,
+ 0xeb4c6a02UL, 0xff7e4352UL, 0xb4768f2fUL, 0xa580f90dUL, 0xe3cd7486UL, 0xeb04daedUL, 0x04bea917UL, 0xdff4182cUL,
+ 0x9d7f74b7UL, 0xb4f72aabUL, 0x204dc3efUL, 0x7c6b092eUL, 0x54a24117UL, 0x35a0b6e5UL, 0xf6423d21UL, 0x267c1c2cUL,
+ 0x0ff5c261UL, 0xf9da5265UL, 0xf831c2d2UL, 0x690f1325UL, 0xa27f16d8UL, 0xc8f21804UL, 0xa6961a00UL, 0xab26150dUL,
+ 0x215c3163UL, 0xec720a5eUL, 0xfdfeba49UL, 0xd9087918UL, 0x86bd0d8dUL, 0xa7701131UL, 0x0c649b3eUL, 0xd7103eccUL,
+ 0xb6d3cad5UL, 0x88c3ae0cUL, 0xe10130f7UL, 0xff8a726cUL, 0xa1e2ea71UL, 0x6ef39a1fUL, 0x2fd1cbcfUL, 0x1784dec1UL,
+ 0x6bbe07acUL, 0xd8a144cbUL, 0x560f9b8bUL, 0xc3883901UL, 0xca2fc5b1UL, 0xcd31beb4UL, 0x062878d8UL, 0xe2a4a312UL,
+ 0x32e57d6fUL, 0xb67efd58UL, 0x00e91ed0UL, 0xc2ffad24UL, 0xc50f99f4UL, 0xc5aa1197UL, 0x957b1d00UL, 0xd2e7e582UL,
+ 0xf6739810UL, 0x96306100UL, 0x21952dc3UL, 0xff21a1adUL, 0x15849029UL, 0x7f97bb7fUL, 0xdbb39eafUL, 0x2aedc929UL,
+ 0x65a4e25cUL, 0x2cf330a7UL, 0xe83faad0UL, 0x91c05c8aUL, 0xe72c9ed4UL, 0xa954e40cUL, 0x86cd0ad6UL, 0x19195f01UL,
+ 0x03910777UL, 0xf63aa0deUL, 0x5e56a878UL, 0xdf56e3deUL, 0xbe5cf021UL, 0x87e3758bUL, 0x5106c5b3UL, 0xefc3a5b8UL,
+ 0xd2b6eed8UL, 0x77be23e5UL, 0x294515c2UL, 0xdfef692fUL, 0xfb7ae6afUL, 0xb2c470f4UL, 0x5bebe0f3UL, 0x7698ccd6UL,
+ 0x0c46e439UL, 0x3885da1fUL, 0x2f838719UL, 0x677300caUL, 0xf84491a9UL, 0x9e296b29UL, 0x95c22f49UL, 0xabbe6692UL,
+ 0x696e67b5UL, 0xdaddd39bUL, 0x2f057edfUL, 0x1c7025dbUL, 0xee515e1bUL, 0xe62453f6UL, 0x6ce3fc6aUL, 0x04cc1603UL,
+ 0x3e214486UL, 0xd059dcb7UL, 0x1f296579UL, 0x43fdd6ccUL, 0x79398241UL, 0xf6cd2b93UL, 0x4dc357b6UL, 0x82d2df4eUL,
+ 0x0c29e57aUL, 0x6b53b93cUL, 0xfe201e85UL, 0x7e553398UL, 0xb0f0ec13UL, 0x72b3ffd3UL, 0xc1c5853fUL, 0xd27eef0aUL};
#endif
/* cast6-sbox.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/*
* File: cast6-sbox.h
* Author: Daniel Otte
* Description: sboxes for CAST6 (aka CAST-256) cipher algorithm as described in RFC 2612.
*
*/
-
+
#ifndef CAST6_SBOX_H_
#define CAST6_SBOX_H_
#include <avr/pgmspace.h>
#include <stdint.h>
-extern const uint32_t s1[] ;
-extern const uint32_t s2[] ;
-extern const uint32_t s3[] ;
-extern const uint32_t s4[] ;
+extern const uint32_t s1[];
+extern const uint32_t s2[];
+extern const uint32_t s3[];
+extern const uint32_t s4[];
#endif
#define CHANGE_ENDIAN32(x) (((x)<<24 | (x)>>24 | ((x)&0xff00)<<8 | ((x)&0xff0000)>>8)&0xffffffff)
-
-static
-uint8_t kr(uint8_t i, const cast6_ctx_t *ctx){
- uint8_t ret;
- ret = ctx->krx[i/2];
- if(i&1){
- ret >>= 4;
- }else{
- ret &= 0x0f;
- }
- /* now get the high bit */
- ret |= ((ctx->krx[24+i/8])&(1<<(i%8)))?0x10:0x00;
- return ret;
+static uint8_t kr(uint8_t i, const cast6_ctx_t *ctx)
+{
+ uint8_t ret;
+ ret = ctx->krx[i / 2];
+ if (i & 1) {
+ ret >>= 4;
+ } else {
+ ret &= 0x0f;
+ }
+ /* now get the high bit */
+ ret |= ((ctx->krx[24 + i / 8]) & (1 << (i % 8))) ? 0x10 : 0x00;
+ return ret;
}
static
-void set_kr(uint8_t value, uint8_t i, cast6_ctx_t *ctx){
- value &= 0x1F;
-
- (ctx->krx[i/2]) &= 0xF0>>((i&1)*4); /* clear the location where v should go */
- (ctx->krx[i/2]) |= (value&0x0f)<<((i&1)*4);
-
- /* now set the high bit */
- (ctx->krx[24+i/8]) &= ~(1<<(i%8)); /* clear the location where v should go */
- (ctx->krx[24+i/8]) |= (value>>4)<<(i%8);
+void set_kr(uint8_t value, uint8_t i, cast6_ctx_t *ctx)
+{
+ value &= 0x1F;
+
+ (ctx->krx[i / 2]) &= 0xF0 >> ((i & 1) * 4); /* clear the location where v should go */
+ (ctx->krx[i / 2]) |= (value & 0x0f) << ((i & 1) * 4);
+
+ /* now set the high bit */
+ (ctx->krx[24 + i / 8]) &= ~(1 << (i % 8)); /* clear the location where v should go */
+ (ctx->krx[24 + i / 8]) |= (value >> 4) << (i % 8);
}
#define ROTL32(a,n) (((a)<<(n))|((a)>>(32-(n))))
#define C ((uint8_t)(v>>(8*1)))
#define D ((uint8_t)(v>>(8*0)))
-
-static
-uint32_t f1(uint32_t v, uint8_t kri, uint32_t kmi){
- uint32_t o;
- kri &= 0x1F;
- v = ROTL32(kmi+v, kri);
- o = S1(A);
- o ^= S2(B);
- o -= S3(C);
- o += S4(D);
- return o;
+static uint32_t f1(uint32_t v, uint8_t kri, uint32_t kmi)
+{
+ uint32_t o;
+ kri &= 0x1F;
+ v = ROTL32(kmi + v, kri);
+ o = S1(A);
+ o ^= S2(B);
+ o -= S3(C);
+ o += S4(D);
+ return o;
}
-static
-uint32_t f2(uint32_t v, uint8_t kri, uint32_t kmi){
- uint32_t o;
- kri &= 0x1F;
- v = ROTL32(kmi^v, kri);
- o = S1(A);
- o -= S2(B);
- o += S3(C);
- o ^= S4(D);
- return o;
+static uint32_t f2(uint32_t v, uint8_t kri, uint32_t kmi)
+{
+ uint32_t o;
+ kri &= 0x1F;
+ v = ROTL32(kmi ^ v, kri);
+ o = S1(A);
+ o -= S2(B);
+ o += S3(C);
+ o ^= S4(D);
+ return o;
}
-static
-uint32_t f3(uint32_t v, uint8_t kri, uint32_t kmi){
- uint32_t o;
- kri &= 0x1F;
- v = ROTL32(kmi-v, kri);
- o = S1(A);
- o += S2(B);
- o ^= S3(C);
- o -= S4(D);
- return o;
+static uint32_t f3(uint32_t v, uint8_t kri, uint32_t kmi)
+{
+ uint32_t o;
+ kri &= 0x1F;
+ v = ROTL32(kmi - v, kri);
+ o = S1(A);
+ o += S2(B);
+ o ^= S3(C);
+ o -= S4(D);
+ return o;
}
#undef A
#define D (((uint32_t*)buffer)[3])
static
-void q(void *buffer, uint8_t i, const cast6_ctx_t *ctx){
- C ^= f1(D, kr(i*4+0, ctx), ctx->km[i][0]);
- B ^= f2(C, kr(i*4+1, ctx), ctx->km[i][1]);
- A ^= f3(B, kr(i*4+2, ctx), ctx->km[i][2]);
- D ^= f1(A, kr(i*4+3, ctx), ctx->km[i][3]);
+void q(void *buffer, uint8_t i, const cast6_ctx_t *ctx)
+{
+ C ^= f1(D, kr(i * 4 + 0, ctx), ctx->km[i][0]);
+ B ^= f2(C, kr(i * 4 + 1, ctx), ctx->km[i][1]);
+ A ^= f3(B, kr(i * 4 + 2, ctx), ctx->km[i][2]);
+ D ^= f1(A, kr(i * 4 + 3, ctx), ctx->km[i][3]);
}
static
-void qbar(void *buffer, uint8_t i, const cast6_ctx_t *ctx){
- D ^= f1(A, kr(i*4+3, ctx), ctx->km[i][3]);
- A ^= f3(B, kr(i*4+2, ctx), ctx->km[i][2]);
- B ^= f2(C, kr(i*4+1, ctx), ctx->km[i][1]);
- C ^= f1(D, kr(i*4+0, ctx), ctx->km[i][0]);
+void qbar(void *buffer, uint8_t i, const cast6_ctx_t *ctx)
+{
+ D ^= f1(A, kr(i * 4 + 3, ctx), ctx->km[i][3]);
+ A ^= f3(B, kr(i * 4 + 2, ctx), ctx->km[i][2]);
+ B ^= f2(C, kr(i * 4 + 1, ctx), ctx->km[i][1]);
+ C ^= f1(D, kr(i * 4 + 0, ctx), ctx->km[i][0]);
}
-void cast6_enc(void *buffer, const cast6_ctx_t *ctx){
- uint8_t i;
- for(i=0; i<32/4; ++i){
- ((uint32_t*)buffer)[i] = CHANGE_ENDIAN32(((uint32_t*)buffer)[i]);
- }
- for(i=0; i<6; ++i){
- q(buffer, i, ctx);
- }
- for(i=6; i<12; ++i){
- qbar(buffer, i, ctx);
- }
- for(i=0; i<32/4; ++i){
- ((uint32_t*)buffer)[i] = CHANGE_ENDIAN32(((uint32_t*)buffer)[i]);
- }
+void cast6_enc(void *buffer, const cast6_ctx_t *ctx)
+{
+ uint8_t i;
+ for (i = 0; i < 32 / 4; ++i) {
+ ((uint32_t*) buffer)[i] = CHANGE_ENDIAN32(((uint32_t* )buffer)[i]);
+ }
+ for (i = 0; i < 6; ++i) {
+ q(buffer, i, ctx);
+ }
+ for (i = 6; i < 12; ++i) {
+ qbar(buffer, i, ctx);
+ }
+ for (i = 0; i < 32 / 4; ++i) {
+ ((uint32_t*) buffer)[i] = CHANGE_ENDIAN32(((uint32_t* )buffer)[i]);
+ }
}
-void cast6_dec(void *buffer, const cast6_ctx_t *ctx){
- uint8_t i;
- for(i=0; i<32/4; ++i){
- ((uint32_t*)buffer)[i] = CHANGE_ENDIAN32(((uint32_t*)buffer)[i]);
- }
- for(i=12; i>6; --i){
- q(buffer, i-1, ctx);
- }
- for(i=6; i>0; --i){
- qbar(buffer, i-1, ctx);
- }
- for(i=0; i<32/4; ++i){
- ((uint32_t*)buffer)[i] = CHANGE_ENDIAN32(((uint32_t*)buffer)[i]);
- }
+void cast6_dec(void *buffer, const cast6_ctx_t *ctx)
+{
+ uint8_t i;
+ for (i = 0; i < 32 / 4; ++i) {
+ ((uint32_t*) buffer)[i] = CHANGE_ENDIAN32(((uint32_t* )buffer)[i]);
+ }
+ for (i = 12; i > 6; --i) {
+ q(buffer, i - 1, ctx);
+ }
+ for (i = 6; i > 0; --i) {
+ qbar(buffer, i - 1, ctx);
+ }
+ for (i = 0; i < 32 / 4; ++i) {
+ ((uint32_t*) buffer)[i] = CHANGE_ENDIAN32(((uint32_t* )buffer)[i]);
+ }
}
-
#undef A
#undef B
#undef C
/*
* we might later make it optional to use this small thing
+ static
+ void w(void *buffer, uint8_t *tr, uint32_t *tm){
+ G ^= f1(H, (tr[0]&0x0f)+(tr[5]&0x01)?0x10:0x00, tm[0]);
+ F ^= f2(G, (tr[0]>>4) +(tr[5]&0x02)?0x10:0x00, tm[1]);
+ E ^= f3(F, (tr[1]&0x0f)+(tr[5]&0x04)?0x10:0x00, tm[2]);
+ D ^= f1(E, (tr[1]>>4) +(tr[5]&0x08)?0x10:0x00, tm[3]);
+ C ^= f2(D, (tr[2]&0x0f)+(tr[5]&0x10)?0x10:0x00, tm[4]);
+ B ^= f3(C, (tr[2]>>4) +(tr[5]&0x20)?0x10:0x00, tm[5]);
+ A ^= f1(B, (tr[3]&0x0f)+(tr[5]&0x40)?0x10:0x00, tm[6]);
+ H ^= f2(A, (tr[3]>>4) +(tr[5]&0x80)?0x10:0x00, tm[7]);
+ }
+ */
static
-void w(void *buffer, uint8_t *tr, uint32_t *tm){
- G ^= f1(H, (tr[0]&0x0f)+(tr[5]&0x01)?0x10:0x00, tm[0]);
- F ^= f2(G, (tr[0]>>4) +(tr[5]&0x02)?0x10:0x00, tm[1]);
- E ^= f3(F, (tr[1]&0x0f)+(tr[5]&0x04)?0x10:0x00, tm[2]);
- D ^= f1(E, (tr[1]>>4) +(tr[5]&0x08)?0x10:0x00, tm[3]);
- C ^= f2(D, (tr[2]&0x0f)+(tr[5]&0x10)?0x10:0x00, tm[4]);
- B ^= f3(C, (tr[2]>>4) +(tr[5]&0x20)?0x10:0x00, tm[5]);
- A ^= f1(B, (tr[3]&0x0f)+(tr[5]&0x40)?0x10:0x00, tm[6]);
- H ^= f2(A, (tr[3]>>4) +(tr[5]&0x80)?0x10:0x00, tm[7]);
-}
-*/
-static
-void w(void *buffer, uint8_t *tr, uint32_t *tm){
- G ^= f1(H, tr[0], tm[0]);
- F ^= f2(G, tr[1], tm[1]);
- E ^= f3(F, tr[2], tm[2]);
- D ^= f1(E, tr[3], tm[3]);
- C ^= f2(D, tr[4], tm[4]);
- B ^= f3(C, tr[5], tm[5]);
- A ^= f1(B, tr[6], tm[6]);
- H ^= f2(A, tr[7], tm[7]);
+void w(void *buffer, uint8_t *tr, uint32_t *tm)
+{
+ G ^= f1(H, tr[0], tm[0]);
+ F ^= f2(G, tr[1], tm[1]);
+ E ^= f3(F, tr[2], tm[2]);
+ D ^= f1(E, tr[3], tm[3]);
+ C ^= f2(D, tr[4], tm[4]);
+ B ^= f3(C, tr[5], tm[5]);
+ A ^= f1(B, tr[6], tm[6]);
+ H ^= f2(A, tr[7], tm[7]);
}
/*
-void dump_ctx(const cast6_ctx_t *ctx){
- uint8_t i,t;
- cli_putstr_P(PSTR("\r\n DBG:"));
- for(i=0; i<12; ++i){
- cli_putstr_P(PSTR("\r\n DBG:"));
- cli_putstr_P(PSTR(" rotk1="));
- t=kr(i*4+0, ctx);
- cli_hexdump(&t,1);
- cli_putstr_P(PSTR(" rotk2="));
- t=kr(i*4+1, ctx);
- cli_hexdump(&t,1);
- cli_putstr_P(PSTR(" rotk3="));
- t=kr(i*4+2, ctx);
- cli_hexdump(&t,1);
- cli_putstr_P(PSTR(" rotk4="));
- t=kr(i*4+3, ctx);
- cli_hexdump(&t,1);
- cli_putstr_P(PSTR("\r\n "));
- cli_putstr_P(PSTR(" mask1="));
- cli_hexdump(&(ctx->km[i][0]),4);
- cli_putstr_P(PSTR(" mask2="));
- cli_hexdump(&(ctx->km[i][1]),4);
- cli_putstr_P(PSTR(" mask3="));
- cli_hexdump(&(ctx->km[i][2]),4);
- cli_putstr_P(PSTR(" mask4="));
- cli_hexdump(&(ctx->km[i][3]),4);
- cli_putstr_P(PSTR("\r\n;-----"));
- }
-}
-*/
+ void dump_ctx(const cast6_ctx_t *ctx){
+ uint8_t i,t;
+ cli_putstr_P(PSTR("\r\n DBG:"));
+ for(i=0; i<12; ++i){
+ cli_putstr_P(PSTR("\r\n DBG:"));
+ cli_putstr_P(PSTR(" rotk1="));
+ t=kr(i*4+0, ctx);
+ cli_hexdump(&t,1);
+ cli_putstr_P(PSTR(" rotk2="));
+ t=kr(i*4+1, ctx);
+ cli_hexdump(&t,1);
+ cli_putstr_P(PSTR(" rotk3="));
+ t=kr(i*4+2, ctx);
+ cli_hexdump(&t,1);
+ cli_putstr_P(PSTR(" rotk4="));
+ t=kr(i*4+3, ctx);
+ cli_hexdump(&t,1);
+ cli_putstr_P(PSTR("\r\n "));
+ cli_putstr_P(PSTR(" mask1="));
+ cli_hexdump(&(ctx->km[i][0]),4);
+ cli_putstr_P(PSTR(" mask2="));
+ cli_hexdump(&(ctx->km[i][1]),4);
+ cli_putstr_P(PSTR(" mask3="));
+ cli_hexdump(&(ctx->km[i][2]),4);
+ cli_putstr_P(PSTR(" mask4="));
+ cli_hexdump(&(ctx->km[i][3]),4);
+ cli_putstr_P(PSTR("\r\n;-----"));
+ }
+ }
+ */
#define CR 19
#define CM 0x5A827999
#define MR 17
#define MM 0x6ED9EBA1
-void cast6_init(const void *key, uint16_t keysize_b, cast6_ctx_t *ctx){
- uint8_t buffer[32];
- uint8_t cr=CR, tr[8];
- uint32_t cm=CM, tm[8];
- uint8_t i,j;
-
- memset(buffer, 0, 32);
- memcpy(buffer, key, (keysize_b+7)/8);
- for(i=0; i<32/4; ++i){
- ((uint32_t*)buffer)[i] = CHANGE_ENDIAN32(((uint32_t*)buffer)[i]);
- }
-
- for(i=0; i<24; ++i){
- for(j=0; j<8; ++j){
- tm[j] = cm;
- cm += MM;
- tr[j] = cr&0x1F;
- cr += MR;
- }
- w(buffer, tr, tm);
+void cast6_init(const void *key, uint16_t keysize_b, cast6_ctx_t *ctx)
+{
+ uint8_t buffer[32];
+ uint8_t cr = CR, tr[8];
+ uint32_t cm = CM, tm[8];
+ uint8_t i, j;
- if(i&1){
- j=i/2;
- ctx->km[j][0]=H;
- ctx->km[j][1]=F;
- ctx->km[j][2]=D;
- ctx->km[j][3]=B;
- set_kr(buffer[0*4],j*4+0,ctx);
- set_kr(buffer[2*4],j*4+1,ctx);
- set_kr(buffer[4*4],j*4+2,ctx);
- set_kr(buffer[6*4],j*4+3,ctx);
- }
- }
-}
+ memset(buffer, 0, 32);
+ memcpy(buffer, key, (keysize_b + 7) / 8);
+ for (i = 0; i < 32 / 4; ++i) {
+ ((uint32_t*) buffer)[i] = CHANGE_ENDIAN32(((uint32_t* )buffer)[i]);
+ }
+ for (i = 0; i < 24; ++i) {
+ for (j = 0; j < 8; ++j) {
+ tm[j] = cm;
+ cm += MM;
+ tr[j] = cr & 0x1F;
+ cr += MR;
+ }
+ w(buffer, tr, tm);
+ if (i & 1) {
+ j = i / 2;
+ ctx->km[j][0] = H;
+ ctx->km[j][1] = F;
+ ctx->km[j][2] = D;
+ ctx->km[j][3] = B;
+ set_kr(buffer[0 * 4], j * 4 + 0, ctx);
+ set_kr(buffer[2 * 4], j * 4 + 1, ctx);
+ set_kr(buffer[4 * 4], j * 4 + 2, ctx);
+ set_kr(buffer[6 * 4], j * 4 + 3, ctx);
+ }
+ }
+}
#define CAST6_ROUNDS 12
/* size of this is 222 byte (HUGE) */
-typedef struct cast6_ctx_st{
- uint32_t km[12][4];
- uint8_t krx[4*12*5/8]; /* these are packed */
+typedef struct cast6_ctx_st {
+ uint32_t km[12][4];
+ uint8_t krx[4 * 12 * 5 / 8]; /* these are packed */
} cast6_ctx_t;
-
-
void cast6_enc(void *buffer, const cast6_ctx_t *ctx);
void cast6_dec(void *buffer, const cast6_ctx_t *ctx);
void cast6_init(const void *key, uint16_t keysize_b, cast6_ctx_t *ctx);
-
#endif /*CAST6_H_*/
/* cscipher.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef CSCIPHER_H_
#define CSCIPHER_H_
typedef struct {
- uint8_t keys[9][8];
+ uint8_t keys[9][8];
} cscipher_ctx_t;
void cscipher_enc(void *buffer, const cscipher_ctx_t *ctx);
void cscipher_dec(void *buffer, const cscipher_ctx_t *ctx);
void cscipher_init(const void *key, cscipher_ctx_t *ctx);
-
#endif /* CSCIPHER_H_ */
/* cscipher_sbox.c */
/*
- This file is part of the AVM-Crypto-Lib.
- Copyright (C) 2006-2010 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVM-Crypto-Lib.
+ Copyright (C) 2006-2010 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include <stdint.h>
#include <avr/pgmspace.h>
const uint8_t cscipher_sbox[] PROGMEM = {
- 0x29, 0x0d, 0x61, 0x40, 0x9c, 0xeb, 0x9e, 0x8f, 0x1f, 0x85, 0x5f, 0x58, 0x5b, 0x01, 0x39, 0x86,
- 0x97, 0x2e, 0xd7, 0xd6, 0x35, 0xae, 0x17, 0x16, 0x21, 0xb6, 0x69, 0x4e, 0xa5, 0x72, 0x87, 0x08,
- 0x3c, 0x18, 0xe6, 0xe7, 0xfa, 0xad, 0xb8, 0x89, 0xb7, 0x00, 0xf7, 0x6f, 0x73, 0x84, 0x11, 0x63,
- 0x3f, 0x96, 0x7f, 0x6e, 0xbf, 0x14, 0x9d, 0xac, 0xa4, 0x0e, 0x7e, 0xf6, 0x20, 0x4a, 0x62, 0x30,
- 0x03, 0xc5, 0x4b, 0x5a, 0x46, 0xa3, 0x44, 0x65, 0x7d, 0x4d, 0x3d, 0x42, 0x79, 0x49, 0x1b, 0x5c,
- 0xf5, 0x6c, 0xb5, 0x94, 0x54, 0xff, 0x56, 0x57, 0x0b, 0xf4, 0x43, 0x0c, 0x4f, 0x70, 0x6d, 0x0a,
- 0xe4, 0x02, 0x3e, 0x2f, 0xa2, 0x47, 0xe0, 0xc1, 0xd5, 0x1a, 0x95, 0xa7, 0x51, 0x5e, 0x33, 0x2b,
- 0x5d, 0xd4, 0x1d, 0x2c, 0xee, 0x75, 0xec, 0xdd, 0x7c, 0x4c, 0xa6, 0xb4, 0x78, 0x48, 0x3a, 0x32,
- 0x98, 0xaf, 0xc0, 0xe1, 0x2d, 0x09, 0x0f, 0x1e, 0xb9, 0x27, 0x8a, 0xe9, 0xbd, 0xe3, 0x9f, 0x07,
- 0xb1, 0xea, 0x92, 0x93, 0x53, 0x6a, 0x31, 0x10, 0x80, 0xf2, 0xd8, 0x9b, 0x04, 0x36, 0x06, 0x8e,
- 0xbe, 0xa9, 0x64, 0x45, 0x38, 0x1c, 0x7a, 0x6b, 0xf3, 0xa1, 0xf0, 0xcd, 0x37, 0x25, 0x15, 0x81,
- 0xfb, 0x90, 0xe8, 0xd9, 0x7b, 0x52, 0x19, 0x28, 0x26, 0x88, 0xfc, 0xd1, 0xe2, 0x8c, 0xa0, 0x34,
- 0x82, 0x67, 0xda, 0xcb, 0xc7, 0x41, 0xe5, 0xc4, 0xc8, 0xef, 0xdb, 0xc3, 0xcc, 0xab, 0xce, 0xed,
- 0xd0, 0xbb, 0xd3, 0xd2, 0x71, 0x68, 0x13, 0x12, 0x9a, 0xb3, 0xc2, 0xca, 0xde, 0x77, 0xdc, 0xdf,
- 0x66, 0x83, 0xbc, 0x8d, 0x60, 0xc6, 0x22, 0x23, 0xb2, 0x8b, 0x91, 0x05, 0x76, 0xcf, 0x74, 0xc9,
- 0xaa, 0xf1, 0x99, 0xa8, 0x59, 0x50, 0x3b, 0x2a, 0xfe, 0xf9, 0x24, 0xb0, 0xba, 0xfd, 0xf8, 0x55
+ 0x29, 0x0d, 0x61, 0x40, 0x9c, 0xeb, 0x9e, 0x8f, 0x1f, 0x85, 0x5f, 0x58,
+ 0x5b, 0x01, 0x39, 0x86,
+ 0x97, 0x2e, 0xd7, 0xd6, 0x35, 0xae, 0x17, 0x16, 0x21, 0xb6, 0x69, 0x4e,
+ 0xa5, 0x72, 0x87, 0x08,
+ 0x3c, 0x18, 0xe6, 0xe7, 0xfa, 0xad, 0xb8, 0x89, 0xb7, 0x00, 0xf7, 0x6f,
+ 0x73, 0x84, 0x11, 0x63,
+ 0x3f, 0x96, 0x7f, 0x6e, 0xbf, 0x14, 0x9d, 0xac, 0xa4, 0x0e, 0x7e, 0xf6,
+ 0x20, 0x4a, 0x62, 0x30,
+ 0x03, 0xc5, 0x4b, 0x5a, 0x46, 0xa3, 0x44, 0x65, 0x7d, 0x4d, 0x3d, 0x42,
+ 0x79, 0x49, 0x1b, 0x5c,
+ 0xf5, 0x6c, 0xb5, 0x94, 0x54, 0xff, 0x56, 0x57, 0x0b, 0xf4, 0x43, 0x0c,
+ 0x4f, 0x70, 0x6d, 0x0a,
+ 0xe4, 0x02, 0x3e, 0x2f, 0xa2, 0x47, 0xe0, 0xc1, 0xd5, 0x1a, 0x95, 0xa7,
+ 0x51, 0x5e, 0x33, 0x2b,
+ 0x5d, 0xd4, 0x1d, 0x2c, 0xee, 0x75, 0xec, 0xdd, 0x7c, 0x4c, 0xa6, 0xb4,
+ 0x78, 0x48, 0x3a, 0x32,
+ 0x98, 0xaf, 0xc0, 0xe1, 0x2d, 0x09, 0x0f, 0x1e, 0xb9, 0x27, 0x8a, 0xe9,
+ 0xbd, 0xe3, 0x9f, 0x07,
+ 0xb1, 0xea, 0x92, 0x93, 0x53, 0x6a, 0x31, 0x10, 0x80, 0xf2, 0xd8, 0x9b,
+ 0x04, 0x36, 0x06, 0x8e,
+ 0xbe, 0xa9, 0x64, 0x45, 0x38, 0x1c, 0x7a, 0x6b, 0xf3, 0xa1, 0xf0, 0xcd,
+ 0x37, 0x25, 0x15, 0x81,
+ 0xfb, 0x90, 0xe8, 0xd9, 0x7b, 0x52, 0x19, 0x28, 0x26, 0x88, 0xfc, 0xd1,
+ 0xe2, 0x8c, 0xa0, 0x34,
+ 0x82, 0x67, 0xda, 0xcb, 0xc7, 0x41, 0xe5, 0xc4, 0xc8, 0xef, 0xdb, 0xc3,
+ 0xcc, 0xab, 0xce, 0xed,
+ 0xd0, 0xbb, 0xd3, 0xd2, 0x71, 0x68, 0x13, 0x12, 0x9a, 0xb3, 0xc2, 0xca,
+ 0xde, 0x77, 0xdc, 0xdf,
+ 0x66, 0x83, 0xbc, 0x8d, 0x60, 0xc6, 0x22, 0x23, 0xb2, 0x8b, 0x91, 0x05,
+ 0x76, 0xcf, 0x74, 0xc9,
+ 0xaa, 0xf1, 0x99, 0xa8, 0x59, 0x50, 0x3b, 0x2a, 0xfe, 0xf9, 0x24, 0xb0,
+ 0xba, 0xfd, 0xf8, 0x55
};
/* cscipher_sbox.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef CSCIPHER_SBOX_H_
#define CSCIPHER_SBOX_H_
extern uint8_t cscipher_sbox[];
-
#endif /* CSCIPHER_SBOX_H_ */
/* cscipher_small_core.c */
/*
- This file is part of the ARM-Crypto-Lib.
- Copyright (C) 2006-2010 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the ARM-Crypto-Lib.
+ Copyright (C) 2006-2010 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include <stdint.h>
#include <avr/pgmspace.h>
#if SBOX_PROG
static const uint8_t fg_table[] PROGMEM = {
- 0xfa, 0xd6, 0xb0, 0xb2, 0x7b, 0x5e, 0x71, 0x78,
- 0xed, 0xd4, 0xa5, 0xb3, 0xef, 0xdc, 0xe7, 0xf9
+ 0xfa, 0xd6, 0xb0, 0xb2, 0x7b, 0x5e, 0x71, 0x78,
+ 0xed, 0xd4, 0xa5, 0xb3, 0xef, 0xdc, 0xe7, 0xf9
};
static
-uint8_t p(uint8_t a){
- a ^= pgm_read_byte(fg_table+(a&0xf))&0xf0;
- a ^= pgm_read_byte(fg_table+(a>>4)) &0x0f;
- a ^= pgm_read_byte(fg_table+(a&0xf))&0xf0;
- return a;
+uint8_t p(uint8_t a) {
+ a ^= pgm_read_byte(fg_table+(a&0xf))&0xf0;
+ a ^= pgm_read_byte(fg_table+(a>>4)) &0x0f;
+ a ^= pgm_read_byte(fg_table+(a&0xf))&0xf0;
+ return a;
}
#define P(a) p(a)
#endif
static const uint8_t round_const[] PROGMEM = {
- 0xb7, 0xe1, 0x51, 0x62, 0x8a, 0xed, 0x2a, 0x6a,
- 0xbf, 0x71, 0x58, 0x80, 0x9c, 0xf4, 0xf3, 0xc7 };
+ 0xb7, 0xe1, 0x51, 0x62, 0x8a, 0xed, 0x2a, 0x6a,
+ 0xbf, 0x71, 0x58, 0x80, 0x9c, 0xf4, 0xf3, 0xc7 };
static const uint8_t ks_const[] PROGMEM = {
- 0x29,0x0d,0x61,0x40,0x9c,0xeb,0x9e,0x8f,
- 0x1f,0x85,0x5f,0x58,0x5b,0x01,0x39,0x86,
- 0x97,0x2e,0xd7,0xd6,0x35,0xae,0x17,0x16,
- 0x21,0xb6,0x69,0x4e,0xa5,0x72,0x87,0x08,
- 0x3c,0x18,0xe6,0xe7,0xfa,0xad,0xb8,0x89,
- 0xb7,0x00,0xf7,0x6f,0x73,0x84,0x11,0x63,
- 0x3f,0x96,0x7f,0x6e,0xbf,0x14,0x9d,0xac,
- 0xa4,0x0e,0x7e,0xf6,0x20,0x4a,0x62,0x30,
- 0x03,0xc5,0x4b,0x5a,0x46,0xa3,0x44,0x65
+ 0x29, 0x0d, 0x61, 0x40, 0x9c, 0xeb, 0x9e, 0x8f,
+ 0x1f, 0x85, 0x5f, 0x58, 0x5b, 0x01, 0x39, 0x86,
+ 0x97, 0x2e, 0xd7, 0xd6, 0x35, 0xae, 0x17, 0x16,
+ 0x21, 0xb6, 0x69, 0x4e, 0xa5, 0x72, 0x87, 0x08,
+ 0x3c, 0x18, 0xe6, 0xe7, 0xfa, 0xad, 0xb8, 0x89,
+ 0xb7, 0x00, 0xf7, 0x6f, 0x73, 0x84, 0x11, 0x63,
+ 0x3f, 0x96, 0x7f, 0x6e, 0xbf, 0x14, 0x9d, 0xac,
+ 0xa4, 0x0e, 0x7e, 0xf6, 0x20, 0x4a, 0x62, 0x30,
+ 0x03, 0xc5, 0x4b, 0x5a, 0x46, 0xa3, 0x44, 0x65
};
-static uint16_t m(uint16_t a){
- uint8_t xl, xr, yl, yr;
- uint16_t ret;
- xr = a>>8;
- xl = a&0xff;
- yl = (ROTL(xl)&0x55)^xl^xr;
- yr = ROTL(xl)^xr;
- ret = (P(yr)<<8)|P(yl);
- return ret;
+static uint16_t m(uint16_t a)
+{
+ uint8_t xl, xr, yl, yr;
+ uint16_t ret;
+ xr = a >> 8;
+ xl = a & 0xff;
+ yl = (ROTL(xl) & 0x55) ^ xl ^ xr;
+ yr = ROTL(xl) ^ xr;
+ ret = (P(yr) << 8) | P(yl);
+ return ret;
}
-static uint16_t m_inv(uint16_t a){
- uint8_t xl, xr;
- xr = P(a>>8);
- xl = P(a&0xff);
- xl ^= xr;
- xl ^= (ROTL(xl)&0xaa);
- xr ^= ROTL(xl);
- return (xr<<8)|xl;
+static uint16_t m_inv(uint16_t a)
+{
+ uint8_t xl, xr;
+ xr = P(a >> 8);
+ xl = P(a & 0xff);
+ xl ^= xr;
+ xl ^= (ROTL(xl) & 0xaa);
+ xr ^= ROTL(xl);
+ return (xr << 8) | xl;
}
-
-void cscipher_enc(void *buffer, const cscipher_ctx_t *ctx){
- uint8_t i,j,k;
- uint8_t tmp[8];
- for(i=0; i<8; ++i){
+void cscipher_enc(void *buffer, const cscipher_ctx_t *ctx)
+{
+ uint8_t i, j, k;
+ uint8_t tmp[8];
+ for (i = 0; i < 8; ++i) {
#if DEBUG
- cli_putstr_P(PSTR("\r\nDBG: round "));
- cli_hexdump(&i, 1);
- cli_putstr_P(PSTR(" buffer:"));
- cli_hexdump(buffer, 8);
+ cli_putstr_P(PSTR("\r\nDBG: round "));
+ cli_hexdump(&i, 1);
+ cli_putstr_P(PSTR(" buffer:"));
+ cli_hexdump(buffer, 8);
#endif
- for(j=0; j<3; ++j){
- if(j==0){
- memxor(buffer, ctx->keys[i], 8);
- }else{
- memxor_P(buffer, round_const+((j==1)?0:8), 8);
- }
- for(k=0; k<4; ++k){
- ((uint16_t*)tmp)[k] = m(((uint16_t*)buffer)[k]);
- }
- for(k=0; k<4; ++k){
- ((uint8_t*)buffer)[k] = tmp[2*k];
- ((uint8_t*)buffer)[k+4] = tmp[2*k+1];
- }
- }
- }
- memxor(buffer, ctx->keys[8], 8);
+ for (j = 0; j < 3; ++j) {
+ if (j == 0) {
+ memxor(buffer, ctx->keys[i], 8);
+ } else {
+ memxor_P(buffer, round_const + ((j == 1) ? 0 : 8), 8);
+ }
+ for (k = 0; k < 4; ++k) {
+ ((uint16_t*) tmp)[k] = m(((uint16_t*) buffer)[k]);
+ }
+ for (k = 0; k < 4; ++k) {
+ ((uint8_t*) buffer)[k] = tmp[2 * k];
+ ((uint8_t*) buffer)[k + 4] = tmp[2 * k + 1];
+ }
+ }
+ }
+ memxor(buffer, ctx->keys[8], 8);
}
-void cscipher_dec(void *buffer, const cscipher_ctx_t *ctx){
- uint8_t i=7,j,k;
- uint8_t tmp[8];
- memxor(buffer, ctx->keys[8], 8);
- do{
- for(j=0; j<3; ++j){
- for(k=0; k<4; ++k){
- tmp[2*k] = ((uint8_t*)buffer)[k];
- tmp[2*k+1] = ((uint8_t*)buffer)[4+k];
- }
- for(k=0; k<4; ++k){
- ((uint16_t*)buffer)[k] = m_inv(((uint16_t*)tmp)[k]);
- }
- if(j==2){
- memxor(buffer, ctx->keys[i], 8);
- }else{
- memxor_P(buffer, round_const+((j==1)?0:8), 8);
- }
-
- }
- }while(i--);
+void cscipher_dec(void *buffer, const cscipher_ctx_t *ctx)
+{
+ uint8_t i = 7, j, k;
+ uint8_t tmp[8];
+ memxor(buffer, ctx->keys[8], 8);
+ do {
+ for (j = 0; j < 3; ++j) {
+ for (k = 0; k < 4; ++k) {
+ tmp[2 * k] = ((uint8_t*) buffer)[k];
+ tmp[2 * k + 1] = ((uint8_t*) buffer)[4 + k];
+ }
+ for (k = 0; k < 4; ++k) {
+ ((uint16_t*) buffer)[k] = m_inv(((uint16_t*) tmp)[k]);
+ }
+ if (j == 2) {
+ memxor(buffer, ctx->keys[i], 8);
+ } else {
+ memxor_P(buffer, round_const + ((j == 1) ? 0 : 8), 8);
+ }
+
+ }
+ } while (i--);
}
-void cscipher_init(const void *key, cscipher_ctx_t *ctx){
- uint8_t tmp_key[16], tmp[8];
- uint8_t i,j,k,t=0;
- memcpy(tmp_key, key, 16);
- for(i=0; i<9; ++i){
+void cscipher_init(const void *key, cscipher_ctx_t *ctx)
+{
+ uint8_t tmp_key[16], tmp[8];
+ uint8_t i, j, k, t = 0;
+ memcpy(tmp_key, key, 16);
+ for (i = 0; i < 9; ++i) {
#if DEBUG
- cli_putstr_P(PSTR("\r\nDBG: round "));
- cli_hexdump(&i, 1);
- cli_putstr_P(PSTR(" key state:"));
- cli_hexdump(tmp_key, 16);
+ cli_putstr_P(PSTR("\r\nDBG: round "));
+ cli_hexdump(&i, 1);
+ cli_putstr_P(PSTR(" key state:"));
+ cli_hexdump(tmp_key, 16);
#endif
- memcpy(tmp, tmp_key+(((i&1)==0)?0:8), 8);
- memxor_P(tmp, ks_const+8*i, 8);
- for(j=0; j<8; ++j){
- tmp[j] = P(tmp[j]);
- }
- for(j=0; j<8; ++j){
- for(k=0; k<8; ++k){
- t<<=1;
- t |= tmp[k]>>7;
- tmp[k]<<=1;
- }
- tmp_key[j+(((i&1)==0)?8:0)] ^= t;
- }
- memcpy(ctx->keys[i], tmp_key+(((i&1)==0)?8:0), 8);
- }
+ memcpy(tmp, tmp_key + (((i & 1) == 0) ? 0 : 8), 8);
+ memxor_P(tmp, ks_const + 8 * i, 8);
+ for (j = 0; j < 8; ++j) {
+ tmp[j] = P(tmp[j]);
+ }
+ for (j = 0; j < 8; ++j) {
+ for (k = 0; k < 8; ++k) {
+ t <<= 1;
+ t |= tmp[k] >> 7;
+ tmp[k] <<= 1;
+ }
+ tmp_key[j + (((i & 1) == 0) ? 8 : 0)] ^= t;
+ }
+ memcpy(ctx->keys[i], tmp_key + (((i & 1) == 0) ? 8 : 0), 8);
+ }
}
/* cubehash.c */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* \file cubehash.c
* \email daniel.otte@rub.de
*
*/
-
#include "memxor.h"
#include "cubehash.h"
#include "cubehash_rotates.h"
#include <stdint.h>
/*
-• Add x_0jklm into x_1jklm modulo 2**32 , for each (j, k, l, m).
-• Rotate x_0jklm upwards by 7 bits, for each (j, k, l, m).
-• Swap x_00klm with x_01klm , for each (k, l, m).
-• Xor x_1jklm into x_0jklm , for each (j, k, l, m).
-• Swap x_1jk0m with x_1jk1m , for each (j, k, m).
-• Add x_0jklm into x_1jklm modulo 2**32 , for each (j, k, l, m).
-• Rotate x_0jklm upwards by 11 bits, for each (j, k, l, m).
-• Swap x_0j0lm with x_0j1lm , for each (j, l, m).
-• Xor x_1jklm into x_0jklm , for each (j, k, l, m).
-• Swap x_1jkl0 with x_1jkl1 , for each (j, k, l).
-*/
-
-static void cubehash_round(cubehash_ctx_t *ctx){
- uint8_t i;
- uint32_t t, t2;
- for(i=0; i<16; ++i){
- ctx->a[i+16] += t = ctx->a[i];
- ctx->a[i] = rotate7left(t);
- }
- xchg32_array(&(ctx->a[0]), &(ctx->a[8]), 8);
- for(i=0; i<16; i+=4){
- t = ctx->a[i+16];
- t2 = ctx->a[i] ^= t;
- ctx->a[i+16] = ctx->a[i+18] + t2;
- ctx->a[i] = rotate11left(t2);
- t2 = ctx->a[i+2] ^= ctx->a[i+18];
- ctx->a[i+18] = t + t2;
- ctx->a[i+2] = rotate11left(t2);
- t = ctx->a[i+17];
- t2 = ctx->a[i+1] ^= t;
- ctx->a[i+17] = ctx->a[i+19] + t2;
- ctx->a[i+1] = rotate11left(t2);
- t2 = ctx->a[i+3] ^= ctx->a[i+19];
- ctx->a[i+19] = t + t2;
- ctx->a[i+3] = rotate11left(t2);
- }
- xchg32_array(&(ctx->a[0]), &(ctx->a[4]), 4);
- xchg32_array(&(ctx->a[8]), &(ctx->a[12]), 4);
- for(i=0; i<16; i+=2){
- ctx->a[i] ^= t = ctx->a[i+16];
- ctx->a[i+1] ^= ctx->a[i+16] = ctx->a[i+17];
- ctx->a[i+17] = t;
- }
+ • Add x_0jklm into x_1jklm modulo 2**32 , for each (j, k, l, m).
+ • Rotate x_0jklm upwards by 7 bits, for each (j, k, l, m).
+ • Swap x_00klm with x_01klm , for each (k, l, m).
+ • Xor x_1jklm into x_0jklm , for each (j, k, l, m).
+ • Swap x_1jk0m with x_1jk1m , for each (j, k, m).
+ • Add x_0jklm into x_1jklm modulo 2**32 , for each (j, k, l, m).
+ • Rotate x_0jklm upwards by 11 bits, for each (j, k, l, m).
+ • Swap x_0j0lm with x_0j1lm , for each (j, l, m).
+ • Xor x_1jklm into x_0jklm , for each (j, k, l, m).
+ • Swap x_1jkl0 with x_1jkl1 , for each (j, k, l).
+ */
+
+static void cubehash_round(cubehash_ctx_t *ctx)
+{
+ uint8_t i;
+ uint32_t t, t2;
+ for (i = 0; i < 16; ++i) {
+ ctx->a[i + 16] += t = ctx->a[i];
+ ctx->a[i] = rotate7left(t);
+ }
+ xchg32_array(&(ctx->a[0]), &(ctx->a[8]), 8);
+ for (i = 0; i < 16; i += 4) {
+ t = ctx->a[i + 16];
+ t2 = ctx->a[i] ^= t;
+ ctx->a[i + 16] = ctx->a[i + 18] + t2;
+ ctx->a[i] = rotate11left(t2);
+ t2 = ctx->a[i + 2] ^= ctx->a[i + 18];
+ ctx->a[i + 18] = t + t2;
+ ctx->a[i + 2] = rotate11left(t2);
+ t = ctx->a[i + 17];
+ t2 = ctx->a[i + 1] ^= t;
+ ctx->a[i + 17] = ctx->a[i + 19] + t2;
+ ctx->a[i + 1] = rotate11left(t2);
+ t2 = ctx->a[i + 3] ^= ctx->a[i + 19];
+ ctx->a[i + 19] = t + t2;
+ ctx->a[i + 3] = rotate11left(t2);
+ }
+ xchg32_array(&(ctx->a[0]), &(ctx->a[4]), 4);
+ xchg32_array(&(ctx->a[8]), &(ctx->a[12]), 4);
+ for (i = 0; i < 16; i += 2) {
+ ctx->a[i] ^= t = ctx->a[i + 16];
+ ctx->a[i + 1] ^= ctx->a[i + 16] = ctx->a[i + 17];
+ ctx->a[i + 17] = t;
+ }
}
-void cubehash_init(uint8_t r, uint8_t b, uint16_t h, cubehash_ctx_t *ctx){
- memset(ctx->a, 0, 32*4);
- ctx->a[0] = h/8;
- ctx->a[1] = b;
- ctx->a[2] = r;
- ctx->rounds = r;
- ctx->blocksize_B = b;
- for(b=0; b<10*r; ++b){
- cubehash_round(ctx);
- }
+void cubehash_init(uint8_t r, uint8_t b, uint16_t h, cubehash_ctx_t *ctx)
+{
+ memset(ctx->a, 0, 32 * 4);
+ ctx->a[0] = h / 8;
+ ctx->a[1] = b;
+ ctx->a[2] = r;
+ ctx->rounds = r;
+ ctx->blocksize_B = b;
+ for (b = 0; b < 10 * r; ++b) {
+ cubehash_round(ctx);
+ }
}
-void cubehash_nextBlock(cubehash_ctx_t *ctx, void *block){
- uint8_t i;
- memxor(ctx->a, block, ctx->blocksize_B);
- for(i=0; i<ctx->rounds; ++i){
- cubehash_round(ctx);
- }
+void cubehash_nextBlock(cubehash_ctx_t *ctx, void *block)
+{
+ uint8_t i;
+ memxor(ctx->a, block, ctx->blocksize_B);
+ for (i = 0; i < ctx->rounds; ++i) {
+ cubehash_round(ctx);
+ }
}
-void cubehash_lastBlock(cubehash_ctx_t *ctx, void *block, uint16_t length_b){
- while(length_b>=ctx->blocksize_B*8){
- cubehash_nextBlock(ctx, block);
- block = (uint8_t*)block + ctx->blocksize_B;
- length_b -= ctx->blocksize_B*8;
- }
- uint8_t buffer[ctx->blocksize_B];
- uint8_t i;
- memset(buffer, 0, ctx->blocksize_B);
- memcpy(buffer, block, (length_b+7)/8);
- buffer[length_b/8] |= 0x80 >> (length_b&7);
- cubehash_nextBlock(ctx, buffer);
- ctx->a[31] ^= 1;
- for(i=0; i<10*(ctx->rounds); ++i){
- cubehash_round(ctx);
- }
+void cubehash_lastBlock(cubehash_ctx_t *ctx, void *block, uint16_t length_b)
+{
+ while (length_b >= ctx->blocksize_B * 8) {
+ cubehash_nextBlock(ctx, block);
+ block = (uint8_t*) block + ctx->blocksize_B;
+ length_b -= ctx->blocksize_B * 8;
+ }
+ uint8_t buffer[ctx->blocksize_B];
+ uint8_t i;
+ memset(buffer, 0, ctx->blocksize_B);
+ memcpy(buffer, block, (length_b + 7) / 8);
+ buffer[length_b / 8] |= 0x80 >> (length_b & 7);
+ cubehash_nextBlock(ctx, buffer);
+ ctx->a[31] ^= 1;
+ for (i = 0; i < 10 * (ctx->rounds); ++i) {
+ cubehash_round(ctx);
+ }
}
-void cubehash_ctx2hash(void *dest, uint16_t length_b, cubehash_ctx_t *ctx){
- memcpy(dest, ctx->a, (length_b+7)/8);
+void cubehash_ctx2hash(void *dest, uint16_t length_b, cubehash_ctx_t *ctx)
+{
+ memcpy(dest, ctx->a, (length_b + 7) / 8);
}
/******************************************************************************/
-void cubehash224_init(cubehash_ctx_t *ctx){
- cubehash_init(16, 32, 224, ctx);
+void cubehash224_init(cubehash_ctx_t *ctx)
+{
+ cubehash_init(16, 32, 224, ctx);
}
-void cubehash224_ctx2hash(void *dest, cubehash_ctx_t *ctx){
- cubehash_ctx2hash(dest, 224, ctx);
+void cubehash224_ctx2hash(void *dest, cubehash_ctx_t *ctx)
+{
+ cubehash_ctx2hash(dest, 224, ctx);
}
/******************************************************************************/
-void cubehash256_init(cubehash_ctx_t *ctx){
- cubehash_init(16, 32, 256, ctx);
+void cubehash256_init(cubehash_ctx_t *ctx)
+{
+ cubehash_init(16, 32, 256, ctx);
}
-void cubehash256_ctx2hash(void *dest, cubehash_ctx_t *ctx){
- cubehash_ctx2hash(dest, 256, ctx);
+void cubehash256_ctx2hash(void *dest, cubehash_ctx_t *ctx)
+{
+ cubehash_ctx2hash(dest, 256, ctx);
}
/******************************************************************************/
-void cubehash384_init(cubehash_ctx_t *ctx){
- cubehash_init(16, 32, 384, ctx);
+void cubehash384_init(cubehash_ctx_t *ctx)
+{
+ cubehash_init(16, 32, 384, ctx);
}
-void cubehash384_ctx2hash(void *dest, cubehash_ctx_t *ctx){
- cubehash_ctx2hash(dest, 384, ctx);
+void cubehash384_ctx2hash(void *dest, cubehash_ctx_t *ctx)
+{
+ cubehash_ctx2hash(dest, 384, ctx);
}
/******************************************************************************/
-void cubehash512_init(cubehash_ctx_t *ctx){
- cubehash_init(16, 32, 512, ctx);
+void cubehash512_init(cubehash_ctx_t *ctx)
+{
+ cubehash_init(16, 32, 512, ctx);
}
-void cubehash512_ctx2hash(void *dest, cubehash_ctx_t *ctx){
- cubehash_ctx2hash(dest, 512, ctx);
+void cubehash512_ctx2hash(void *dest, cubehash_ctx_t *ctx)
+{
+ cubehash_ctx2hash(dest, 512, ctx);
}
/* cubehash.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef CUBEHASH_H_
#define CUBEHASH_H_
#define CUBEHASH512_BLOCKSIZE_B ((CUBEHASH512_BLOCKSIZE+7)/8)
typedef struct {
- uint32_t a[32];
- uint8_t rounds;
- uint8_t blocksize_B;
+ uint32_t a[32];
+ uint8_t rounds;
+ uint8_t blocksize_B;
} cubehash_ctx_t;
void cubehash_init(uint8_t r, uint8_t b, uint16_t h, cubehash_ctx_t *ctx);
/* cubehash_rotates.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef CUBEHASH_ROTATES_H_
#define CUBEHASH_ROTATES_H_
/* xchg.h */
/*
- This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef XCHG_H_
#define XCHG_H_
const uint8_t splitin6bitword_permtab[] PROGMEM = {
8, 8, /* 64 bit -> 64 bit */
- 64, 64, 1, 6, 2, 3, 4, 5,
- 64, 64, 7, 12, 8, 9, 10, 11,
- 64, 64, 13, 18, 14, 15, 16, 17,
- 64, 64, 19, 24, 20, 21, 22, 23,
- 64, 64, 25, 30, 26, 27, 28, 29,
- 64, 64, 31, 36, 32, 33, 34, 35,
- 64, 64, 37, 42, 38, 39, 40, 41,
- 64, 64, 43, 48, 44, 45, 46, 47
+ 64, 64, 1, 6, 2, 3, 4, 5,
+ 64, 64, 7, 12, 8, 9, 10, 11,
+ 64, 64, 13, 18, 14, 15, 16, 17,
+ 64, 64, 19, 24, 20, 21, 22, 23,
+ 64, 64, 25, 30, 26, 27, 28, 29,
+ 64, 64, 31, 36, 32, 33, 34, 35,
+ 64, 64, 37, 42, 38, 39, 40, 41,
+ 64, 64, 43, 48, 44, 45, 46, 47
};
const uint8_t shiftkey_permtab[] PROGMEM = {
7, 7, /* 56 bit -> 56 bit */
2, 3, 4, 5, 6, 7, 8, 9,
10, 11, 12, 13, 14, 15, 16, 17,
- 18, 19, 20, 21, 22, 23, 24, 25,
- 26, 27, 28, 1,
- 30, 31, 32, 33, 34, 35, 36, 37,
- 38, 39, 40, 41, 42, 43, 44, 45,
- 46, 47, 48, 49, 50, 51, 52, 53,
+ 18, 19, 20, 21, 22, 23, 24, 25,
+ 26, 27, 28, 1,
+ 30, 31, 32, 33, 34, 35, 36, 37,
+ 38, 39, 40, 41, 42, 43, 44, 45,
+ 46, 47, 48, 49, 50, 51, 52, 53,
54, 55, 56, 29
};
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27,
- 56, 29, 30, 31, 32, 33, 34, 35,
- 36, 37, 38, 39, 40, 41, 42, 43,
- 44, 45, 46, 47, 48, 49, 50, 51,
+ 56, 29, 30, 31, 32, 33, 34, 35,
+ 36, 37, 38, 39, 40, 41, 42, 43,
+ 44, 45, 46, 47, 48, 49, 50, 51,
52, 53, 54, 55
};
void shiftkey(uint8_t *key){
uint8_t k[7];
memcpy(k, key, 7);
- permute((uint8_t*)shiftkey_permtab, k, key);
+ permute((uint8_t*)shiftkey_permtab, k, key);
}
/******************************************************************************/
uint8_t k[7];
memcpy(k, key, 7);
permute((uint8_t*)shiftkeyinv_permtab, k, key);
-
+
}
/******************************************************************************/
uint64_t splitin6bitwords(uint64_t a){
uint64_t ret=0;
a &= 0x0000ffffffffffffLL;
- permute((uint8_t*)splitin6bitword_permtab, (uint8_t*)&a, (uint8_t*)&ret);
+ permute((uint8_t*)splitin6bitword_permtab, (uint8_t*)&a, (uint8_t*)&ret);
return ret;
}
static inline
uint8_t substitute(uint8_t a, uint8_t * sbp){
- uint8_t x;
+ uint8_t x;
x = pgm_read_byte(&sbp[a>>1]);
x = (a&1)?x&0x0F:x>>4;
return x;
-
+
}
/******************************************************************************/
uint8_t i;
uint32_t t=0,ret;
uint64_t data;
- uint8_t *sbp; /* sboxpointer */
+ uint8_t *sbp; /* sboxpointer */
permute((uint8_t*)e_permtab, (uint8_t*)&r, (uint8_t*)&data);
for(i=0; i<7; ++i)
((uint8_t*)&data)[i] ^= kr[i];
-
+
/* Sbox substitution */
data = splitin6bitwords(data);
sbp=(uint8_t*)sbox;
sbp += 32;
}
changeendian32(&t);
-
+
permute((uint8_t*)p_permtab,(uint8_t*)&t, (uint8_t*)&ret);
return ret;
uint8_t v8[8];
uint32_t v32[2];
} data;
-
+
permute((uint8_t*)ip_permtab, (uint8_t*)in, data.v8);
permute((uint8_t*)pc1_permtab, (const uint8_t*)key, k);
for(i=0; i<8; ++i){
shiftkey(k);
permute((uint8_t*)pc2_permtab, k, kr);
L ^= des_f(R, kr);
-
+
shiftkey(k);
if(ROTTABLE&((1<<((i<<1)+1))) )
shiftkey(k);
permute((uint8_t*)ip_permtab, (uint8_t*)in, data.v8);
permute((uint8_t*)pc1_permtab, (const uint8_t*)key, k);
for(i=7; i>=0; --i){
-
+
permute((uint8_t*)pc2_permtab, k, kr);
L ^= des_f(R, kr);
shiftkey_inv(k);
((uint8_t*)m_int.wordv)[idx++] = ((uint8_t*)hash)[--hash_len_B];
}
}
+ bigint_adjust(&m_int);
do{
if(rand_in == NULL){
size_t i;
printf_P(PSTR("\n Qy: "));
bigint_print_hex(&qa.y);
puts("\n");
+
+ ecc_affine_point_free(&qa);
+ ecc_chudnovsky_point_free(&q);
}
void testrun_genkey3(void){
printf_P(PSTR("\n Qy: "));
bigint_print_hex(&qa.y);
puts("\n");
+
+ ecc_affine_point_free(&qa);
+ ecc_chudnovsky_point_free(&q);
+
}
void testrun_genkey(void){
ecc_chudnovsky_point_free(&q);
ecc_affine_point_free(&qa);
}
+/*
+N is
+3128D2B4 B1C96B14 36F8DE99 FFFFFFFF FFFFFFFF FFFFFFFF 99DEF836 146BC9B1 B4D22831
+--------------------------------------------------------------
+C is
+78916860 32FD8057 F636B44B 1F47CCE5 64D25099 23A7465A
+--------------------------------------------------------------
+D is
+78916860 32FD8057 F636B44B 1F47CCE5 64D25099 23A7465B
+Q_x is
+FBA2AAC6 47884B50 4EB8CD5A 0A1287BA BCC62163 F606A9A2
+Q_y is
+DAE6D4CC 05EF4F27 D79EE38B 71C9C8EF 4865D988 50D84AA5
+*/
+
+void testrun_interm(void){
+ ecc_chudnovsky_point_t q;
+ ecc_affine_point_t qa;
+ uint32_t time;
+ bigint_t k;
+ uint8_t r;
+
+ printf_P(PSTR("\n== testing key generation ==\n"));
+
+ printf_P(PSTR("enter secret key d: "));
+ bigint_read_hex_echo(&k);
+ putchar('\n');
+
+ if(ecc_chudnovsky_point_alloc(&q, 192)){
+ printf_P(PSTR("ERROR: OOM! <%s %s %d>\n"), __FILE__, __func__, __LINE__);
+ return;
+ }
+ if(ecc_affine_point_alloc(&qa, 192)){
+ ecc_chudnovsky_point_free(&q);
+ printf_P(PSTR("ERROR: OOM! <%s %s %d>\n"), __FILE__, __func__, __LINE__);
+ return;
+ }
+
+ printf_P(PSTR("(naf) k: "));
+ bigint_print_hex(&k);
+ startTimer(1);
+ START_TIMER;
+ r = ecc_chudnovsky_naf_multiplication(&q, &k, &nist_curve_p192_basepoint.chudnovsky, &nist_curve_p192);
+ STOP_TIMER;
+ time = stopTimer();
+ ecc_chudnovsky_to_affine_point(&qa, &q, &nist_curve_p192);
+
+ printf_P(PSTR("\n Qx: "));
+ bigint_print_hex(&qa.x);
+ printf_P(PSTR("\n Qy: "));
+ bigint_print_hex(&qa.y);
+ printf_P(PSTR("\n time: %"PRIu32" cycles (r code: %"PRIu8")\n"), time, r);
+
+ printf_P(PSTR("(d&a) k: "));
+ bigint_print_hex(&k);
+ startTimer(1);
+ START_TIMER;
+ r = ecc_chudnovsky_double_and_add(&q, &k, &nist_curve_p192_basepoint.chudnovsky, &nist_curve_p192);
+ STOP_TIMER;
+ time = stopTimer();
+ ecc_chudnovsky_to_affine_point(&qa, &q, &nist_curve_p192);
+
+ printf_P(PSTR("\n Qx: "));
+ bigint_print_hex(&qa.x);
+ printf_P(PSTR("\n Qy: "));
+ bigint_print_hex(&qa.y);
+ printf_P(PSTR("\n time: %"PRIu32" cycles (r code: %"PRIu8")\n"), time, r);
+ free(k.wordv);
+ ecc_chudnovsky_point_free(&q);
+ ecc_affine_point_free(&qa);
+}
+
#endif