alphabet=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'];

alphabetCesar=['d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','a','b','c']


//list_to_string ([16,1,16,1])->papa
function[r]=list_to_string(mot_list)
r = '';
for i =1:length(mot_list)
r = r + alphabet(mot_list(i));
end
endfunction

//string_to_list('papa') -> [16,1,16,1]
function[liste]=string_to_list(mot_string)
liste=zeros(1,length(mot_string));
x=strsplit(mot_string,[1:length(mot_string)-1])
for i=1:prod(size(x))
liste(i)=find(x(i)==alphabet)
end
endfunction

A=string_to_list('papa');
B=list_to_string([16,1,16,1]);



//list_to_string_Cesar ([16,1,16,1])->papa
function[r]=list_to_string_Cesar(mot_list)
r = '';
for i =1:length(mot_list)
r = r + alphabetCesar(mot_list(i));
end
endfunction

//string_to_list_Cesar('papa') -> [16,1,16,1]
function[liste]=string_to_list_Cesar(mot_string)
liste=zeros(1,length(mot_string));
x=strsplit(mot_string,[1:length(mot_string)-1])
for i=1:prod(size(x))
liste(i)=find(x(i)==alphabetCesar)
end
endfunction

ACesar=string_to_list_Cesar('papa');
BCesar=list_to_string_Cesar([13,24,13,24]);

//Chiffrement selon le chiffre de César
function MChif=Chiffrement(message_clair)
    positions=string_to_list(message_clair)
    MChif=list_to_string_Cesar(positions)
endfunction

//Déchiffrement du chiffre de César
function MClair=deChiffrement(message_chiffre)
    positions=string_to_list_Cesar(message_chiffre)
    MClair=list_to_string(positions)
endfunction


message_clair='papa'


MChif=Chiffrement(message_clair)
MClair=deChiffrement(MChif)



