%to make color plots with messages and keys and corresponding hash values
%sorted by key (each key and corresponding set of messages and hash values
%in different color plots)
function make = eachkey(X,Y,L,T)%L=length of message, X ascii character alphabet starts with,Y ascii character alphabet ends with, T=type of hashing method
Mat=color2(X,Y,L,T);%matrix of all messages and keys their corresponding hash values, already sorted by key
b=0;
x1=double(X);%numerical representation of smallest ascii number in our alphabet
y1=double(Y); %numerical representation of largest ascii number in our alphabet
y=y1-x1;
A=(y1-x1)+1; %length of alphabet
for i=0:y;%for each key
    for j=1:A*(A^L);%for all possible messages and hash values
        %make matrices of all the message and hash combinations for each
        %key
        if Mat(j,L+1)==i
            b=b+1;
            Make(b,:)=Mat(j,:);
        end;
    end;
    figure
    imagesc(Make,[min(Make(:)) max(Make(:))]); 
    colormap(colorcube)
    b=0;
end;