📕 Snake cipher
The snake cipher is a symmetric key algorithm made to be used with the Tobaud Code. Snake encryption keys are 25-bit natural numbers.
Encryption
- Start with the left-most character, indexed 0
XORthe character with the key's character at that index- Do this for every character
- Indices overflow
Example:
The "snake" key encrypts "hello world" into "0kmgjsynyiw"
Key generation
The snake key generator is a 5-bit Galois Linear-feedback shift register (LFSR).
0 1 2 3 4
☐→☐ →☐→☐ →☐
↑ ↓ │
└──⊕───────┘
Here is how it works:
- Pick a 5-bit seed value
- Set each bit according to the seed value you picked
- Set aside the value of bits 1 and 4
- Apply a bitwise right shift to every untapped bit (Move 0 into 1, 1 into 2, 2 into 3, and 3 into 4)
XORbits 1 and 4 and set the result as the value for bit 0- Save the result as the first part of the key
- Reuse the first part as the next seed
- Repeat this 4 times more times
- Use the last past as the seed for the next run
- Log the name of the user after each run for audit purposes
The default seed value is 11011.