enCodeAscii static method

String enCodeAscii(
  1. String text
)

Implementation

static String enCodeAscii(String text) {
  String mensajeCifrado = '';
  for (int i = 0; i < text.length; i++) {
    int charCode = text.codeUnitAt(i);
    // Add an offset of 3 to the ASCII value of each character to encrypt
    int nuevoCharCode = (charCode + 3) % 256;
    mensajeCifrado += String.fromCharCode(nuevoCharCode);
  }
  return mensajeCifrado;
}