%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Copyright: 2010 Integrated Sytems Laboratory, ETH Zurich %% http://www.iis.ee.ethz.ch/~sha3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function Hs = blake(M, H, S, C) par32; nround = 10; V = initialization(H, S, C, p); % disp('Vinit:'); disp(' '); disp(dec2hex(V)); disp(' '); for j=1:nround, [V(1) V(5) V(9) V(13)] = g(V(1), V(5), V(9), V(13), M, j, 0, p); [V(2) V(6) V(10) V(14)] = g(V(2), V(6), V(10), V(14), M, j, 1, p); [V(3) V(7) V(11) V(15)] = g(V(3), V(7), V(11), V(15), M, j, 2, p); [V(4) V(8) V(12) V(16)] = g(V(4), V(8), V(12), V(16), M, j, 3, p); [V(1) V(6) V(11) V(16)] = g(V(1), V(6), V(11), V(16), M, j, 4, p); [V(2) V(7) V(12) V(13)] = g(V(2), V(7), V(12), V(13), M, j, 5, p); [V(3) V(8) V(9) V(14)] = g(V(3), V(8), V(9), V(14), M, j, 6, p); [V(4) V(5) V(10) V(15)] = g(V(4), V(5), V(10), V(15), M, j, 7, p); % disp(['V at round ' num2str(j-1) ]); disp([dec2hex(V(1)) ' ' dec2hex(V(2)) ' ' dec2hex(V(3)) ' ' dec2hex(V(4)) ' '... % dec2hex(V(5)) ' ' dec2hex(V(6)) ' ' dec2hex(V(7)) ' ' dec2hex(V(8)) ' ' dec2hex(V(9)) ' ' dec2hex(V(10)) ' ' ... % dec2hex(V(11)) ' ' dec2hex(V(12)) ' ' dec2hex(V(13)) ' ' dec2hex(V(14)) ' ' dec2hex(V(15)) ' ' dec2hex(V(16))]); disp(' '); end Hs = finalization(V, H, S, p); % disp('Final Result:') % disp(' ') % disp(dec2hex(Hs)) % disp(' ')