%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Copyright: 2010 Integrated Sytems Laboratory, ETH Zurich
%%            http://www.iis.ee.ethz.ch/~sha3
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function round_const=keccak_round_constants(rounds_nr)
lfsr=1;
round_const=zeros(1,rounds_nr,'uint64'); 
for i=1:rounds_nr 
    for j=0:6
        bit_position=bitshift(1,j)-1;
        if(~isequal(bitand(lfsr,1),0))
            round_const(i)=bitxor(round_const(i),bitshift(uint64(1),bit_position));
        end
        lfsr=counter(lfsr);
    end

end
end

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