Caractères arabes dans RSA
Mery18
Messages postés
20
Statut
Membre
-
KX Messages postés 19031 Statut Modérateur -
KX Messages postés 19031 Statut Modérateur -
Bonjour tout le monde ,
J'ai un problème avec le codage des lettres arabes dans l'algo RSA qui est le suivant :
//La procédure d'Encodage
public BigInteger[] Encodage(String Message)
{
int i;
byte[] tempan = new byte[1];
byte[] Digits = Message.getBytes();
BigInteger[] BigDigits = new BigInteger[Digits.length];
for(i=0; i<BigDigits.length;i++){
tempan[0] = Digits[i];
BigDigits[i] = new BigInteger(tempan);
}
BigInteger[] MsgeEncrypte = new BigInteger[BigDigits.length];
for(i=0; i<BigDigits.length; i++)
MsgeEncrypte[i] = BigDigits[i].modPow(e,n);
return(MsgeEncrypte);
}
//La procédure de Décodage
public String Decodage(BigInteger[] MsgeEncrypte) {
BigInteger[] MsgeDecrypte = new BigInteger[MsgeEncrypte.length];
for(int i=0; i<MsgeDecrypte.length; i++)
MsgeDecrypte[i] = MsgeEncrypte[i].modPow(d,n);
char[] charArray = new char[MsgeDecrypte.length];
for(int i=0; i<charArray.length; i++)
charArray[i] = (char) (MsgeDecrypte[i].intValue());
return(new String(charArray));
}
Le problème est qu'on j'entre dans l'interface un texte écrit en arabe (par exemple :"ايمان") il m'affiche des : ????? ,comme si il ne connais pas cet encodage.
J'ai trop cherché mais hélas j'ai pas trouvé la solution ?pouvez vous m'aider ?
J'ai un problème avec le codage des lettres arabes dans l'algo RSA qui est le suivant :
//La procédure d'Encodage
public BigInteger[] Encodage(String Message)
{
int i;
byte[] tempan = new byte[1];
byte[] Digits = Message.getBytes();
BigInteger[] BigDigits = new BigInteger[Digits.length];
for(i=0; i<BigDigits.length;i++){
tempan[0] = Digits[i];
BigDigits[i] = new BigInteger(tempan);
}
BigInteger[] MsgeEncrypte = new BigInteger[BigDigits.length];
for(i=0; i<BigDigits.length; i++)
MsgeEncrypte[i] = BigDigits[i].modPow(e,n);
return(MsgeEncrypte);
}
//La procédure de Décodage
public String Decodage(BigInteger[] MsgeEncrypte) {
BigInteger[] MsgeDecrypte = new BigInteger[MsgeEncrypte.length];
for(int i=0; i<MsgeDecrypte.length; i++)
MsgeDecrypte[i] = MsgeEncrypte[i].modPow(d,n);
char[] charArray = new char[MsgeDecrypte.length];
for(int i=0; i<charArray.length; i++)
charArray[i] = (char) (MsgeDecrypte[i].intValue());
return(new String(charArray));
}
Le problème est qu'on j'entre dans l'interface un texte écrit en arabe (par exemple :"ايمان") il m'affiche des : ????? ,comme si il ne connais pas cet encodage.
J'ai trop cherché mais hélas j'ai pas trouvé la solution ?pouvez vous m'aider ?
A voir également:
- Caractères arabes dans RSA
- Caractères spéciaux - Guide
- Caracteres speciaux - Guide
- Caractères ascii - Guide
- Caractères spéciaux mac - Guide
- Remplacez le mot sed par le mot mais dans tout le texte. combien de caractères contient le document suite à cette modification (en incluant les espaces) ? ✓ - Forum Shell
3 réponses
Peut-être est-ce juste la console qui ne supporte pas l'unicode et donc l'affichage plante, essaye d'écrire le résultat dans un fichier pour voir...