%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Copyright: 2010 Integrated Sytems Laboratory, ETH Zurich %% http://www.iis.ee.ethz.ch/~sha3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%functionx = roundr(x)fori=1:16, x(i+16) =mod(x(i) + x(i+16), 2^32);endfori=1:16, x(i) =bin2dec(dec2bin(circshift(double(dec2bin(x(i),32)-48 ),[0 -7]))');endfori=1:8, temp = x(i); x(i) = x(i+8); x(i+8) = temp;endfori=1:16, x(i) =bitxor(x(i), x(i+16));endfori=17:4:32, temp = x(i); x(i) = x(i+2); x(i+2) = temp; temp = x(i+1); x(i+1) = x(i+3); x(i+3) = temp;end%--------------------------------------------------------------------------fori=1:16, x(i+16) =mod(x(i) + x(i+16), 2^32);endfori=1:16, x(i) =bin2dec(dec2bin(circshift(double(dec2bin(x(i),32)-48),[0 -11]))');endfori=1:8:16, temp = x(i); x(i) = x(i+4); x(i+4) = temp; temp = x(i+1); x(i+1) = x(i+5); x(i+5) = temp; temp = x(i+2); x(i+2) = x(i+6); x(i+6) = temp; temp = x(i+3); x(i+3) = x(i+7); x(i+7) = temp;endfori=1:16, x(i) =bitxor(x(i), x(i+16));endfori=17:2:32, temp = x(i); x(i) = x(i+1); x(i+1) = temp;end

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

Home