% Code is for Octave
%-----------------------------------%
%                                   %
% (C) 2014 - Michael K. Pellegrino  %
%                                   %
% My implementation of a Hill       %
% Cipher decoder.                   %
%                                   %
% usage: decrypthill( String, Key ) %
% where Key is a 2x2 matrix         %
%                                   %
%-----------------------------------%
function ret=decrypthill( S, K )
  K=getkey(K);
  ret=[];

  l=size(S)(2); %Get String length

  for i=1:2:l
    p=[ S(i) ; S(i+1) ];
    C=K*p;
    ret=[ ret mod(C(1),61) mod(C(2),61) ];
  endfor

  ret+=32;
  ret=char( ret );
 
endfunction
