Straddling Checkboard
Back in 2017, I sought a way to convert text into numbers. My original plan was to use this to then encode text as pictures by using those numbers as RGB values. What follows is my attempt to accomplish this
I didn’t know at the time what I was making, per se. I knew it was a cipher, but it wasn’t quite like any I had seen up to that point. It wasn’t until I posted it to 4Chan’s technology board that I learned what it was. After many discouraging “We don’t care” replies, one anon was kind enough to take interest in it, and informed me that it looked like a Straddling Checkerboard. They also told me that, due to the Straddling Checkboard’s nature, it’d be nearly impossible for them to solve without knowing the original steps.
After more research, I can see that while it’s not a Straddling Checkerboard in the strict definition, there certainly are a lot of similarities.
Plain Text
Completed output
Half-Encoded Hex output
Plain Text
Encoded
My Own Analysis
As with all of my ciphers, I have no illusion that this is cryptographically secure. That said, it does have a few things going for it.
Advantages
- Output is guaranteed different every time
- The theoretical number of possible permutations for each string is
5,600(string.length)
- In the case of the example
The quick brown fox jumps over the lazy dog
, that’s1.486*10161
possibilities! More than Googol! - Due to the second point in the disadvantages, the practical limit is much lower, though it varies from string to string.
- In the case of the example
Disadvantages
- Hex output is very limited
- Even worse, if you know how it works, you can practically read it just from the hex!!
- All letters after
O
have only one possible hex output - Output is approximately 6x longer than the input!
- Any letters that aren’t
A-Z
get replaced with a space
After Thoughts
I still really like this cipher, if not just for its large output size, and immense amount of possibilities. While rewriting it, I had hoped that I could reduce the number of the steps, and just output the hexidecimal, but the longer I worked on it, the clearer it became that this wasn’t enough. If you run the first example above a few times, you can see in the output that the second digit of each hex code doesn’t change. This is, of course, very dangerous for the cipher’s legitimacy. The complete output doesn’t have this same problem on account of the sheer number of possibilities.
Explanation
Hover, or tap, below for an explanation.
Expand for an explanation
- Convert string to uppercase
- Split the string into individual letters
- Remove any characters that aren’t A-Z
- Convert the letter to a number.
A = 1, B = 2, ... Z = 26
- If the number is less than 16
- Convert the number from decimal to hexidecimal
- Prepend it with a random hexidecimal value between
2
andf
If the number is greater than or equal to 16 - Subtract 16 from it
- Convert it to hexidecimal
- Prepend
1
to it
- Generate a number in between 10,000 and 110,000 such that
random_number % 256 == hexidecimal_value
- Once this is found for all letters in the string, output each number separated with a space.
Un-minified version of the script can be found here.