extractCipherWithoutKey static method

dynamic extractCipherWithoutKey(
  1. String cipherText
)

Implementation

static extractCipherWithoutKey(String cipherText) {
  String newCipherText = "";
  if ((cipherText.length - 6) > 4) {
    // Get first 2 digits
    newCipherText = cipherText.replaceRange(0, 2, "");

    // Get Last tow digits
    newCipherText = newCipherText.replaceRange(
        newCipherText.length - 2, newCipherText.length, "");

    // Get the middle digits
    int startIndex = (newCipherText.length ~/ 2) - 1;
    int endIndex = (newCipherText.length ~/ 2) + 1;

    newCipherText = newCipherText.substring(0, startIndex) +
        "" +
        newCipherText.substring(endIndex);

    return newCipherText;
  } else {
    newCipherText = cipherText.replaceRange(0, 3, "");
    newCipherText =
        newCipherText.replaceRange(newCipherText.length - 3, null, "");
    return newCipherText;
  }
}