Forum Liberty Basic France
• Index
• Projets open source » Simulation cryptage Enigma Simulation cryptage et décryptage avec 3 rotors et un réflecteur
' CHIFFREMENT D'UN MESSAGE
'Créé par Jacques Donner le 20/04/15
a=13: b=7: c=19 'Position initiale des rotors
Rotor$(1) = "EKMFLGDQVZNTOWYHXUSPAIBRCJ"
Rotor$(2) = "AJDKSIRUXBLHWTMCQGZNPYFVOE"
Rotor$(3) = "BDFHJLCPRTXVZNYEIWGAKMUSQO"
Rotor$(4) = "ESOVPZJAYQUIRHXLNFTGKDCMWB" 'Pas utilisé
Rotor$(5) = "VZBRGITYUPSDNHLXAWMJQOFECK" 'Pas utilisé
Reflect$ = "YRUHQSLDPXNGOKMIEBFZCWVJAT"
input "Message à chiffrer ? ";tex$
tex$ = upper$(tex$)
lt = len(tex$)
print lt
global t$
for p = 1 to lt
t$ = mid$(tex$,p,1)
a=a+1 'compteur
if a>26 then a=1 : b=b+1
if b>26 then b=1 : c=c+1
call chif a,1
call chif b,2
call chif c,3
R=asc(t$)-64
t$=mid$(Reflect$,R,1)
call chif c,3
call chif b,2
call chif a,1
tu$=tu$ + t$
tt$=tt$ + t$
if p mod 5 =0 then tt$ = tt$+ " "
next p
open "Systdata.bas" for output as #1
print #1,tu$
close #1
print tex$
print tt$
end
sub chif co,ro
R=asc(t$)-64 + co
if R>26 then R = R -26
t$ = mid$(Rotor$(ro),R,1)
end sub
'Créé par Jacques Donner le 20/04/15
a=13: b=7: c=19 'Position initiale des rotors
Rotor$(1) = "EKMFLGDQVZNTOWYHXUSPAIBRCJ"
Rotor$(2) = "AJDKSIRUXBLHWTMCQGZNPYFVOE"
Rotor$(3) = "BDFHJLCPRTXVZNYEIWGAKMUSQO"
Rotor$(4) = "ESOVPZJAYQUIRHXLNFTGKDCMWB" 'Pas utilisé
Rotor$(5) = "VZBRGITYUPSDNHLXAWMJQOFECK" 'Pas utilisé
Reflect$ = "YRUHQSLDPXNGOKMIEBFZCWVJAT"
input "Message à chiffrer ? ";tex$
tex$ = upper$(tex$)
lt = len(tex$)
print lt
global t$
for p = 1 to lt
t$ = mid$(tex$,p,1)
a=a+1 'compteur
if a>26 then a=1 : b=b+1
if b>26 then b=1 : c=c+1
call chif a,1
call chif b,2
call chif c,3
R=asc(t$)-64
t$=mid$(Reflect$,R,1)
call chif c,3
call chif b,2
call chif a,1
tu$=tu$ + t$
tt$=tt$ + t$
if p mod 5 =0 then tt$ = tt$+ " "
next p
open "Systdata.bas" for output as #1
print #1,tu$
close #1
print tex$
print tt$
end
sub chif co,ro
R=asc(t$)-64 + co
if R>26 then R = R -26
t$ = mid$(Rotor$(ro),R,1)
end sub
• Projets open source » Simulation cryptage Enigma Simulation cryptage et décryptage avec 3 rotors et un réflecteur
• Index
1 Utilisateur en ligne : 0 Administrateur, 0 Modérateur, 0 Membre et 1 Visiteur
Utilisateur en ligne : Aucun membre connecté
Utilisateur en ligne : Aucun membre connecté
Répondre
Vous n'êtes pas autorisé à écrire dans cette catégorie