Skip to content

JustABeginning/FlipComp

Repository files navigation

FlipComp

A Silly Cryptographic Encoding Algorithm

Concepts Involved

  • String Reversal

  • 2's Complement

    private char[] flipComp(String st) {
      char[] src = st.toCharArray();
      int l = st.length(), n = l / 2, x = l - 1;
      int b = 0x80;
      for (int i = 0; i < n; i++) {
        char c = (char) flipNibble((~src[i] + 1) ^ b);
        src[i] = (char) flipNibble((~src[x] + 1) ^ b);
        src[x] = c;
        x--;
      }
      return src;
    }
  • Flip Nibble (4-bits)

    private int flipNibble(int n) {
      return (((n & 15) << 4) | ((n >> 4) & 15));
    }

About

A Silly Cryptographic Encoding Algorithm

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages