CAVP crypto 113.10.09
Implements various cryptographic algorithms for CAVP validation.
 
Loading...
Searching...
No Matches
myShake.c File Reference
#include <tommath.h>
#include "stdio.h"
#include "string.h"
#include <tomcrypt.h>
#include "utils.h"
#include <math.h>

Macros

#define _CRT_SECURE_NO_WARNINGS
 

Functions

void shakeHash (const int hashAlgorithm, const char *message, int outHashLength, char *outHash)
 SHAKE 可變長度雜湊函數
 
void shakeMCTHash (const int hashAlgorithm, const char *initialSeedString, int maxOutBitLength, int minOutBitLength)
 SHAKE 可變長度雜湊函數的Monte Carlo Test.
 

Variables

const int SHAKE_128 = 1
 
const int SHAKE_256 = 2
 

Macro Definition Documentation

◆ _CRT_SECURE_NO_WARNINGS

#define _CRT_SECURE_NO_WARNINGS

Function Documentation

◆ shakeHash()

void shakeHash ( const int hashAlgorithm,
const char * message,
int outHashLength,
char * outHash )

SHAKE 可變長度雜湊函數

SHAKE 可變長度雜湊函數
此函式的輸入為雜湊演算法、訊息、雜湊值長度
此函式的輸出為雜湊值
使用範例:

char* message = "4169C84E8FF3C9B66961646CF18D5654";
char output[(3152/8)*2+1];
int outLen = 3152;
shakeHash(SHAKE_128, message, outLen, output);
printf("output: %s\n", output); //57C08C18DF....CB8A79
const int SHAKE_128
Definition myShake.c:9
void shakeHash(const int hashAlgorithm, const char *message, int outHashLength, char *outHash)
SHAKE 可變長度雜湊函數
Definition myShake.c:14
Parameters
hashAlgorithm使用的雜湊演算法: SHAKE_128, SHAKE_256
message要雜湊的訊息
outHashLength希望輸出的雜湊值長度 (bits)
outHash輸出的雜湊值 (利用指標回傳)

◆ shakeMCTHash()

void shakeMCTHash ( const int hashAlgorithm,
const char * initialSeedString,
int maxOutBitLength,
int minOutBitLength )

SHAKE 可變長度雜湊函數的Monte Carlo Test.

SHAKE 可變長度雜湊函數的Monte Carlo Test
此函式的輸入為雜湊演算法、初始種子字串、最大輸出長度、最小輸出長度
使用範例:

char* message = "B1C0D66C55B27FA3D627939AB6C54619";
int maxLen = 51200;
int minLen = 16;
shakeMCTHash(SHAKE_256, message, maxLen, minLen);
const int SHAKE_256
Definition myShake.c:10
void shakeMCTHash(const int hashAlgorithm, const char *initialSeedString, int maxOutBitLength, int minOutBitLength)
SHAKE 可變長度雜湊函數的Monte Carlo Test.
Definition myShake.c:75
Parameters
hashAlgorithm使用的雜湊演算法: SHAKE_128, SHAKE_256
initialSeedString初始種子字串
maxOutBitLength最大輸出長度 (MCT測試所需)
minOutBitLength最小輸出長度 (MCT測試所需)

Variable Documentation

◆ SHAKE_128

const int SHAKE_128 = 1

◆ SHAKE_256

const int SHAKE_256 = 2