Botan 2.1.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, ROT1, ROT2, ROT3, ROT4)

## Macro Definition Documentation

#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)
THREEFISH_ROUND
#define THREEFISH_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, ROT1, ROT2, ROT3, ROT4)
Definition: threefish.cpp:14
THREEFISH_INJECT_KEY
#define THREEFISH_INJECT_KEY(r)
Definition: threefish.cpp:30

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

#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)
THREEFISH_ROUND
#define THREEFISH_ROUND(X0, X1, X2, X3, X4, X5, X6, X7, ROT1, ROT2, ROT3, ROT4)
Definition: threefish.cpp:14
THREEFISH_INJECT_KEY
#define THREEFISH_INJECT_KEY(r)
Definition: threefish.cpp:30

Definition at line 42 of file threefish.cpp.

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

#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().

#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.

#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 = rotate_left(X4, ROT1); \
X5 = rotate_left(X5, ROT2); \
X6 = rotate_left(X6, ROT3); \
X7 = rotate_left(X7, ROT4); \
X4 ^= X0; \
X5 ^= X1; \
X6 ^= X2; \
X7 ^= X3; \
} while(0)
Botan::rotate_left
T rotate_left(T input, size_t rot)
Definition: rotate.h:21

Definition at line 14 of file threefish.cpp.

#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 = rotate_right(X4, ROT1); \
X5 = rotate_right(X5, ROT2); \
X6 = rotate_right(X6, ROT3); \
X7 = rotate_right(X7, ROT4); \
X0 -= X4; \
X1 -= X5; \
X2 -= X6; \
X3 -= X7; \
} while(0)
Botan::rotate_right
T rotate_right(T input, size_t rot)
Definition: rotate.h:32

Definition at line 14 of file threefish.cpp.