#ifndef CONSTANTS_H_
#define CONSTANTS_H_

#include <stdint.h>

#define ASCON_80PQ_VARIANT 0
#define ASCON_AEAD_VARIANT 1
#define ASCON_HASH_VARIANT 2
#define ASCON_XOF_VARIANT 3
#define ASCON_CXOF_VARIANT 4
#define ASCON_MAC_VARIANT 5
#define ASCON_PRF_VARIANT 6
#define ASCON_PRFS_VARIANT 7

#define ASCON_TAG_SIZE 16
#define ASCON_HASH_SIZE 32

#define ASCON_128_RATE 8
#define ASCON_128A_RATE 16
#define ASCON_HASH_RATE 8
#define ASCON_PRF_IN_RATE 32
#define ASCON_PRFA_IN_RATE 40
#define ASCON_PRF_OUT_RATE 16

#define ASCON_PA_ROUNDS 12
#define ASCON_128_PB_ROUNDS 6
#define ASCON_128A_PB_ROUNDS 8
#define ASCON_HASH_PB_ROUNDS 12
#define ASCON_HASHA_PB_ROUNDS 8
#define ASCON_PRF_PB_ROUNDS 12
#define ASCON_PRFA_PB_ROUNDS 8

#define ASCON_128_IV 0x0020860000000a01ull
#define ASCON_128A_IV 0x00008a0000400201ull
#define ASCON_80PQ_IV 0x0000862000000a00ull

#define ASCON_HASH_IV 0x00200a0100010a00ull
#define ASCON_HASHA_IV 0x00200a0100010200ull
#define ASCON_XOF_IV 0x00200a0100000a01ull
#define ASCON_XOFA_IV 0x00200a0100000201ull
#define ASCON_CXOF_IV 0x00200a0000000a02ull
#define ASCON_CXOFA_IV 0x00200a0000000202ull

#define ASCON_MAC_IV 0x00408a0004000a03ull
#define ASCON_MACA_IV 0x00608a0004000203ull
#define ASCON_PRF_IV 0x00400a0104000a02ull
#define ASCON_PRFA_IV 0x00600a0104000202ull
#define ASCON_PRFS_IV 0x0000820100000203ull

#define ASCON_HASH_IV0 0xb308e49856e696e1ull
#define ASCON_HASH_IV1 0x39c35509990657dcull
#define ASCON_HASH_IV2 0xf46674e32b5a9644ull
#define ASCON_HASH_IV3 0x678c872d6fe2f8b5ull
#define ASCON_HASH_IV4 0x321218964ea92b7bull

#define ASCON_HASHA_IV0 0xdfc87ee88f6dfe3bull
#define ASCON_HASHA_IV1 0xa5343eaff69bf029ull
#define ASCON_HASHA_IV2 0xaff8d129e063315cull
#define ASCON_HASHA_IV3 0xab080f50d3262646ull
#define ASCON_HASHA_IV4 0xbaa07b54827da001ull

#define ASCON_XOF_IV0 0xb9b5a81fc0ae36b9ull
#define ASCON_XOF_IV1 0xa6d933e6aeabf6d9ull
#define ASCON_XOF_IV2 0xd0b98214bc3f00e5ull
#define ASCON_XOF_IV3 0x3cf1072a288d99caull
#define ASCON_XOF_IV4 0xc044b73b8ef2db1eull

#define ASCON_XOFA_IV0 0xd0301a61d22c7d19ull
#define ASCON_XOFA_IV1 0x84ddf0a7aee92112ull
#define ASCON_XOFA_IV2 0xf2db820c7e587838ull
#define ASCON_XOFA_IV3 0xa991ae5fd830ad8bull
#define ASCON_XOFA_IV4 0x25f0ccd7d1c1e4b3ull

#define RC0 0x0000000c0000000cull
#define RC1 0x0000000c00000009ull
#define RC2 0x000000090000000cull
#define RC3 0x0000000900000009ull
#define RC4 0x0000000c00000006ull
#define RC5 0x0000000c00000003ull
#define RC6 0x0000000900000006ull
#define RC7 0x0000000900000003ull
#define RC8 0x000000060000000cull
#define RC9 0x0000000600000009ull
#define RCa 0x000000030000000cull
#define RCb 0x0000000300000009ull

#define RC(i) ((uint64_t)constants[i + 1] << 32 | constants[i])

#define START(n) (24 - 2 * (n))
#define INC 2
#define END 24

extern const uint8_t constants[];

#endif /* CONSTANTS_H_ */
