Answer the question
In order to leave comments, you need to log in
How to encode a phrase by aes 256 in java?
How to encode a phrase using aes?
Below is my code
import java.util.Scanner;
public class encrypt {
public static void main (String[] args){
Scanner e = new Scanner(System.in);
String str = e.nextLine();
String key = e.nextLine();
byte[] encrypt1 = str.getBytes();
byte[] encrypt2 = key.getBytes();
byte[] result = new byte[str.length()];
for (int i = 0; i < encrypt1.length; i++) {
result[i] = (byte) (encrypt1[i] ^ encrypt2[i % encrypt2.length]);
System.out.println(result);
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question