XOR密码,替换密码和置换密码java编码? [英] XOR cipher , Substitution cipher and permutation cipher java coding?

查看:190
本文介绍了XOR密码,替换密码和置换密码java编码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请有人可以帮我组合XOR密码,替换密码和置换密码java编码吗?我已经做了编码,但得到了一些错误..任何人都可以帮我解决错误



import java。 util。*;



class question1 {



private final static String ALPHABET =abcdefghijklmnopqrstuvwxyz;

public static void main(String args [])

{



Scanner in = new Scanner(System。在); //定义扫描仪输入

String messageString;



System.out.println(请输入明文:);

messageString = in.nextLine(); //读一行

String cipherText =;

int shft = 5;

for(int i = 0; i< messagestring .length(); i ++)>

{

int charPosition = ALPHABET.indexOf(messageString.charAt(i));

int keyVal =(shft + charPosition)%26;

char replaceVal = this.ALPHABET.charAt(keyVal);

cipherText + = replaceVal;



}

int xor;

char temp;

for(int i = 0; i< messageString.length(); i ++){

xor = messageString.charAt(i)^ shft;

temp =(char)xor;

cipherText = cipherText + temp;

}

for(int i = 0; i< messagestring.length(); i ++)>

{

cipherText = messageString.length()^ [shft [i] -1];

}

}

}

Please anyone can help me the combine of XOR cipher , Substitution cipher and permutation cipher java coding? i already do to the coding but got some error..can anyone help me solve the error

import java. util.*;

class question1{

private final static String ALPHABET = "abcdefghijklmnopqrstuvwxyz";
public static void main (String args[])
{

Scanner in = new Scanner(System.in); //define scanner for input
String messageString;

System.out.println("Please enter the plaintext:");
messageString=in.nextLine(); //read a line
String cipherText ="";
int shft = 5;
for(int i=0;i<messagestring.length();i++)>
{
int charPosition = ALPHABET.indexOf(messageString.charAt(i));
int keyVal = (shft+charPosition)%26;
char replaceVal = this.ALPHABET.charAt(keyVal);
cipherText += replaceVal;

}
int xor;
char temp;
for(int i = 0 ; i < messageString.length() ; i++){
xor = messageString.charAt(i) ^ shft;
temp = (char)xor;
cipherText = cipherText+ temp;
}
for(int i=0;i<messagestring.length();i++)>
{
cipherText = messageString.length()^[shft[i] -1];
}
}
}

推荐答案

要合并(无论你的意思是什么),你必须先掌握它们的三种方法。这应该不难,毕竟那些是cassic,简单的。

然后你必须实现你的算法,所以需要熟悉java编程语言。

一旦您满足上述先决条件,就可以开始编码并随时在这里询问具体的问题。
To ''combine'' (whatever you mean with such a term) the three methods you have to first master them. That should not be difficult, after all those are ''cassic'', simple ones.
Then you have to implement your algorithm, so a good knowledge of the java programming language is required.
Once you have satisfied the above prerequisites, start coding and feel free to ask here specific questions.


这篇关于XOR密码,替换密码和置换密码java编码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