shake.t
1 #! /usr/bin/env perl 2 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # you may not use this file except in compliance with the License. 5 # See the NOTICE file distributed with this work for additional 6 # information regarding copyright ownership. 7 # You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 17 use strict; 18 use warnings; 19 20 use FindBin; 21 use lib "$FindBin::Bin"; 22 use driver; 23 use cmd_helpers; 24 25 my $empty = ""; 26 my $a3_200_times = "a3" x 200; 27 runtests( 28 { 29 title => 'SHAKE128 with test results from "openssl dgst -shake128 -xoflen 32"', 30 cases => [ 31 hash => { 32 input => 'input', 33 output => 'output', 34 outlen => 32, 35 cmd => mk_cmd('lesec-tool', 'digest', 36 '-plugin' => 'ltc', 37 'shake128') 38 } 39 ], 40 vectors => [ 41 { 42 tests => [ 43 { 44 input => $empty, 45 output => "7f9c2ba4e88f827d616045507605853ed73b8093f6efbc88eb1a6eacfa66ef26", 46 }, 47 { 48 input => $a3_200_times, 49 output => "131ab8d2b594946b9c81333f9bb6e0ce75c3b93104fa3469d3917457385da037" 50 } 51 ] 52 } 53 ] 54 }, 55 { 56 title => 'SHAKE256 with test results from "openssl dgst -shake256 -xoflen 32"', 57 cases => [ 58 hash => { 59 input => 'input', 60 output => 'output', 61 outlen => 32, 62 cmd => mk_cmd('lesec-tool', 'digest', 63 '-plugin' => 'ltc', 64 'shake256') 65 } 66 ], 67 vectors => [ 68 { 69 tests => [ 70 { 71 input => $empty, 72 output => "46b9dd2b0ba88d13233b3feb743eeb243fcd52ea62b81b82b50c27646ed5762f", 73 }, 74 { 75 input => $a3_200_times, 76 output => "cd8a920ed141aa0407a22d59288652e9d9f1a7ee0c1e7c1ca699424da84a904d", 77 }, 78 ] 79 } 80 ] 81 }, 82 );