Browse Source

more strobe modes

master
Mike Hamburg 9 years ago
parent
commit
19612400f9
3 changed files with 13 additions and 2 deletions
  1. +1
    -0
      include/shake.h
  2. +1
    -0
      src/shake.c
  3. +11
    -2
      test/bench_decaf.cxx

+ 1
- 0
include/shake.h View File

@@ -249,6 +249,7 @@ void spongerng_stir (
size_t len size_t len
) NONNULL2 API_VIS; ) NONNULL2 API_VIS;


extern const struct kparams_s STROBE_128 API_VIS;
extern const struct kparams_s STROBE_256 API_VIS; extern const struct kparams_s STROBE_256 API_VIS;
extern const struct kparams_s STROBE_KEYED_128 API_VIS; extern const struct kparams_s STROBE_KEYED_128 API_VIS;
extern const struct kparams_s STROBE_KEYED_256 API_VIS; extern const struct kparams_s STROBE_KEYED_256 API_VIS;


+ 1
- 0
src/shake.c View File

@@ -447,6 +447,7 @@ int spongerng_init_from_dev_urandom (
return spongerng_init_from_file(sponge, "/dev/urandom", 64, 0); return spongerng_init_from_file(sponge, "/dev/urandom", 64, 0);
} }


const struct kparams_s STROBE_128 = { 0, 0, 200-128/4, 0, 0, 0, 0, 0 };
const struct kparams_s STROBE_256 = { 0, 0, 200-256/4, 0, 0, 0, 0, 0 }; const struct kparams_s STROBE_256 = { 0, 0, 200-256/4, 0, 0, 0, 0, 0 };
const struct kparams_s STROBE_KEYED_256 = { 0, 0, 200-256/4, 12, 0, 0, 0, 0 }; const struct kparams_s STROBE_KEYED_256 = { 0, 0, 200-256/4, 12, 0, 0, 0, 0 };
const struct kparams_s STROBE_KEYED_128 = { 0, 0, 200-128/4, 12, 0, 0, 0, 0 }; const struct kparams_s STROBE_KEYED_128 = { 0, 0, 200-128/4, 12, 0, 0, 0, 0 };


+ 11
- 2
test/bench_decaf.cxx View File

@@ -273,11 +273,20 @@ int main(int argc, char **argv) {
for (Benchmark b("SHAKE256 1kiB", 30); b.iter(); ) { shake2 += TmpBuffer(b1024,1024); } for (Benchmark b("SHAKE256 1kiB", 30); b.iter(); ) { shake2 += TmpBuffer(b1024,1024); }
for (Benchmark b("SHA3-512 1kiB", 30); b.iter(); ) { sha5 += TmpBuffer(b1024,1024); } for (Benchmark b("SHA3-512 1kiB", 30); b.iter(); ) { sha5 += TmpBuffer(b1024,1024); }
strobe.key(TmpBuffer(b1024,1024)); strobe.key(TmpBuffer(b1024,1024));
for (Benchmark b("STROBE256 1kiB", 30); b.iter(); ) {
strobe.respec(STROBE_128);
for (Benchmark b("STROBE128 1kiB", 10); b.iter(); ) {
strobe.encrypt_no_auth(TmpBuffer(b1024,1024),TmpBuffer(b1024,1024),b.i>1);
}
strobe.respec(STROBE_256);
for (Benchmark b("STROBE256 1kiB", 10); b.iter(); ) {
strobe.encrypt_no_auth(TmpBuffer(b1024,1024),TmpBuffer(b1024,1024),b.i>1); strobe.encrypt_no_auth(TmpBuffer(b1024,1024),TmpBuffer(b1024,1024),b.i>1);
} }
strobe.respec(STROBE_KEYED_128); strobe.respec(STROBE_KEYED_128);
for (Benchmark b("STROBEk128 1kiB", 30); b.iter(); ) {
for (Benchmark b("STROBEk128 1kiB", 10); b.iter(); ) {
strobe.encrypt_no_auth(TmpBuffer(b1024,1024),TmpBuffer(b1024,1024),b.i>1);
}
strobe.respec(STROBE_KEYED_256);
for (Benchmark b("STROBEk256 1kiB", 10); b.iter(); ) {
strobe.encrypt_no_auth(TmpBuffer(b1024,1024),TmpBuffer(b1024,1024),b.i>1); strobe.encrypt_no_auth(TmpBuffer(b1024,1024),TmpBuffer(b1024,1024),b.i>1);
} }
for (Benchmark b("Scalar add", 1000); b.iter(); ) { s+=t; } for (Benchmark b("Scalar add", 1000); b.iter(); ) { s+=t; }


Loading…
Cancel
Save