File: sha3.awk

package info (click to toggle)
nettle 3.10.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,508 kB
  • sloc: ansic: 72,410; asm: 21,179; sh: 4,328; makefile: 837; cpp: 71; awk: 7
file content (14 lines) | stat: -rwxr-xr-x 477 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#! /usr/bin/awk -f

# This script is used to process the Keccak testvectors, originally
# we used http://keccak.noekeon.org/KeccakKAT-3.zip.
# For the updated NIST version, test vectors can be found at
# https://github.com/gvanas/KeccakCodePackage/tree/master/TestVectors

/^Len/ { len = $3 }
/^Msg/ { msg = $3 }
/^MD/ { md = $3;
  if (len % 8 == 0)
    printf("test_hash(&nettle_sha3_xxx, /* %d octets */\nSHEX(\"%s\"),\nSHEX(\"%s\"));\n",
	   len / 8, len ? msg : "", md);
}