Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Crypto RSA

1 réponse
Avatar
Nav2SouthPole
Et bien, mon message est très mal passé. Je suis taggé comme anonyme sui
vit de mon adresse IP. En plus il ne prend pas les tab d'ou mon morceau
de code VB quasi illisible pour determiner un bon couple de e/d enfin (e
,n) et (d,n). L'algo est bien clair dans mon esprit.

je ne sais pas si je 'dit mais en java nul besoin de codage. il suffit d
e caster un char en int ou double pour avoir le code ascii corespondant.




=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Article poste via Voila News - http://www.news.voila.fr
Le : Sat Apr 23 12:23:26 2005 depuis l'IP : 84.97.35.38 [VIP 772559954197]

1 réponse

Avatar
Sylvain

je ne sais pas si je 'dit mais en java nul besoin de codage. il suffit d
e caster un char en int ou double pour avoir le code ascii corespondant.



nul besoin (en Java) d'une barbage double boucle non plus, le calcul de
d s'obtient par exemple par:

BigInteger p = BigInteger.valueOf(167);
BigInteger q = BigInteger.valueOf( 23);
BigInteger n = p.multiply(q);

BigInteger one = BigInteger.valueOf(1);
BigInteger mod = p.subtract(one).multiply(q.subtract(one));

for (int i = 3; ; i += 2){
BigInteger e = BigInteger.valueOf(i);
if (e.compareTo(n) == 1)
break;
System.out.print("e = " + e.toString(10));
try {
BigInteger d = e.modInverse(mod);
System.out.println(", d = " + d.toString(10));
}
catch (ArithmeticException ae){
System.out.println(", d does not exist");
}
}

Sylvain.