Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

/rot13 package

Overview

Package rot13 ports Go's classic ROT13 example — the one used to teach strings.Map and io.Reader in the standard library docs — to an on-chain Gno realm. The core is a pure letter-rotation cipher over ASCII: ROT13 shifts each letter 13 places, which (since the alphabet has 26 letters) makes ROT13 its own inverse. Caesar generalizes it to any shift.

Everything here is pure strings/unicode logic: no state, no randomness, no clock — Render reads its input straight from the gnoweb path.

Functions

Caesar

func Caesar(s string, shift int) string

Caesar generalizes ROT13 to an arbitrary shift. Negative and large shifts are normalized into [0,26). Only ASCII letters move; anything else passes through unchanged. Caesar(s, 13) is exactly Rot13(s).

Params

Command

gnokey query vm/qeval -remote "https://rpc.topaz.testnets.gno.land" -data "gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/rot13.Caesar(,)"

Result

Render

func Render(path string) string

Render is the gnoweb entry point (not a crossing call).

Example
1Render("")                 -> explanation + a worked example
2Render("/Hello, Gno!")     -> the input and its ROT13
3Render("/caesar/3/attack") -> a Caesar shift of 3 applied to "attack"

Param

Command

gnokey query vm/qeval -remote "https://rpc.topaz.testnets.gno.land" -data "gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/rot13.Render()"

Result

Rot13

func Rot13(s string) string

Rot13 applies the ROT13 substitution cipher, rotating ASCII letters by 13 and leaving every other byte untouched. Because 13 is half of 26, Rot13(Rot13(s)) == s — the cipher is its own inverse. This mirrors the canonical strings.Map example from the Go docs.

Param

Command

gnokey query vm/qeval -remote "https://rpc.topaz.testnets.gno.land" -data "gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/rot13.Rot13()"

Result