%split model assuming only one character output, 128 characters in the
%alphabet, with the alphabet starting with ascii character of decimal
%rep 0
function [hash]= unfrust(input,secret)%input message in string format, key in string format
new_string= [];%to initialize matrix of binary rep of message
for i=1:length(input)%for all letters in the message
    nextval= double(input(i));%nextval is decimal rep of letter 
    binval= dec2bin(nextval,7);%binval is binary rep of each letter
    new_string= [new_string;binval];%matrix of binary rep of message (columns correspond to each letter)
end;
key= dec2bin(double(secret),7); %binary rep of key
unhash= [key;new_string];%matrix including both binary rep of key and binary rep of message

hash=[];%to initialize matrix of hash values
for i=1:7%for each bit of each character
    col=str2num([key(i);new_string(:,i)]);%convert each binary rep of each character into a number
    for j=2:length(col)%for each character in the message (not including the key)
    col(j)= xor(col(j-1), col(j) );%xor number value of character with previous entry in the column
    end;    
    hash=[hash,col(j)];%make matrix of of final hash values (final xor value in each column)
end;

hash= bin2dec(num2str(hash));%convert each binary rep of each hash character into its correspondng ascii decimal value

