chatprogramm was sonst
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.

17 lines
396 B

1 year ago
  1. package server.util;
  2. public class CeasarChipher {
  3. public static byte[] encrypt(byte[] x) {
  4. for (int i = 0; i < x.length; ++i) {
  5. x[i] = (byte) ((x[i] + 3) % 256);
  6. }
  7. return x;
  8. }
  9. public static byte[] decrypt(byte[] x) {
  10. for (int i = 0; i < x.length; ++i) {
  11. x[i] = (byte) ((x[i] + 253) % 256);
  12. }
  13. return x;
  14. }
  15. }