You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
396 B
18 lines
396 B
package server.util;
|
|
|
|
public class CeasarChipher {
|
|
|
|
public static byte[] encrypt(byte[] x) {
|
|
for (int i = 0; i < x.length; ++i) {
|
|
x[i] = (byte) ((x[i] + 3) % 256);
|
|
}
|
|
return x;
|
|
}
|
|
|
|
public static byte[] decrypt(byte[] x) {
|
|
for (int i = 0; i < x.length; ++i) {
|
|
x[i] = (byte) ((x[i] + 253) % 256);
|
|
}
|
|
return x;
|
|
}
|
|
}
|