Share your repls and programming experiences

← Back to all posts
Rotational 13 cipher
h
CodeLongAndPros (1593)

The rotational 13 cipher (ROT13) is a keyless shifting cipher.
It takes series of letters and shifts them forward or back by a certain number.
Rot13 is keyless, i.e. if you know it's in rot13, you can decode it.

So let's take the char a.
Under rot13:

rot13(a) -> n

and if we take n:
rot13(n) ->a

rot13(i use arch btw) -> v hfr nepu ogj
and to reverse it:
rot13(v hfr nepu ogj) -> i use arch btw

So rot13(rot13(x)) should equal x.

Now, using rot13 in the command line.

Use ./main to invoke it.
You can provide three options:

  • -s sets the shift (default 13, in the future it'll use 1/2 of the alphabet). use -s 3 for the ceaser cipher.

  • -r decodes a non-rot13 encoded text (rot3(rot3(x))!=x)

  • -alphabet sets the alphabet. To encode numbers use abcdefghijklmnopqrstuvwxyz0123456789.

You can also pass a filename.
If you don't, after you type in your text, press Ctrl+d.

And ofc, there's this:

cyrnfr znex guvf nf gur nafjre vs vg urycrq

Comments
hotnewtop
firefish (914)

haha tr "A-Za-z" "N-ZA-Mn-za-m"

programmeruser (571)

v nz gur qbpgbe. eha! = i am the doctor. run!

DynamicSquid (4622)

Time to Go!

You don't see a lot of Go project on here, neat!

CodeLongAndPros (1593)

@DynamicSquid Yeah, just gotta figure out why go does these stupid things like not read a file as runes....