mirror of
https://github.com/logos-storage/zk-benchmarks.git
synced 2026-01-17 13:03:10 +00:00
add SHA256 benchmark via the Unix tool and pipes
This commit is contained in:
parent
fadfcf6e5f
commit
4b8a5554b1
3
hash/cpu/bench/SHA256/Unix/build.sh
Executable file
3
hash/cpu/bench/SHA256/Unix/build.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
gcc -O3 fakedata.c
|
||||
38
hash/cpu/bench/SHA256/Unix/fakedata.c
Normal file
38
hash/cpu/bench/SHA256/Unix/fakedata.c
Normal file
@ -0,0 +1,38 @@
|
||||
|
||||
// generate given amount of fake data to be hashed, and push it to standard output
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void generate(megabytes) {
|
||||
|
||||
unsigned char buffer[257];
|
||||
for(int i=0;i<256;i++) { buffer[i] = 1+(i%255); }
|
||||
buffer[256] = 0;
|
||||
|
||||
for(int i=0;i<megabytes;i++) {
|
||||
for(int j=0;j<4096;j++) {
|
||||
fputs( (char*)buffer, stdout);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int main( int argc, char *argv[] ) {
|
||||
|
||||
int megabytes = 1;
|
||||
switch(argc) {
|
||||
|
||||
case 2:
|
||||
megabytes = atoi(argv[1]);
|
||||
generate(megabytes);
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("usage:\n");
|
||||
printf("$ fakedata <amount_in_megabytes>:\n");
|
||||
exit(-1);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
3
hash/cpu/bench/SHA256/Unix/run.sh
Executable file
3
hash/cpu/bench/SHA256/Unix/run.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
./a.out $ZKBENCH_MEGABYTES | shasum -a256 -b -
|
||||
Loading…
x
Reference in New Issue
Block a user