Caesar cipher: Difference between revisions

18,752 bytes added ,  15 days ago
m (Automated syntax highlighting fixup (second round - minor fixes))
 
(32 intermediate revisions by 23 users not shown)
Line 118:
THE FIVE BOXING WIZARDS JUMP QUICKLY
</pre>
=={{header|AArch64 Assembly}}==
{{works with|as|Raspberry Pi 3B version Buster 64 bits <br> or android 64 bits with application Termux }}
<syntaxhighlight lang AArch64 Assembly>
/* ARM assembly AARCH64 Raspberry PI 3B */
/* program caresarcode64.s */
/************************************/
/* Constantes */
/************************************/
/* for this file see task include a file in language AArch64 assembly*/
.include "../includeConstantesARM64.inc"
.equ KEY, 23
.equ STRINGSIZE, 500
/************************************/
/* Initialized data */
/************************************/
.data
szMessString: .asciz "String :\n"
szMessEncrip: .asciz "\nEncrypted :\n"
szMessDecrip: .asciz "\nDecrypted :\n"
szString1: .asciz "The quick brown fox jumps over the lazy dog."
 
szCarriageReturn: .asciz "\n"
/************************************/
/* UnInitialized data */
/************************************/
.bss
szString2: .skip STRINGSIZE
szString3: .skip STRINGSIZE
/************************************/
/* code section */
/************************************/
.text
.global main
main:
ldr x0,qAdrszMessString // display message
bl affichageMess
ldr x0,qAdrszString1 // display string
bl affichageMess
ldr x0,qAdrszString1
ldr x1,qAdrszString2
mov x2,#KEY // key
bl encrypt
ldr x0,qAdrszMessEncrip
bl affichageMess
ldr x0,qAdrszString2 // display string
bl affichageMess
ldr x0,qAdrszString2
ldr x1,qAdrszString3
mov x2,#KEY // key
bl decrypt
ldr x0,qAdrszMessDecrip
bl affichageMess
ldr x0,qAdrszString3 // display string
bl affichageMess
ldr x0,qAdrszCarriageReturn
bl affichageMess
100: // standard end of the program
mov x0, #0 // return code
mov x8,EXIT
svc 0 // perform system call
qAdrszMessString: .quad szMessString
qAdrszMessDecrip: .quad szMessDecrip
qAdrszMessEncrip: .quad szMessEncrip
qAdrszString1: .quad szString1
qAdrszString2: .quad szString2
qAdrszString3: .quad szString3
qAdrszCarriageReturn: .quad szCarriageReturn
/******************************************************************/
/* encrypt strings */
/******************************************************************/
/* x0 contains the address of the string1 */
/* x1 contains the address of the encrypted string */
/* x2 contains the key (1-25) */
encrypt:
stp x3,lr,[sp,-16]! // save registers
stp x4,x5,[sp,-16]! // save registers
mov x3,#0 // counter byte string 1
1:
ldrb w4,[x0,x3] // load byte string 1
cmp w4,#0 // zero final ?
bne 2f
strb w4,[x1,x3]
mov x0,x3
b 100f
2:
cmp w4,#65 // < A ?
bge 3f
strb w4,[x1,x3]
add x3,x3,#1
b 1b // and loop
3:
cmp x4,#90 // > Z
bgt 4f
add x4,x4,x2 // add key
cmp x4,#90 // > Z
sub x5,x4,26
csel x4,x5,x4,gt
//subgt x4,#26
strb w4,[x1,x3]
add x3,x3,#1
b 1b
4:
cmp x4,#97 // < a ?
bge 5f
strb w4,[x1,x3]
add x3,x3,#1
b 1b
5:
cmp x4,#122 //> z
ble 6f
strb w4,[x1,x3]
add x3,x3,#1
b 1b
6:
add x4,x4,x2
cmp x4,#122
sub x5,x4,26
csel x4,x5,x4,gt
//subgt x4,#26
strb w4,[x1,x3]
add x3,x3,#1
b 1b
 
100:
ldp x4,x5,[sp],16 // restaur registers
ldp x3,lr,[sp],16 // restaur registers
ret
/******************************************************************/
/* decrypt strings */
/******************************************************************/
/* x0 contains the address of the encrypted string1 */
/* x1 contains the address of the decrypted string */
/* x2 contains the key (1-25) */
decrypt:
stp x3,lr,[sp,-16]! // save registers
stp x4,x5,[sp,-16]! // save registers
mov x3,#0 // counter byte string 1
1:
ldrb w4,[x0,x3] // load byte string 1
cmp x4,#0 // zero final ?
bne 2f
strb w4,[x1,x3]
mov x0,x3
b 100f
2:
cmp x4,#65 // < A ?
bge 3f
strb w4,[x1,x3]
add x3,x3,#1
b 1b // and loop
3:
cmp x4,#90 // > Z
bgt 4f
sub x4,x4,x2 // substract key
cmp x4,#65 // < A
add x5,x4,26
csel x4,x5,x4,lt
//addlt x4,#26
strb w4,[x1,x3]
add x3,x3,#1
b 1b
4:
cmp x4,#97 // < a ?
bge 5f
strb w4,[x1,x3]
add x3,x3,#1
b 1b
5:
cmp x4,#122 // > z
ble 6f
strb w4,[x1,x3]
add x3,x3,#1
b 1b
6:
sub x4,x4,x2 // substract key
cmp x4,#97 // < a
add x5,x4,26
csel x4,x5,x4,lt
//addlt x4,#26
strb w4,[x1,x3]
add x3,x3,#1
b 1b
 
100:
ldp x4,x5,[sp],16 // restaur registers
ldp x3,lr,[sp],16 // restaur registers
ret
/***************************************************/
/* ROUTINES INCLUDE */
/***************************************************/
.include "../includeARM64.inc"
 
</syntaxhighlight>
{{Out}}
<pre>
String :
The quick brown fox jumps over the lazy dog.
Encrypted :
Qeb nrfzh yoltk clu grjmp lsbo qeb ixwv ald.
Decrypted :
The quick brown fox jumps over the lazy dog.
</pre>
 
=={{header|Action!}}==
<syntaxhighlight lang="action!">CHAR FUNC Shift(CHAR c BYTE code)
Line 180 ⟶ 383:
</pre>
=={{header|Ada}}==
<syntaxhighlight lang="ada">with-- Caesar Cipher Implementation in Ada.Text_IO;
 
