Skip to content

Instantly share code, notes, and snippets.

@mimoo
Created June 14, 2017 10:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mimoo/746205bc29e171ba8ad5b75793283057 to your computer and use it in GitHub Desktop.
Save mimoo/746205bc29e171ba8ad5b75793283057 to your computer and use it in GitHub Desktop.
How to use the KeccakCodePackage

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
@golflegend24
Copy link

Where is the include file in this line:
#include "KeccakCodePackage.h"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment