%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Copyright: 2010 Integrated Sytems Laboratory, ETH Zurich %% http://www.iis.ee.ethz.ch/~sha3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [hash]=groestl_256_output(x,r) %Output Transformation %Takes the last output from groestl_256, makes the output transformation %and gives out the last 256 bits as a hexadecimal vector %Calculate P(x) p=x; for i=1:r, p=addroundconstant(p,0,i-1); %{ p=subbytes(p); p=shiftbytes(p); %} %New function subshiftbytes p=subshiftbytes(p); p=mixbytes(p); end %Omega=P(x)+x omega=bitxor(p,x); %Take the 256 last bits of Omega fihash=[omega(1:8,5)',omega(1:8,6)',omega(1:8,7)',omega(1:8,8)']; %Parse the whole thing to a Hexstring % hash=[fihash.hex(1),fihash.hex(2)]; % for i=6:5:5*32 % hash=[hash,fihash.hex(i),fihash.hex(i+1)]; % end hash = mod(fihash, 256); end