其他分享
首页 > 其他分享> > ^的简单数据加密

^的简单数据加密

作者:互联网

String content="犹如滔滔江水连绵不绝";
String key="?+vM8s84mH@/";

byte[] contArray = content.getBytes();
int length = contArray.length;
byte[] keyArray = key.getBytes();
byte[] resultArray = new byte[length];

for (int i = 0; i < length; i++) {
for (byte b : keyArray) {
contArray[i]^=b;
}
resultArray[i]=contArray[i];
}

System.out.println(new String(resultArray));//Ũ�DŽ�ę�ę�ē�Ē�ʝ�ř�ƚ�ř�

contArray = new byte[length];
for (int i = 0; i < length; i++) {
for (byte b : keyArray) {
resultArray[i]^=b;
}
contArray[i]=resultArray[i];
}
System.out.println(new String(contArray));//犹如滔滔江水连绵不绝

标签:加密,String,resultArray,length,contArray,简单,new,byte,数据
来源: https://www.cnblogs.com/0101m/p/14368846.html