Significantly more stupid encoding than rot13
This commit is contained in:
parent
63265d5cfb
commit
74ce672841
1 changed files with 2 additions and 7 deletions
|
@ -1,14 +1,9 @@
|
|||
#include <coding.h>
|
||||
|
||||
unsigned char encode(unsigned char c) {
|
||||
if ((c >= 'A' && c <= 'Z'))
|
||||
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
|
||||
return ++c;
|
||||
}
|
||||
|
||||
unsigned char decode(unsigned char c) {
|
||||
return encode(c); // ROT13 encoding and decoding are the same
|
||||
return --c;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue