%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Copyright: 2010 Integrated Sytems Laboratory, ETH Zurich
%%            http://www.iis.ee.ethz.ch/~sha3
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [B] = lastround(A,cr)
S0=[9 0 4 11 13 12 3 15 1 10 2 6 7 5 8 14];
S1=[3 12 6 13 5 7 1 9 15 2 0 4 11 10 14 8];

v=zeros(1,256);
for i=1:256 %Sub Operation
    check=bin2dec(cr(i));
    if check==0,
       v(i)=S0(A(i)+1);
    else
       v(i)=S1(A(i)+1);
    end
end
B=v;

Generated on Fri Sep 24 10:39:12 CEST 2010
Home