Botan  2.4.0
Crypto and TLS for C++11
Namespaces | Macros
threefish.cpp File Reference
#include <botan/threefish.h>
#include <botan/loadstor.h>
#include <botan/cpuid.h>

Go to the source code of this file.

Namespaces

 Botan
 

Macros

#define THREEFISH_DEC_8_ROUNDS(R1, R2)
 
#define THREEFISH_ENC_8_ROUNDS(R1, R2)
 
#define THREEFISH_INJECT_KEY(r)
 
#define THREEFISH_INJECT_KEY(r)
 
#define THREEFISH_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, ROT1, ROT2, ROT3, ROT4)
 
#define THREEFISH_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, ROT1, ROT2, ROT3, ROT4)
 

Macro Definition Documentation

◆ THREEFISH_DEC_8_ROUNDS

#define THREEFISH_DEC_8_ROUNDS (   R1,
  R2 
)
Value:
do { \
THREEFISH_ROUND(X6,X0,X2,X4, X1,X7,X5,X3, 8,35,56,22); \
THREEFISH_ROUND(X4,X6,X0,X2, X1,X3,X5,X7, 25,29,39,43); \
THREEFISH_ROUND(X2,X4,X6,X0, X1,X7,X5,X3, 13,50,10,17); \
THREEFISH_ROUND(X0,X2,X4,X6, X1,X3,X5,X7, 39,30,34,24); \
THREEFISH_INJECT_KEY(R1); \
THREEFISH_ROUND(X6,X0,X2,X4, X1,X7,X5,X3, 44, 9,54,56); \
THREEFISH_ROUND(X4,X6,X0,X2, X1,X3,X5,X7, 17,49,36,39); \
THREEFISH_ROUND(X2,X4,X6,X0, X1,X7,X5,X3, 33,27,14,42); \
THREEFISH_ROUND(X0,X2,X4,X6, X1,X3,X5,X7, 46,36,19,37); \
THREEFISH_INJECT_KEY(R2); \
} while(0)
#define THREEFISH_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, ROT1, ROT2, ROT3, ROT4)
Definition: threefish.cpp:14

Referenced by Botan::Threefish_512::decrypt_n().

◆ THREEFISH_ENC_8_ROUNDS

#define THREEFISH_ENC_8_ROUNDS (   R1,
  R2 
)
Value:
do { \
THREEFISH_ROUND(X0,X2,X4,X6, X1,X3,X5,X7, 46,36,19,37); \
THREEFISH_ROUND(X2,X4,X6,X0, X1,X7,X5,X3, 33,27,14,42); \
THREEFISH_ROUND(X4,X6,X0,X2, X1,X3,X5,X7, 17,49,36,39); \
THREEFISH_ROUND(X6,X0,X2,X4, X1,X7,X5,X3, 44, 9,54,56); \
THREEFISH_INJECT_KEY(R1); \
THREEFISH_ROUND(X0,X2,X4,X6, X1,X3,X5,X7, 39,30,34,24); \
THREEFISH_ROUND(X2,X4,X6,X0, X1,X7,X5,X3, 13,50,10,17); \
THREEFISH_ROUND(X4,X6,X0,X2, X1,X3,X5,X7, 25,29,39,43); \
THREEFISH_ROUND(X6,X0,X2,X4, X1,X7,X5,X3, 8,35,56,22); \
THREEFISH_INJECT_KEY(R2); \
} while(0)
#define THREEFISH_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, ROT1, ROT2, ROT3, ROT4)
Definition: threefish.cpp:14

Definition at line 42 of file threefish.cpp.

Referenced by Botan::Threefish_512::encrypt_n().

◆ THREEFISH_INJECT_KEY [1/2]

#define THREEFISH_INJECT_KEY (   r)
Value:
do { \
X0 += m_K[(r ) % 9]; \
X1 += m_K[(r+1) % 9]; \
X2 += m_K[(r+2) % 9]; \
X3 += m_K[(r+3) % 9]; \
X4 += m_K[(r+4) % 9]; \
X5 += m_K[(r+5) % 9] + m_T[(r ) % 3]; \
X6 += m_K[(r+6) % 9] + m_T[(r+1) % 3]; \
X7 += m_K[(r+7) % 9] + (r); \
} while(0)

Definition at line 30 of file threefish.cpp.

Referenced by Botan::Threefish_512::decrypt_n(), and Botan::Threefish_512::encrypt_n().

◆ THREEFISH_INJECT_KEY [2/2]

#define THREEFISH_INJECT_KEY (   r)
Value:
do { \
X0 -= m_K[(r ) % 9]; \
X1 -= m_K[(r+1) % 9]; \
X2 -= m_K[(r+2) % 9]; \
X3 -= m_K[(r+3) % 9]; \
X4 -= m_K[(r+4) % 9]; \
X5 -= m_K[(r+5) % 9] + m_T[(r ) % 3]; \
X6 -= m_K[(r+6) % 9] + m_T[(r+1) % 3]; \
X7 -= m_K[(r+7) % 9] + (r); \
} while(0)

Definition at line 30 of file threefish.cpp.

◆ THREEFISH_ROUND [1/2]

#define THREEFISH_ROUND (   X0,
  X1,
  X2,
  X3,
  X4,
  X5,
  X6,
  X7,
  ROT1,
  ROT2,
  ROT3,
  ROT4 
)
Value:
do { \
X0 += X4; \
X1 += X5; \
X2 += X6; \
X3 += X7; \
X4 = rotl<ROT1>(X4); \
X5 = rotl<ROT2>(X5); \
X6 = rotl<ROT3>(X6); \
X7 = rotl<ROT4>(X7); \
X4 ^= X0; \
X5 ^= X1; \
X6 ^= X2; \
X7 ^= X3; \
} while(0)

Definition at line 14 of file threefish.cpp.

◆ THREEFISH_ROUND [2/2]

#define THREEFISH_ROUND (   X0,
  X1,
  X2,
  X3,
  X4,
  X5,
  X6,
  X7,
  ROT1,
  ROT2,
  ROT3,
  ROT4 
)
Value:
do { \
X4 ^= X0; \
X5 ^= X1; \
X6 ^= X2; \
X7 ^= X3; \
X4 = rotr<ROT1>(X4); \
X5 = rotr<ROT2>(X5); \
X6 = rotr<ROT3>(X6); \
X7 = rotr<ROT4>(X7); \
X0 -= X4; \
X1 -= X5; \
X2 -= X6; \
X3 -= X7; \
} while(0)

Definition at line 14 of file threefish.cpp.