function whirlpooliso(vb)

% Generates the ISO/IEC 10118-3 test vector set for Whirlpool. Stores 
% hashes in the file isotestvectors.m.
%
% Copyright (c) 2008 Karl J A Petre and Xavier J Ortiz.
% This file was last updated 8 December 2008.
%
% This code is included with the Matlab Whirlpool package.
%
% The Whirlpool algorithm was developed by:
%     Paulo S. L. M. Barreto (pbarreto@scopus.com.br)
%     Vincent Rijmen (vincent.rijmen@cryptomathic.com)
%
% This software is provided by the author as is and any express
% or implied warranties, including, but not limited to, the implied
% warranties of merchantability and fitness for a particular purpose
% are disclaimed. In no event shall the author or contributors be
% liable for any direct, indirect, incidental, special, exemplary, or
% consequential damages (including, but not limited to, procurement of
% substitute goods or services; loss of use, data, or profits; or
% business interruption) however caused and on any theory of liability,
% whether in contract, strict liability, or tort (including negligence
% or otherwise) arising in any way out of the use of this software,
% even if advised on the possibility of such damage.

if nargin < 1; vb = 0; end % Assume no verbose output.

R = 10;
[C,rc] = buildconstants(R);
fid = fopen('isotestvectors.m','w');
s = '';
disp('Source:')
disp(['   ' s])
hash = whirlpool(s,C,rc);
fprintf(fid,['1: ''' s '''\n\n']);
fprintf(fid,['   ' bv2hex(hash(1,:)) ' ' bv2hex(hash(2,:)) ' ' bv2hex(hash(3,:)) ' ' bv2hex(hash(4,:)) '\n']);
fprintf(fid,['   ' bv2hex(hash(5,:)) ' ' bv2hex(hash(6,:)) ' ' bv2hex(hash(7,:)) ' ' bv2hex(hash(8,:)) '\n\n']);
s = 'a';
disp('Source:')
disp(['   ' s])
hash = whirlpool(s,C,rc);
fprintf(fid,['2: ''' s '''\n\n']);
fprintf(fid,['   ' bv2hex(hash(1,:)) ' ' bv2hex(hash(2,:)) ' ' bv2hex(hash(3,:)) ' ' bv2hex(hash(4,:)) '\n']);
fprintf(fid,['   ' bv2hex(hash(5,:)) ' ' bv2hex(hash(6,:)) ' ' bv2hex(hash(7,:)) ' ' bv2hex(hash(8,:)) '\n\n']);
s = 'abc';
disp('Source:')
disp(['   ' s])
hash = whirlpool(s,C,rc);
fprintf(fid,['3: ''' s '''\n\n']);
fprintf(fid,['   ' bv2hex(hash(1,:)) ' ' bv2hex(hash(2,:)) ' ' bv2hex(hash(3,:)) ' ' bv2hex(hash(4,:)) '\n']);
fprintf(fid,['   ' bv2hex(hash(5,:)) ' ' bv2hex(hash(6,:)) ' ' bv2hex(hash(7,:)) ' ' bv2hex(hash(8,:)) '\n\n']);
s = 'message digest';
disp('Source:')
disp(['   ' s])
hash = whirlpool(s,C,rc);
fprintf(fid,['4: ''' s '''\n\n']);
fprintf(fid,['   ' bv2hex(hash(1,:)) ' ' bv2hex(hash(2,:)) ' ' bv2hex(hash(3,:)) ' ' bv2hex(hash(4,:)) '\n']);
fprintf(fid,['   ' bv2hex(hash(5,:)) ' ' bv2hex(hash(6,:)) ' ' bv2hex(hash(7,:)) ' ' bv2hex(hash(8,:)) '\n\n']);
s = 'abcdefghijklmnopqrstuvwxyz';
disp('Source:')
disp(['   ' s])
hash = whirlpool(s,C,rc);
fprintf(fid,['5: ''' s '''\n\n']);
fprintf(fid,['   ' bv2hex(hash(1,:)) ' ' bv2hex(hash(2,:)) ' ' bv2hex(hash(3,:)) ' ' bv2hex(hash(4,:)) '\n']);
fprintf(fid,['   ' bv2hex(hash(5,:)) ' ' bv2hex(hash(6,:)) ' ' bv2hex(hash(7,:)) ' ' bv2hex(hash(8,:)) '\n\n']);
s = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
disp('Source:')
disp(['   ' s])
hash = whirlpool(s,C,rc);
fprintf(fid,['6: ''' s '''\n\n']);
fprintf(fid,['   ' bv2hex(hash(1,:)) ' ' bv2hex(hash(2,:)) ' ' bv2hex(hash(3,:)) ' ' bv2hex(hash(4,:)) '\n']);
fprintf(fid,['   ' bv2hex(hash(5,:)) ' ' bv2hex(hash(6,:)) ' ' bv2hex(hash(7,:)) ' ' bv2hex(hash(8,:)) '\n\n']);
s = '12345678901234567890123456789012345678901234567890123456789012345678901234567890';
disp('Source:')
disp(['   ' s])
hash = whirlpool(s,C,rc);
fprintf(fid,['7: ''' s '''\n\n']);
fprintf(fid,['   ' bv2hex(hash(1,:)) ' ' bv2hex(hash(2,:)) ' ' bv2hex(hash(3,:)) ' ' bv2hex(hash(4,:)) '\n']);
fprintf(fid,['   ' bv2hex(hash(5,:)) ' ' bv2hex(hash(6,:)) ' ' bv2hex(hash(7,:)) ' ' bv2hex(hash(8,:)) '\n\n']);
s = 'abcdbcdecdefdefgefghfghighijhijk';
disp('Source:')
disp(['   ' s])
hash = whirlpool(s,C,rc);
fprintf(fid,['8: ''' s '''\n\n']);
fprintf(fid,['   ' bv2hex(hash(1,:)) ' ' bv2hex(hash(2,:)) ' ' bv2hex(hash(3,:)) ' ' bv2hex(hash(4,:)) '\n']);
fprintf(fid,['   ' bv2hex(hash(5,:)) ' ' bv2hex(hash(6,:)) ' ' bv2hex(hash(7,:)) ' ' bv2hex(hash(8,:)) '\n\n']);
% s = '';
% for i = 1:10^6
%     s = [s 'a'];
% end
% disp('Source:')
% disp(['   ' s])
% hash = whirlpool(s,C,rc);
% fprintf(fid,['9: ''' s '''\n\n']);
% fprintf(fid,['   ' bv2hex(hash(1,:)) ' ' bv2hex(hash(2,:)) ' ' bv2hex(hash(3,:)) ' ' bv2hex(hash(4,:)) '\n']);
% fprintf(fid,['   ' bv2hex(hash(5,:)) ' ' bv2hex(hash(6,:)) ' ' bv2hex(hash(7,:)) ' ' bv2hex(hash(8,:))]);
fclose(fid);