1. Get the KeccakCodePackage from github
git clone https://github.com/gvanas/KeccakCodePackage.git
2. Find out what architecture you want:
cd KeccakCodePackage
make | grep libkeccak
4. Make the right library
make generic64/libkeccak.a
5. Example program test_K12.c
#include <stdlib.h>
#include <stdio.h>
#include "KeccakCodePackage.h"
int main(){
unsigned char output[32];
unsigned char input[] = "hello";
unsigned char custom[] = "wong";
if(KangarooTwelve(input, sizeof(input), output, sizeof(output), custom, sizeof(custom)) != 0) {
printf("error\n");
return EXIT_FAILURE;
}
for(int i = 0; i<32; i++){
printf("%02x", output[i]);
}
printf("\n");
return EXIT_SUCCESS;
}
6. Build with your custom path
gcc -std=c99 -pedantic -L path/KeccakCodePackage/bin/generic64/ -lkeccak -I path/KeccakCodePackage/bin/generic64/libkeccak.a.headers test_k12.c
Where is the include file in this line:
#include "KeccakCodePackage.h"