Significantly more stupid encoding than rot13

This commit is contained in:
Imbus 2024-11-12 03:05:51 +01:00
parent 63265d5cfb
commit 74ce672841

View file

@ -1,14 +1,9 @@
#include <coding.h> #include <coding.h>
unsigned char encode(unsigned char c) { unsigned char encode(unsigned char c) {
if ((c >= 'A' && c <= 'Z')) return ++c;
return ((c - 'A' + 13) % 26) + 'A';
else if ((c >= 'a' && c <= 'z'))
return ((c - 'a' + 13) % 26) + 'a';
else
return c; // Non-alphabetic characters are unchanged
} }
unsigned char decode(unsigned char c) { unsigned char decode(unsigned char c) {
return encode(c); // ROT13 encoding and decoding are the same return --c;
} }