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 state

Back to all declarations

Rot13

func(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.

Open
OID
01d732…8683:3
Rot13 details

Inspect func

rot13Rune

func(r int32) int32

rot13Rune is the mapping function handed to strings.Map — the heart of the classic example.

Open
OID
01d732…8683:5
rot13Rune details

Inspect func

Caesar

func(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).

Open
OID
01d732…8683:6
Caesar details

Inspect func

hexNibble

func(b uint8) int

hexNibble decodes a single hex digit, returning -1 if invalid.

Open
OID
01d732…8683:7
hexNibble details

Inspect func

percentDecode

func(s string) string

percentDecode turns "%20"/"+" style path escapes back into readable text so gnoweb links with spaces or punctuation round-trip nicely. Invalid escapes are left verbatim.

Open
OID
01d732…8683:8
percentDecode details

Inspect func

Render

func(path string) string

Render is the gnoweb entry point (not a crossing call). Render("") -> explanation + a worked example Render("/Hello, Gno!") -> the input and its ROT13 Render("/caesar/3/attack") -> a Caesar shift of 3 applied to "attack"

Open
OID
01d732…8683:9
Render details

Inspect func

renderRot13

func(text string) string
Open
OID
01d732…8683:11
renderRot13 details

Inspect func

renderCaesar

func(text string, shift int) string
Open
OID
01d732…8683:12
renderCaesar details

Inspect func
Rot13 : func(s string) string Inspect
rot13Rune : func(r int32) int32 Inspect
Caesar : func(s string, shift int) string Inspect
hexNibble : func(b uint8) int Inspect
percentDecode : func(s string) string Inspect
Render : func(path string) string Inspect
renderRoot : func() string Inspect
renderRot13 : func(text string) string Inspect
renderCaesar : func(text string, shift int) string Inspect