Comments on Caesar shift cipher
Parent
Caesar shift cipher
Introduction
What is the Caesar shift cipher (ROT
Challenge
Make a program that takes input of a number from 1 to 25, call it
Examples of inputs and outputs:
If Lipps, asvph
.
If igdadada
.
If never gonna give you up
.
If G uylr zpcyidyqr!
.
If this text is sus
.
Shortest program wins.
[JavaScript (Node.js)], 67 60 …
4y ago
[Ruby], 56 bytes -> …
4y ago
[Python 3.8 (pre-release)], 98 …
3y ago
[C (gcc)], 112 bytes Functi …
4y ago
Javascript (V8), 202 97 bytes …
4y ago
Python 3, 86 85 bytes The r …
21d ago
[Lean 4], 183 181 bytes ``` …
28d ago
[C (clang)], 161 bytes …
4y ago
[Haskell], 74 bytes …
3y ago
Post
Javascript (V8), 202 97 bytes
o=>r=>o.replace(/[a-zA-Z]/g,o=>String.fromCharCode((o<="Z"?90:122)>=(o=o.charCodeAt()+r)?o:o-26))
Since the text of input must be manually changed from the code, here is how to change it, Go to console.log(rot("Hello World")(4));
and change text between ""
(String) into anything you want lke console.log(rot("Codidact Code Golf)(4));
and if you want to change ROTconsole.log(rot("Codidact Code Golf)(13));
.
0 comment threads