Algobox TPE code rsa

Réponses à toutes vos questions de la 2nde à la Terminale toutes séries
reloulol
Messages: 1
Enregistré le: 29 Déc 2017, 13:10

Algobox TPE code rsa

par reloulol » 29 Déc 2017, 13:16

Bonjour, je souhaité réaliser un algorithme montrant les étapes du code rsa sur algobox en utulisant cette source http://math.as.free.fr/Un_gout_pour_les ... oderne.htm
tout marche juste à la fin quand je ne trouve pas le même nombre lors de mon décryptage merci d'avance de l'aide .
FONCTIONS_UTILISEES
VARIABLES
x EST_DU_TYPE NOMBRE
i EST_DU_TYPE NOMBRE
premier EST_DU_TYPE NOMBRE
p EST_DU_TYPE NOMBRE
q EST_DU_TYPE NOMBRE
premier2 EST_DU_TYPE NOMBRE
i2 EST_DU_TYPE NOMBRE
n EST_DU_TYPE NOMBRE
h EST_DU_TYPE NOMBRE
e EST_DU_TYPE NOMBRE
mot EST_DU_TYPE CHAINE
ascii EST_DU_TYPE NOMBRE
asciee_carré EST_DU_TYPE NOMBRE
ascie_finale EST_DU_TYPE NOMBRE
i3 EST_DU_TYPE NOMBRE
DEBUT_ALGORITHME
AFFICHER "Entrer le nombre premier p "
LIRE p
AFFICHER "Entrer le nombre premier q"
LIRE q
POUR i ALLANT_DE 2 A p-1
DEBUT_POUR
SI (p%i==0) ALORS
DEBUT_SI
premier PREND_LA_VALEUR 1
FIN_SI
FIN_POUR
POUR i2 ALLANT_DE 2 A q-1
DEBUT_POUR
SI (q%i2==0) ALORS
DEBUT_SI
premier2 PREND_LA_VALEUR 1
FIN_SI
FIN_POUR
SI (premier2==0 ET premier==0) ALORS
DEBUT_SI
AFFICHER* "Les nombres sont premiers premier §"
AFFICHER* "On va calculer le produit p par q définit par n"
n PREND_LA_VALEUR p*q
h PREND_LA_VALEUR (p-1)*(q-1)
AFFICHER h
AFFICHER "choisir un nombre e compris dans l'intervale ]1;"
AFFICHER h
AFFICHER "["
LIRE e
AFFICHER* "On devoile publiquement e et n "
AFFICHER "e = "
AFFICHER* e
AFFICHER "n = "
AFFICHER* n
AFFICHER* "Ecrire votre mot à coder"
LIRE mot
ascii PREND_LA_VALEUR mot.charCodeAt(0)
AFFICHER "Le mot prend la valeur du tableau ascii "
AFFICHER* ascii
AFFICHER* "On va donc élever ce nombre à la puissance de e"
AFFICHER e
asciee_carré PREND_LA_VALEUR (pow(ascii, e)%n)
AFFICHER "La lettre cryptée est maintenant égal à : "
AFFICHER* asciee_carré
AFFICHER "On va donc trasmetre le message crypté au receveur"
AFFICHER* "Le receuveur du message veut maintenant déchiffrer le message "
ascie_finale PREND_LA_VALEUR 1%e
POUR i3 ALLANT_DE 0 A h
DEBUT_POUR
SI (((i3*e)%h)==1) ALORS
DEBUT_SI
AFFICHER i3
FIN_SI
FIN_POUR
FIN_SI
SINON
DEBUT_SINON
AFFICHER* "Il ya un/des nombres qui ne sont pas premiers"
FIN_SINON
FIN_ALGORITHME



 

Retourner vers ✎✎ Lycée

Qui est en ligne

Utilisateurs parcourant ce forum : Aucun utilisateur enregistré et 168 invités

Tu pars déja ?



Fais toi aider gratuitement sur Maths-forum !

Créé un compte en 1 minute et pose ta question dans le forum ;-)
Inscription gratuite

Identification

Pas encore inscrit ?

Ou identifiez-vous :

Inscription gratuite