keccaknistinterface.h

来自「Keccak hash加密算法」· C头文件 代码 · 共 46 行

H
46
字号
/*Algorithm Name: KeccakAuthors: Guido Bertoni, Joan Daemen, Michaël Peeters and Gilles Van AsscheDate: October 27, 2008This code, originally by Guido Bertoni, Joan Daemen, Michaël Peeters andGilles Van Assche as a part of the SHA-3 submission, is hereby put in thepublic domain. It is given as is, without any guarantee.For more information, feedback or questions, please refer to our website:http://keccak.noekeon.org/*/#ifndef _KeccakNISTInterface_h_#define _KeccakNISTInterface_h_typedef unsigned char BitSequence;typedef unsigned long long DataLength;typedef enum { SUCCESS = 0, FAIL = 1, BAD_HASHLEN = 2 } HashReturn;#define KeccakPermutationSize 1600#define KeccakPermutationSizeInBytes (KeccakPermutationSize/8)#define KeccakMaximumRate 1024#define KeccakMaximumRateInBytes (KeccakMaximumRate/8)typedef struct {    unsigned int rate;    unsigned int capacity;    unsigned char diversifier;    unsigned int hashbitlen;    unsigned char state[KeccakPermutationSizeInBytes];    BitSequence dataQueue[KeccakMaximumRateInBytes];    unsigned int bitsInQueue;    int squeezing;    unsigned int bitsAvailableForSqueezing;} hashState;HashReturn Init(hashState *state, int hashbitlen);HashReturn Update(hashState *state, const BitSequence *data, DataLength databitlen);HashReturn Final(hashState *state, BitSequence *hashval);HashReturn Squeeze(hashState *state, BitSequence *output, DataLength outputLength);HashReturn Hash(int hashbitlen, const BitSequence *data, DataLength databitlen, BitSequence *hashval);#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?