The columnar cipher cannot roundtrip plaintext ending in whitespace because both encodeColumnar() and decodeColumnar() call trimEnd(). Legitimate trailing spaces and newlines get treated like padding and disappear.
This showed up while checking transposition roundtrips with non-letter input. For example, encoding and then decoding "A ", "A ", or "A\n" with key KEY returns "A" in every case. The library defaults stripNonAlpha to false, so silently losing those characters is pretty surprising. Padding should be removed without trimming user content, with regression cases for trailing spaces and a trailing newline.
The columnar cipher cannot roundtrip plaintext ending in whitespace because both
encodeColumnar()anddecodeColumnar()calltrimEnd(). Legitimate trailing spaces and newlines get treated like padding and disappear.This showed up while checking transposition roundtrips with non-letter input. For example, encoding and then decoding
"A ","A ", or"A\n"with keyKEYreturns"A"in every case. The library defaultsstripNonAlphatofalse, so silently losing those characters is pretty surprising. Padding should be removed without trimming user content, with regression cases for trailing spaces and a trailing newline.