with Ada.Text_IO; use Ada.Text_IO;
 
procedure Caesar is
 
-- Base function to encrypt a character
type modulo26 is modulo 26;
function Cipher(Char_To_Encrypt: Character; Shift: Integer; Base: Character) return Character is
 
function modulo26 (Character Base_Pos : Character;constant Natural Output:= Character'Pos(Base) return modulo26 is;
begin
return modulo26 (Character'PosVal((Character)+Character'Pos(OutputChar_To_Encrypt) + Shift - Base_Pos) mod 26 + Base_Pos);
end modulo26Cipher;
 
-- Function to encrypt a character
function Character(Val: in modulo26; Output: Character)
function Encrypt_Char(Char_To_Encrypt: Character; Shift: Integer) return Character is
begin
case Char_To_Encrypt is
return Character'Val(Integer(Val)+Character'Pos(Output));
when 'A'..'Z' =>
end Character;
-- Encrypt uppercase letters
 
return Cipher (Char_To_Encrypt, Shift, 'A');
function crypt (Playn: String; Key: modulo26) return String is
Ciph: String(Playn when 'Range);a'..'z' =>
-- Encrypt lowercase letters
return Cipher (Char_To_Encrypt, Shift, 'a');
when others =>
-- Leave other characters unchanged
return Char_To_Encrypt;
end case;
end Encrypt_Char;
 
-- Function to decrypt a character
function Decrypt_Char(Char_To_Decrypt: Character; Shift: Integer) return Character is
begin
return Encrypt_Char(Char_To_Decrypt, -Shift);
for I in Playn'Range loop
end Decrypt_Char;
case Playn(I) is
when 'A' .. 'Z' =>
Ciph(I) := Character(modulo26(Playn(I)+Key), 'A');
when 'a' .. 'z' =>
Ciph(I) := Character(modulo26(Playn(I)+Key), 'a');
when others =>
Ciph(I) := Playn(I);
end case;
end loop;
return Ciph;
end crypt;
 
TextMessage: constant String := Ada.Text_IO.Get_Line;
KeyShift: modulo26Positive := 3; -- Default key from "Commentarii de Bello Gallico" shift cipher
-- Shift value (can be any positive integer)
 
Encrypted_Message: String(Message'Range);
begin -- encryption main program
Decrypted_Message: String(Message'Range);
begin
-- Encrypt the message
for I in Message'Range loop
Encrypted_Message(I) := Encrypt_Char(Message(I), Shift);
end loop;
 
-- Decrypt the encrypted message
Ada.Text_IO.Put_Line("Playn ------------>" & Text);
for I in Message'Range loop
Text := crypt(Text, Key);
Decrypted_Message(I) := Decrypt_Char(Encrypted_Message(I), Shift);
Ada.Text_IO.Put_Line("Ciphertext ----------->" & Text);
end loop;
Ada.Text_IO.Put_Line("Decrypted Ciphertext ->" & crypt(Text, -Key));
 
-- Display results
end Caesar;</syntaxhighlight>
Put_Line("Plaintext: " & Message);
Put_Line("Ciphertext: " & Encrypted_Message);
Put_Line("Decrypted Ciphertext: " & Decrypted_Message);
 
end Caesar;
</syntaxhighlight>
{{out}}
<pre>> ./caesar
The five boxing wizards jump quickly
Plaintext: ------------>The five boxing wizards jump quickly
Ciphertext: ----------->Wkh ilyh eralqj zlcdugv mxps txlfnob
Decrypted Ciphertext: ->The five boxing wizards jump quickly</pre>
</pre>
 
=={{header|ALGOL 68}}==
{{trans|Ada|Note: This specimen retains the original [[#Ada|Ada]] coding style.}}
Line 510 ⟶ 729:
iAdrszString1: .int szString1
iAdrszString2: .int szString2
iAdrszString3: .int szString2szString3
iAdrszCarriageReturn: .int szCarriageReturn
/******************************************************************/
Line 923 ⟶ 1,142:
 
</syntaxhighlight>
{{in}}
 
<pre>
{{out}} (input: caesar_cipher -e 13 "Hello World!"):
caesar_cipher -e 13 "Hello World!"
</pre>
{{out}}
<pre>
Uryyb Jbeyq!
</pre>
 
{{in}}
{{out}} (input: caesar_cipher -d 13 "Uryyb Jbeyq!"):
<pre>
caesar_cipher -d 13 "Uryyb Jbeyq!"
</pre>
{{out}}
<pre>
Hello World!
</pre>
 
=={{header|BASIC256}}==
=={{header|BASIC}}==
==={{header|BASIC256}}===
<syntaxhighlight lang="text">
# Caeser Cipher
Line 976 ⟶ 1,204:
MY HOVERCRAFT IS FULL OF EELS.
</pre>
 
=={{header|BBC BASIC}}==
==={{header|BBC BASIC}}===
<syntaxhighlight lang="bbcbasic"> plaintext$ = "Pack my box with five dozen liquor jugs"
PRINT plaintext$
Line 1,004 ⟶ 1,233:
Zkmu wi lyh gsdr psfo nyjox vsaeyb teqc
Pack my box with five dozen liquor jugs</pre>
 
==={{header|Chipmunk Basic}}===
{{works with|Chipmunk Basic|3.6.4}}
{{works with|QBasic}}
{{trans|BASIC256}}
<syntaxhighlight lang="qbasic">
10 rem Caesar cipher
20 cls
30 dec$ = ""
40 type$ = "cleartext "
50 print "If decrypting enter "+"<d> "+" -- else press enter "; : input dec$
60 input "Enter offset > ",ioffset
70 if dec$ = "d" then
80 ioffset = 26-ioffset
90 type$ = "ciphertext "
100 endif
110 print "Enter "+type$+"> ";
120 input cad$
130 cad$ = ucase$(cad$)
140 longitud = len(cad$)
150 for i = 1 to longitud
160 itemp = asc(mid$(cad$,i,1))
170 if itemp > 64 and itemp < 91 then
180 itemp = ((itemp-65)+ioffset) mod 26
190 print chr$(itemp+65);
200 else
210 print chr$(itemp);
220 endif
230 next i
240 print
250 end
</syntaxhighlight>
{{out}}
<pre> >run
If decrypting enter <d> -- else press enter ?
Enter offset > 21
Enter cleartext > ? My hovercraft is full of eels.
HT CJQZMXMVAO DN APGG JA ZZGN.
>run
If decrypting enter <d> -- else press enter ? d
Enter offset > 21
Enter ciphertext > ? HT CJQZMXMVAO DN APGG JA ZZGN.
MY HOVERCRAFT IS FULL OF EELS.</pre>
 
==={{header|GW-BASIC}}===
{{works with|Chipmunk Basic}}
{{works with|PC-BASIC|any}}
{{works with|QBasic}}
{{works with|MSX BASIC}}
{{trans|Chipmunk Basic}}
<syntaxhighlight lang="qbasic">10 REM Caesar cipher
20 CLS
30 DEC$ = ""
40 TYPE$ = "cleartext "
50 PRINT "If decrypting enter "+"<d> "+" -- else press enter "; : INPUT DEC$
60 INPUT "Enter offset > "; IOFFSET
70 IF DEC$ = "d" THEN IOFFSET = 26-IOFFSET: TYPE$ = "ciphertext "
110 PRINT "Enter "+TYPE$+"> ";
120 INPUT CAD$
140 LONGITUD = LEN(CAD$)
150 FOR I = 1 TO LONGITUD
160 ITEMP = ASC(MID$(CAD$,I,1))
170 IF ITEMP > 64 AND ITEMP < 91 THEN ITEMP = ((ITEMP-65)+IOFFSET) MOD 26 : PRINT CHR$(ITEMP+65); : ELSE PRINT CHR$(ITEMP);
230 NEXT I
240 PRINT
250 END</syntaxhighlight>
 
==={{header|MSX Basic}}===
{{works with|MSX BASIC|any}}
The [[#GW-BASIC|GW-BASIC]] solution works without any changes.
 
=={{header|Beads}}==
<syntaxhighlight lang="beads">beads 1 program 'Caesar cipher'
Line 1,579 ⟶ 1,879:
=> "The Quick Brown Fox jumped over the lazy dog"
</pre>
 
Fast version, using str/escape:
<syntaxhighlight lang="clojure">(defn fast-caesar [n s]
(let [m (mod n 26)
upper (map char (range 65 91))
upper->new (zipmap upper (drop m (cycle upper)))
lower (map char (range 97 123))
lower->new (zipmap lower (drop m (cycle lower)))]
(clojure.string/escape s (merge upper->new lower->new))))</syntaxhighlight>
output:<pre>
(fast-caesar 12 "The Quick Brown Fox jumped over the lazy dog")
=> "Ftq Cguow Ndaiz Raj vgybqp ahqd ftq xmlk pas"
</pre>
 
=={{header|COBOL}}==
[[COBOL-85]] ASCII or EBCIDIC
<syntaxhighlight lang="cobol"> IDENTIFICATION DIVISION.
identificationPROGRAM-ID. divisionCAESAR.
program-id. caesar.
data division.
1 msg pic x(50)
value "The quick brown fox jumped over the lazy dog.".
1 offset binary pic 9(4) value 7.
1 from-chars pic x(52).
1 to-chars pic x(52).
1 tabl.
2 pic x(26) value "abcdefghijklmnopqrstuvwxyz".
2 pic x(26) value "ABCDEFGHIJKLMNOPQRSTUVWXYZ".
2 pic x(26) value "abcdefghijklmnopqrstuvwxyz".
2 pic x(26) value "ABCDEFGHIJKLMNOPQRSTUVWXYZ".
procedure division.
begin.
display msg
perform encrypt
display msg
perform decrypt
display msg
stop run
.
 
encryptDATA DIVISION.
WORKING-STORAGE SECTION.
move tabl (1:52) to from-chars
01 MSG move tabl (1 + offset:52) to to-charsPIC X(50)
VALUE "The quick brown fox jumped over the lazy dog.".
inspect msg converting from-chars
01 OFFSET PIC to9(4) to-charsVALUE 7 USAGE BINARY.
01 FROM-CHARS PIC X(52).
01 TO-CHARS PIC X(52).
01 TABL.
02 PIC X(26) VALUE "abcdefghijklmnopqrstuvwxyz".
02 PIC X(26) VALUE "ABCDEFGHIJKLMNOPQRSTUVWXYZ".
02 PIC X(26) VALUE "abcdefghijklmnopqrstuvwxyz".
02 PIC X(26) VALUE "ABCDEFGHIJKLMNOPQRSTUVWXYZ".
 
decryptPROCEDURE DIVISION.
BEGIN.
move tabl (1 + offset:52) to from-chars
moveDISPLAY tabl (1:52) to to-charsMSG
inspectPERFORM msg converting from-charsENCRYPT
DISPLAY to to-charsMSG
.PERFORM DECRYPT
end program caesar. DISPLAY MSG
STOP RUN.
</syntaxhighlight>
 
ENCRYPT.
MOVE TABL (1:52) TO FROM-CHARS
MOVE TABL (1 + OFFSET:52) TO TO-CHARS
INSPECT MSG CONVERTING FROM-CHARS TO TO-CHARS.
 
DECRYPT.
MOVE TABL (1 + OFFSET:52) TO FROM-CHARS
MOVE TABL (1:52) TO TO-CHARS
INSPECT MSG CONVERTING FROM-CHARS TO TO-CHARS.
 
END PROGRAM CAESAR.</syntaxhighlight>
{{out}}
<pre>
Line 1,627 ⟶ 1,938:
</pre>
 
{{works with|OpenCOBOL|2.0COBOL 2002}}
<syntaxhighlight lang="cobolcobolfree"> >>SOURCE FORMAT IS FREE
IDENTIFICATION DIVISION.
PROGRAM-ID. caesar-cipher.
 
Line 1,635 ⟶ 1,947:
REPOSITORY.
FUNCTION encrypt
FUNCTION decrypt.
 
.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 plaintext PIC X(50).
01 offset PICUSAGE 99BINARY-CHAR.
 
01 encrypted-str PIC X(50).
 
PROCEDURE DIVISION.
DISPLAY "Enter a message to encrypt: " WITH NO ADVANCING
ACCEPT plaintext
DISPLAY "Enter the amount to shift by: " WITH NO ADVANCING
ACCEPT offset
MOVE encrypt(offset, plaintext) TO encrypted-str
DISPLAY "Encrypted: " encrypted-str
DISPLAY "Decrypted: " decrypt(offset, encrypted-str).
 
MOVE FUNCTION encrypt(offset, plaintext) TO encrypted-str
DISPLAY "Encrypted: " encrypted-str
DISPLAY "Decrypted: " FUNCTION decrypt(offset, encrypted-str)
.
END PROGRAM caesar-cipher.
 
IDENTIFICATION DIVISION.
 
FUNCTION-ID. encrypt.
 
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
REPOSITORY.
FUNCTION ALL INTRINSIC.
 
DATA DIVISION.
LOCAL-STORAGE SECTION.
01 i PICUSAGE 9(3)INDEX.
01 a USAGE BINARY-CHAR.
 
01 a PIC 9(3).
 
LINKAGE SECTION.
01 offset PICUSAGE 99BINARY-CHAR.
01 str PIC X(50).
 
01 encrypted-str PIC X(50).
 
PROCEDURE DIVISION USING offset, str RETURNING encrypted-str.
PERFORM VARYING i FROM 1 BY 1 UNTIL i > LENGTH(str)
MOVE str TO encrypted-str
PERFORM VARYING i FROM 1 BYIF str(i:1) UNTILIS iNOT >ALPHABETIC FUNCTIONOR LENGTH(str(i:1) = SPACE
IF encrypted- MOVE str (i:1) IS NOT ALPHABETIC ORTO encrypted-str (i:1) = SPACE
EXIT PERFORM CYCLE
END-IF
IF str(i:1) IS ALPHABETIC-UPPER
 
IF encrypted-str MOVE ORD(i:1"A") ISTO ALPHABETIC-UPPERa
MOVE FUNCTION ORD("A") TO a
ELSE
MOVE FUNCTION ORD("a") TO a
END-IF
MOVE CHAR(MOD(ORD(str(i:1)) - a + offset, 26) + a)
 
MOVE FUNCTION CHAR(FUNCTION MOD(FUNCTION ORD(TO encrypted-str (i:1))
- a + offset, 26) + a)
TO encrypted-str (i:1)
END-PERFORM
EXIT FUNCTION.
END FUNCTION encrypt.
 
END FUNCTION encrypt.
 
IDENTIFICATION DIVISION.
FUNCTION-ID. decrypt.
 
Line 1,697 ⟶ 2,007:
CONFIGURATION SECTION.
REPOSITORY.
FUNCTION encrypt.
 
.
DATA DIVISION.
LOCAL-STORAGE SECTION.
01 decrypt-offset PICUSAGE 99BINARY-CHAR.
 
LINKAGE SECTION.
01 offset PICUSAGE 99BINARY-CHAR.
01 str PIC X(50).
 
01 decrypted-str PIC X(50).
 
PROCEDURE DIVISION USING offset, str RETURNING decrypted-str.
SUBTRACT 26offset FROM offset26 GIVING decrypt-offset
MOVE FUNCTION encrypt(decrypt-offset, str) TO decrypted-str
EXIT FUNCTION.
 
END FUNCTION decrypt.</syntaxhighlight>
 
Line 1,722 ⟶ 2,031:
Decrypted: The quick brown fox jumps over the lazy dog.
</pre>
 
=={{header|CoffeeScript}}==
<syntaxhighlight lang="coffeescript">cipher = (msg, rot) ->
Line 2,147 ⟶ 2,457:
Encrypted: Ufhp rd gtc bnym knaj itejs qnvztw ozlx.
Decrypted: Pack my box with five dozen liquor jugs.</pre>
=={{header|EasyLang}}==
<syntaxhighlight>
func$ crypt str$ key .
for c$ in strchars str$
c = strcode c$
if c >= 65 and c <= 90
c = (c + key - 65) mod 26 + 65
elif c >= 97 and c <= 122
c = (c + key - 97) mod 26 + 97
.
enc$ &= strchar c
.
return enc$
.
enc$ = crypt "Rosetta Code" 4
print enc$
print crypt enc$ -4
</syntaxhighlight>
 
=={{header|EDSAC order code}}==
The EDSAC had only upper-case letters, which were represented by 5-bit codes.
Line 2,389 ⟶ 2,718:
ENTER MESSAGE
</pre>
 
=={{header|Eiffel}}==
<syntaxhighlight lang="eiffel">
Line 2,489 ⟶ 2,819:
Decoded string: "HELLO! THIS IS A SECRET MESSAGE!"</pre>
=={{header|Elena}}==
ELENA 46.x :
<syntaxhighlight lang="elena">import system'routines;
import system'math;
Line 2,502 ⟶ 2,832:
class Encrypting : Enumerator
{
int theKey_key;
Enumerator theEnumerator_enumerator;
constructor(int key, string text)
{
theKey_key := key;
theEnumerator_enumerator := text.enumerator();
}
bool next() => theEnumerator_enumerator;
reset() => theEnumerator_enumerator;
enumerable() => theEnumerator_enumerator;
get Value()
{
var ch := theEnumerator.get()*_enumerator;
var index := Letters.indexOf(0, ch);
Line 2,525 ⟶ 2,855:
if (-1 < index)
{
^ Letters[(theKey_key+index).mod:(26)]
}
else
Line 2,532 ⟶ 2,862:
if (-1 < index)
{
^ BigLetters[(theKey_key+index).mod:(26)]
}
else
Line 2,555 ⟶ 2,885:
console.printLine("Original text :",TestText);
var encryptedText := TestText.encrypt:(Key);
 
console.printLine("Encrypted text:",encryptedText);
 
var decryptedText := encryptedText.decrypt:(Key);
 
console.printLine("Decrypted text:",decryptedText);
Line 2,571 ⟶ 2,901:
Decrypted text:Pack my box with five dozen liquor jugs.
</pre>
 
=={{header|Elixir}}==
<syntaxhighlight lang="elixir">defmodule Caesar_cipher do
Line 2,597 ⟶ 2,928:
Decrypted: The five boxing wizards jump quickly
</pre>
=={{header|Elm}}==
<syntaxhighlight lang="elm">
=={{header|Erlang}}==
<syntaxhighlight lang="erlang">
module Main exposing (main)
 
import Browser
import Html exposing (Html, h2, div, p, input, button, text, textarea)
import Html.Attributes exposing (style, class, placeholder, value)
import Html.Events exposing (onInput, onClick)
 
 
-- MAIN
 
main =
Browser.sandbox { init = init, update = update, view = view }
 
 
-- MODEL
 
type alias Model =
{ codeKey : Int
, normtext : String
}
 
 
init : Model
init =
{ codeKey = 3
, normtext = "" }
 
 
-- UPDATE
 
type Msg
= Change String
| DecKey
| IncKey
 
 
update : Msg -> Model -> Model
update msg model =
case msg of
DecKey ->
{ model | codeKey = model.codeKey - 1}
IncKey ->
{ model | codeKey = model.codeKey + 1}
Change newContent ->
{ model | normtext = String.toUpper newContent }
 
 
 
encodeChar : Int -> Char -> Char
encodeChar codeKey character =
if Char.isUpper character then
Char.fromCode (modBy 26 (Char.toCode character - 65 + codeKey) + 65)
 
else if Char.isLower character then
Char.fromCode (modBy 26 (Char.toCode (Char.toUpper character) - 65 + codeKey) + 65)
 
else
character
 
 
encodeText : Int -> String -> String
encodeText codeKey normtext =
String.map (encodeChar codeKey) normtext
 
 
subheads aKey =
if aKey > 0 then "Original"
else if aKey < 0 then "Encrypted text"
else "?"
 
-- VIEW
 
view : Model -> Html Msg
view model =
div []
[ div []
[h2 [class "h2style"] [text (subheads model.codeKey)]
, textarea [ class "textframe", placeholder "Write here your text!"
, value model.normtext, onInput Change ] []
]
, div []
[h2 [class "h2style"] [text (subheads (negate model.codeKey))]
, textarea [ class "textframe", value (encodeText model.codeKey model.normtext) ] []]
, div [class "keystyle"] [ button [ class "butstyle", onClick DecKey ] [ text "-1" ]
, text (" Key " ++ String.fromInt model.codeKey)
, button [ class "butstyle", onClick IncKey ] [ text "+1" ]
]
]
 
</syntaxhighlight>
 
{{out}}
<pre>
Original: THE QUICK ORANGE FOX JUMPED OVER THE SLOW DOG
Encrypted: WKH TXLFN RUDQJH IRA MXPSHG RYHU WKH VORZ GRJ (used key value 3)
Encrypted: XLI UYMGO SVERKI JSB NYQTIH SZIV XLI WPSA HSK (used key value 4)
Decrypted: THE QUICK ORANGE FOX JUMPED OVER THE SLOW DOG (used key value -3)
Decrypted: THE QUICK ORANGE FOX JUMPED OVER THE SLOW DOG (used key value -4)
 
Live version with html file calling the elm module as compiled to JavaScript
at https://ellie-app.com/qVvVDKdK6PQa1
</pre>
%% Ceasar cypher in Erlang for the rosetta code wiki.
%% Implemented by J.W. Luiten
Line 2,916 ⟶ 3,351:
</syntaxhighlight>
=={{header|Forth}}==
<syntaxhighlight lang="forth">: ceasarcaesar ( c n -- c )
over 32 or [char] a -
dup 0 26 within if
Line 2,922 ⟶ 3,357:
else 2drop then ;
 
: ceasarcaesar-string ( n str len -- )
over + swap do i c@ over ceasarcaesar i c! loop drop ;
: ceasarcaesar-inverse ( n -- 'n ) 26 swap - 26 mod ;
 
2variable test
s" The five boxing wizards jump quickly!" test 2!
 
3 test 2@ ceasarcaesar-string
test 2@ cr type
 
3 ceasarcaesar-inverse test 2@ ceasarcaesar-string
test 2@ cr type</syntaxhighlight>
 
=={{header|Fortran}}==
{{works with|Fortan 90 and later}}
Line 3,443 ⟶ 3,879:
Encphered text = "wkh txlfn eurzq ira mxpshg ryhu wkh odcb grj"
Decphered text = "the quick brown fox jumped over the lazy dog"</pre>
 
=={{Header|Insitux}}==
 
<syntaxhighlight lang="insitux">
(function caeser by of
(let alphabets (proj (map char-code) (range 65 91) (range 97 123))
shifted (.. vec (map (rotate by) alphabets))
table (kv-dict (flatten alphabets) (flatten shifted)))
(... str (map #(or (table %) %) of)))
 
(let original "The Quick Brown Fox Jumps Over The Lazy Dog."
encrypted (caeser -1 original)
decrypted (caeser 1 encrypted))
(str "Original: " original "
Encrypted: " encrypted "
Decrypted: " decrypted)
</syntaxhighlight>
 
{{out}}
 
<pre>
Original: The Quick Brown Fox Jumps Over The Lazy Dog.
Encrypted: Sgd Pthbj Aqnvm Enw Itlor Nudq Sgd Kzyx Cnf.
Decrypted: The Quick Brown Fox Jumps Over The Lazy Dog.
</pre>
 
=={{header|IS-BASIC}}==
<syntaxhighlight lang="is-basic">100 PROGRAM "CaesarCi.bas"
Line 3,577 ⟶ 4,039:
<syntaxhighlight lang="javascript">function caesar (text, shift) {
return text.toUpperCase().replace(/[^A-Z]/g,'').replace(/./g, function(a) {
return String.fromCharCode(65+((a.charCodeAt(0) - 65 + shift) % 26 + 26) % 26 + 65);
});
}
Line 3,602 ⟶ 4,064:
.replace(/[^A-Z]/g, '')
.replace(/./g, a =>
String.fromCharCode(65 + ((a.charCodeAt(0) - 65 + shift) % 26 + 26) % 26 + 65));</syntaxhighlight>
 
 
Line 3,784 ⟶ 4,246:
"uifsf jt b ujef jo uif bggbjst pg nfo"
</syntaxhighlight>
=={{header|Koka}}==
<syntaxhighlight lang="koka">
fun encode(s : string, shift : int)
fun encode-char(c)
if c < 'A' || (c > 'Z' && c < 'a') || c > 'z' return c
val base = if c < 'Z' then (c - 'A').int else (c - 'a').int
val rot = (base + shift) % 26
(rot.char + (if c < 'Z' then 'A' else 'a'))
s.map(encode-char)
 
fun decode(s: string, shift: int)
s.encode(0 - shift)
 
fun trip(s: string, shift: int)
s.encode(shift).decode(shift)
 
fun main()
"HI".encode(2).println
"HI".encode(20).println
"HI".trip(10).println
val enc = "The quick brown fox jumped over the lazy dog".encode(11)
enc.println
enc.decode(11).println
</syntaxhighlight>
{{out}}
<pre>
JK
BC
HI
Esp bftnv mczhy qzi ufxapo zgpc esp wlkj ozr
The quick brown fox jumped over the lazy dog
</pre>
 
=={{header|Kotlin}}==
<syntaxhighlight lang="scala">// version 1.0.5-2
Line 3,826 ⟶ 4,321:
Bright vixens jump; dozy fowl quack.
</pre>
 
=={{header|LabVIEW}}==
For readability, input is in all caps.<br/>{{VI snippet}}<br/>[[File:LabVIEW_Caesar_cipher.png]]
Line 3,904 ⟶ 4,400:
Using the built-in rotate() function on a number over a range, a number outside of the range will pass through unaltered.
 
<syntaxhighlight lang="langur">val .rot = ffn(.s, .key) {
cp2s map(ffn(.c) { rotate(rotate(.c, .key, 'a'..'z'), .key, 'A'..'Z') }, s2cp .s)
}
 
 
val .s = "A quick brown fox jumped over something."
Line 3,919 ⟶ 4,416:
encrypted: X nrfzh yoltk clu grjmba lsbo pljbqefkd.
decrypted: A quick brown fox jumped over something.</pre>
 
=={{header|Liberty BASIC}}==
<syntaxhighlight lang="lb">key = 7
Line 4,079 ⟶ 4,577:
If Len(a$)=0 Then Exit
a$=Ucase$(a$)
N=N mod 25 +1
\\ Integer in Mem is unsigned number
Buffer Mem as Integer*Len(a$)
Return Mem, 0:=a$
For i=0 to Len(a$)-1 {
If Eval(mem, i)>=65 and Eval(mem, i)<=90 then Return Mem, i:=(Eval(mem, i)-6539+Nn) mod 26 + 65
}
=Eval$(Mem)
}
B$=Cipher$(a$, 1210)
Print B$
Print Cipher$(B$,12-10)
 
n=1 ' n negative or positive or zero
for i=65 to 65+25
a=(1+(i -64)+n+24) mod 26 + 65
? chr$(a),
next
</syntaxhighlight>
?
 
=={{header|Maple}}==
<syntaxhighlight lang="maple">
Line 5,192 ⟶ 5,696:
=={{header|PureBasic}}==
The case is maintained for alphabetic characters (uppercase/lowercase input = uppercase/lowercase output) while non-alphabetic characters, if present are included and left unchanged in the result.
<syntaxhighlight lang="purebasicbasic">Procedure.s CC_encrypt(plainText.s, key, reverse = 0)
Procedure.s CC_encrypt(plainText.s, key, reverse = 0)
;if reverse <> 0 then reverse the encryption (decrypt)
If reverse: reverse = 26: key = 26 - key: EndIf
Line 5,255 ⟶ 5,760:
Wend
ProcedureReturn result
EndProcedure</syntaxhighlight>
</syntaxhighlight>
 
=={{header|Python}}==
<syntaxhighlight lang="python">def caesar(s, k, decode = False):
Line 5,387 ⟶ 5,894:
dup echo$ cr
23 caesar dup echo$ cr
23 decode caesar echo$ cr</Langsyntaxhighlight>
 
{{out}}
Line 5,439 ⟶ 5,946:
[1] "Decrypted Text: The five boxing wizards jump quickly."
</pre>
 
=={{header|Racket}}==
<syntaxhighlight lang="racket">
Line 5,548 ⟶ 6,056:
===only Latin letters===
This version conforms to the task's restrictions.
<syntaxhighlight lang="rexx">/*REXX program supports the Caesar cyphercipher for the Latin alphabet only, no punctuation */
/*──────────── no punctuation or blanks allowed, all lowercase Latin letters areis treated as uppercase. */
parseParse argUpper Arg key .; arg . p text /* get key & uppercased text to be used.ciphered*/
ptext= space(ptext, 0) /* elide any and blanks /*elide any and all spaces (blanks). */
Say 'Caesar cipher key:' key /* echo the say 'Caesar cyphercipher key:' key /*echo the Caesar cypher key to console */
saySay ' plain text:' ptext /* " " plain text " " */
code=caesar(text,key)
y= Caesar(p, key); say ' cyphered:' y /* " " cyphered text " " */
z=Say Caesar(y,-key);' say ' uncypheredciphered:' zcode /* " " uncyphered ciphered text " " */
back=caesar(code,-key)
if z\==p then say "plain text doesn't match uncyphered cyphered text."
exitSay 0' unciphered:' back /* " " unciphered text /*stick a fork in it, we're all done. */
If back\==text Then
/*──────────────────────────────────────────────────────────────────────────────────────*/
Say "unciphered text doesn't match plain text."
Caesar: procedure; arg s,k; @= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
Exit ak= abs(k) /* stick a fork in it, we're all /*obtain the absolute value of the key.done*/
/*----------------------------------------------------------------------*/
L= length(@) /*obtain the length of the @ string. */
caesar: Procedure
if ak>length(@)-1 | k==0 then call err k 'key is invalid.'
Parse Arg text,key
_= verify(s, @) /*any illegal characters specified ? */
abc='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
if _\==0 then call err 'unsupported character:' substr(s, _, 1)
If abs(key)>length(abc)-1|key==0 Then
if k>0 then ky= k + 1 /*either cypher it, or ··· */
Call err 'key ('key') is invalid.'
else ky= L + 1 - ak /* decypher it. */
return translatebadpos=verify(stext,abc) substr(@ || @, ky, L), @)/* any illegal /*returncharacter in the processed text. */
If badpos\==0 Then
/*──────────────────────────────────────────────────────────────────────────────────────*/
Call err 'unsupported character:' substr(text,badpos,1)
err: say; say '***error***'; say; say arg(1); say; exit 13</syntaxhighlight>
If key>0 Then /* cipher */
key2=key+1
Else /* decipher */
key2=length(abc)+key+1
Return translate(text,substr(abc||abc,key2,length(abc)),abc)
/*----------------------------------------------------------------------*/
err:
Say
Say '***error***'
Say
Say arg(1)
Say
Exit 13</syntaxhighlight>
{{out|output|text=&nbsp; when using the input of: &nbsp; &nbsp; <tt> 22 The definition of a trivial program is one that has no bugs </tt>}}
<pre>
Line 5,581 ⟶ 6,102:
This version allows upper and lowercase Latin alphabet as well as all the
characters on the standard (computer) keyboard including blanks.
<syntaxhighlight lang="rexx">/*REXX program supports the Caesar cyphercipher for most keyboard characters including blanks.*/
parse/* arg key p /*get key and the text to be cyphered. including blanks.*/
Parse Arg key text say 'Caesar/* cypherget key:' key /*echoand the Caesartext cypherto keybe ciph to console*/
Say 'Caesar cipher say key:' key plain text:' p /* echo " " plain text the Caesar cipher "key " */
y= Caesar(p, key); saySay ' plain cypheredtext:' ytext /* " " cyphered plain text " " */
code=caesar(text,key)
z= Caesar(y,-key); say ' uncyphered:' z /* " " uncyphered text " " */
Say ' ciphered:' code /* " " ciphered text */
if z\==p then say "plain text doesn't match uncyphered cyphered text."
back=caesar(code,-key)
exit 0 /*stick a fork in it, we're all done. */
Say ' unciphered:' back /* " " unciphered text */
/*──────────────────────────────────────────────────────────────────────────────────────*/
If back\==text Then
Caesar: procedure; parse arg s,k; @= 'abcdefghijklmnopqrstuvwxyz'
Say "plain text doesn't match unciphered ciphered text."
@= translate(@)@"0123456789(){}[]<>'" /*add uppercase, digits, group symbols.*/
Exit @= @'~!@#$%^&*_+:";?,./`-= ' /*also addstick othera charactersfork in it, we're toall thedone list*/
/*----------------------------------------------------------------------*/
L= length(@) /*obtain the length of the @ string. */
caesar: Procedure
ak= abs(k) /*obtain the absolute value of the key.*/
Parse Arg txt,ky
if ak>length(@)-1 | k==0 then call err k 'key is invalid.'
abcx='abcdefghijklmnopqrstuvwxyz'
_= verify(s,@) /*any illegal characters specified ? */
abcx=translate(abcx)abcx"0123456789(){}[]<>'" /*add uppercase, digits */
if _\==0 then call err 'unsupported character:' substr(s, _, 1)
abcx=abcx'~!@#$%^&*_+:";?,./`-= ' /* also add other characters */
if k>0 then ky= k + 1 /*either cypher it, or ··· */
l=length(abcx) else ky= L + 1 - ak /* obtain the length of decypher it. abcx */
aky=abs(ky) return translate(s, substr(@ || @, ky, L), @) /*return absolute value of the processedkey text.*/
If aky>length(abcx)-1|ky==0 Then
/*──────────────────────────────────────────────────────────────────────────────────────*/
Call err ky 'key is invalid.'
err: say; say '***error***'; say; say arg(1); say; exit 13</syntaxhighlight>
badpos=verify(txt,abcx) /* any illegal character in txt */
If badpos\==0 Then
Call err 'unsupported character:' substr(txt,badpos,1)
If ky>0 Then /* cipher */
ky=ky+1
Else /* decipher */
ky=l+1-aky
/* return translated input */
Return translate(txt,substr(abcx||abcx,ky,l),abcx)
/*----------------------------------------------------------------------*/
err:
Say
Say '***error***'
Say
Say arg(1)
Say
Exit 13</syntaxhighlight>
{{out|output|text=&nbsp; when using the input of: &nbsp; &nbsp; <tt> 31 Batman's hood is called a "cowl" (old meaning). </tt>}}
<pre>
Line 5,610 ⟶ 6,148:
uncyphered: Batman's hood is called a "cowl" (old meaning).
</pre>
 
=={{header|Ring}}==
<syntaxhighlight lang="ring">
Line 5,683 ⟶ 6,222:
pack my box with five dozen liquor jugs
</pre>
=={{header|RPL}}==
{{works with|Halcyon Calc|4.2.7}}
{| class="wikitable"
! RPL Code
! Comments
|-
|
≪ → a shift
≪ '''IF''' DUP a ≥ LAST 26 + < AND
'''THEN''' a - shift + 26 MOD a + '''END'''
≫ ≫ ‘'''Rotate'''’ STO
≪ → string shift
≪ "" 1 string SIZE '''FOR''' j
string j DUP SUB NUM
65 shift '''Rotate''' 90 shift '''Rotate'''
CHR +
'''NEXT'''
≫ ''''CESAR'''' STO
|
''( m a shift -- n )''
if m in [a, a+26[
then shift it modulo 26
''( string shift -- string )''
Scan input string
extract jth ASCII code
shift if [A..Z] or [a..z]
back to character
|}
The following line of command delivers what is required:
"The quick brown fox jumped over the lazy dogs" '''CESAR'''
{{out}}
<pre>
1: "Esp bftnv mczhy qzi ufxapo zgpc esp wlkj ozrd"
</pre>
 
=={{header|Ruby}}==
<syntaxhighlight lang="ruby">class String
Line 5,697 ⟶ 6,276:
decrypted = encypted.caesar_cipher(-3)
</syntaxhighlight>
 
=={{header|Run BASIC}}==
<syntaxhighlight lang="runbasic">input "Gimme a ofset:";ofst ' set any offset you like
Line 6,048 ⟶ 6,628:
 
</syntaxhighlight>
 
=={{header|SparForte}}==
As a structured script.
<syntaxhighlight lang="ada">#!/usr/local/bin/spar
pragma annotate( summary, "caesar" )
@( description, "Implement a Caesar cipher, both encoding and ")
@( description, "decoding. The key is an integer from 1 to " )
@( description, "25. This cipher rotates (either towards left ")
@( description, "or right) the letters of the alphabet (A to " )
@( description, "Z). " )
@( see_also, "http://rosettacode.org/wiki/Caesar_cipher" )
@( author, "Ken O. Burtch" );
pragma license( unrestricted );
 
pragma restriction( no_external_commands );
 
procedure caesar is
 
type cipher_value is new natural;
 
function to_cipher_value(c: character; offset: character) return cipher_value is
cv : integer;
begin
cv := ( numerics.pos(c)-numerics.pos(offset) ) mod 26;
return cipher_value(cv);
end to_cipher_value;
 
function to_character(cv: cipher_value; offset: character) return character is
begin
return strings.val( integer(cv) + numerics.pos(offset) );
end to_character;
 
function encrypt( plain: string; key: cipher_value) return string is
cv : cipher_value;
cipher_char : character;
cipher_text : string;
plain_char : character;
begin
for i in 1..strings.length( plain ) loop
plain_char := strings.element( plain, i);
if plain_char >= 'A' and plain_char <= 'Z' then
cv := ( to_cipher_value( plain_char, 'A')+key ) mod 26;
cipher_char := to_character( cv, 'A' );
elsif plain_char >= 'a' and plain_char <= 'z' then
cv := ( to_cipher_value( plain_char, 'a')+key ) mod 26;
cipher_char := to_character( cv, 'a' );
else
cipher_char := plain_char;
end if;
cipher_text := strings.overwrite( @, i, string( cipher_char ) );
end loop;
return cipher_text;
end encrypt;
 
text: string := get_line;
key: constant cipher_value := 3; -- Default key from "Commentarii de Bello Gallico"
 
begin
put_line("Plaintext ------------>" & text);
text := encrypt(text, key);
put_line("Ciphertext ----------->" & text);
text := encrypt(text, -key);
put_line("Decrypted Ciphertext ->" & text);
end caesar;</syntaxhighlight>
 
=={{header|SSEM}}==
ASCII didn't exit in 1948, and the task specification explicitly says we only need to convert Roman capitals; so we adopt a simpler encoding, representing the letters of the alphabet from <tt>A</tt>=0 to <tt>Z</tt>=25.
Line 6,209 ⟶ 6,854:
Decrypted message = The five boxing wizards jump quickly.
</pre>
 
=={{header|True BASIC}}==
{{works with|QBasic}}
{{trans|BASIC256}}
<syntaxhighlight lang="qbasic">LET dec$ = ""
LET tipo$ = "cleartext "
 
PRINT "If decrypting enter 'd' -- else press enter ";
INPUT dec$
PRINT "Enter offset ";
INPUT llave
 
IF dec$ = "d" THEN
LET llave = 26 - llave
LET tipo$ = "ciphertext "
END IF
 
PRINT "Enter "; tipo$;
INPUT cadena$
 
LET cadena$ = UCASE$(cadena$)
LET longitud = LEN(cadena$)
 
FOR i = 1 TO longitud
!LET iTemp = ASC(MID$(cadena$,i,1)) 'QBasic
LET itemp = ORD((cadena$)[i:i+1-1][1:1]) !'True BASIC
IF iTemp > 64 AND iTemp < 91 THEN
!LET iTemp = ((iTemp - 65) + llave) MOD 26 'QBasic
LET iTemp = MOD(((iTemp - 65) + llave), 26) !'True BASIC
PRINT CHR$(iTemp + 65);
ELSE
PRINT CHR$(iTemp);
END IF
NEXT i
END</syntaxhighlight>
 
=={{header|TUSCRIPT}}==
<syntaxhighlight lang="tuscript">$$ MODE TUSCRIPT
Line 6,633 ⟶ 7,315:
Encrypted: Ufhp rd gtc bnym knaj itejs qnvztw ozlx.
Decrypted: Pack my box with five dozen liquor jugs.</pre>
 
=={{header|V (Vlang)}}==
<syntaxhighlight lang="v (vlang)">
import rand
 
const (
lo_abc = 'abcdefghijklmnopqrstuvwxyz'
up_abc = 'ABCDEFGHIJKLMNIPQRSTUVWXYZ'
)
 
fn main() {
key := rand.int_in_range(2, 25) or {13}
encrypted := caesar_encrypt('The five boxing wizards jump quickly', key)
println(encrypted)
println(caesar_decrypt(encrypted, key))
}
 
fn caesar_encrypt(str string, key int) string {
offset := key % 26
if offset == 0 {return str}
mut nchr := u8(0)
mut chr_arr := []u8{}
for chr in str {
if chr.ascii_str() in up_abc.split('') {
nchr = chr + u8(offset)
if nchr > u8(90) {nchr -= 26}
}
else if chr.ascii_str() in lo_abc.split('') {
nchr = chr + u8(offset)
if nchr > u8(122) {nchr -= 26}
}
else {nchr = chr}
chr_arr << nchr
}
return chr_arr.bytestr()
}
fn caesar_decrypt(str string, key int) string {
return caesar_encrypt(str, 26 - key)
}
</syntaxhighlight>
 
{{out}}
<pre>
Jxu vylu renydw mypqhti zkcf gkysabo
The five boxing wizards jump quickly
</pre>
 
=={{header|Wortel}}==
<syntaxhighlight lang="wortel">@let {
Line 6,656 ⟶ 7,386:
=={{header|Wren}}==
{{trans|Kotlin}}
<syntaxhighlight lang="ecmascriptwren">class Caesar {
static encrypt(s, key) {
var offset = key % 26
Line 6,688 ⟶ 7,418:
Bright vixens jump; dozy fowl quack.
</pre>
 
=={{header|X86 Assembly}}==
{{trans|C custom implementation}}
Line 7,001 ⟶ 7,732:
 
You are encouraged to solve this task according to the task description, using any language you may know.</pre>
=={{header|Zig}}==
<syntaxhighlight lang="zig">
const std = @import("std");
const stdout = @import("std").io.getStdOut().writer();
 
pub fn rot(txt: []u8, key: u8) void {
for (txt, 0..txt.len) |c, i| {
if (std.ascii.isLower(c)) {
txt[i] = (c - 'a' + key) % 26 + 'a';
} else if (std.ascii.isUpper(c)) {
txt[i] = (c - 'A' + key) % 26 + 'A';
}
}
}
 
pub fn main() !void {
const key = 3;
var txt = "The five boxing wizards jump quickly".*;
 
try stdout.print("Original: {s}\n", .{txt});
rot(&txt, key);
try stdout.print("Encrypted: {s}\n", .{txt});
rot(&txt, 26 - key);
try stdout.print("Decrypted: {s}\n", .{txt});
}
</syntaxhighlight>
{{out}}
<pre>
Original: The five boxing wizards jump quickly
Encrypted: Wkh ilyh eralqj zlcdugv mxps txlfnob
Decrypted: The five boxing wizards jump quickly
</pre>
 
=={{header|zkl}}==
<syntaxhighlight lang="zkl">fcn caesarCodec(str,n,encode=True){
Line 7,021 ⟶ 7,785:
decoded = The five boxing wizards jump quickly
</pre>
 
=={{header|zonnon}}==
<syntaxhighlight lang="zonnon">
885

edits