]> git.cryptolib.org Git - avr-crypto-lib.git/blobdiff - skein/threefish256_enc.c
included skein tweak for round 3
[avr-crypto-lib.git] / skein / threefish256_enc.c
index 8bfbf9de471bad329a6490300d49c25f4e7358b0..ebfa03975aec82ebff4b2a0537f29447e4534741 100644 (file)
@@ -21,9 +21,9 @@
  * \email   daniel.otte@rub.de
  * \date    2009-03-12
  * \license GPLv3 or later
- * 
- * 
- * 
+ *
+ *
+ *
  */
 
 #include <stdint.h>
@@ -39,7 +39,8 @@ void permute_4(void* data){
        X(3) = t;
 }
 
-#define THREEFISH_KEY_CONST 0x5555555555555555LL /* 2**64/3 */
+//#define THREEFISH_KEY_CONST 0x5555555555555555LL /* 2**64/3 */
+#define THREEFISH_KEY_CONST 0x1BD11BDAA9FC1A22LL
 
 #define K(s) (((uint64_t*)key)[(s)])
 #define T(s) (((uint64_t*)tweak)[(s)])
@@ -69,8 +70,12 @@ void add_key_4(void* data, const threefish256_ctx_t* ctx, uint8_t s){
 
 void threefish256_enc(void* data, const threefish256_ctx_t* ctx){
        uint8_t i=0,s=0;
-       uint8_t r0[8] = { 5, 36, 13, 58, 26, 53, 11, 59}; 
+/* old constans, changed at round 2 of the SHA-3 contest
+       uint8_t r0[8] = { 5, 36, 13, 58, 26, 53, 11, 59};
        uint8_t r1[8] = {56, 28, 46, 44, 20, 35, 42, 50};
+*/
+       uint8_t r0[8] = {14, 52, 23,  5, 25, 46, 58, 32};
+       uint8_t r1[8] = {16, 57, 40, 37, 33, 12, 22, 32};
        do{
                if(i%4==0){
                        add_key_4(data, ctx, s);