Skip to content

Instantly share code, notes, and snippets.

@Raniita
Created June 12, 2019 20:47
Show Gist options
  • Save Raniita/091b5ce338f5659ea8652fdaf62663bb to your computer and use it in GitHub Desktop.
Save Raniita/091b5ce338f5659ea8652fdaf62663bb to your computer and use it in GitHub Desktop.
polybius cipher
function [msg_cifrado] = polybius(msg, clave)
% msg -> msg a TX
% clave -> matriz para seguir el cifrado
msg_cifrado = '';
for i=1:length(msg)
% Buscamos el caracter
cipher_matrix = strfind(clave, msg(i));
[row,col] = find(not(cellfun('isempty',cipher_matrix)));
msg_cifrado = strcat(msg_cifrado,num2str(row),num2str(col));
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment