Documentation
¶
Overview ¶
----------------------------------------------------------------- * L o r d O f S c r i p t s (tm) * Copyright (C)2025 Dídimo Grimaldo T. * goCaesarDisk * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * *-----------------------------------------------------------------
----------------------------------------------------------------- * L o r d O f S c r i p t s (tm) * Copyright (C)2025 Dídimo Grimaldo T. * goCaesarDisk * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * *-----------------------------------------------------------------
----------------------------------------------------------------- * L o r d O f S c r i p t s (tm) * Copyright (C)2025 Dídimo Grimaldo T. * APP_NAME * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * *-----------------------------------------------------------------
----------------------------------------------------------------- * L o r d O f S c r i p t s (tm) * Copyright (C)2025 Dídimo Grimaldo T. * goCaesarDisk * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * *-----------------------------------------------------------------
----------------------------------------------------------------- * L o r d O f S c r i p t s (tm) * Copyright (C)2025 Dídimo Grimaldo T. * goCaesarDisk * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * *-----------------------------------------------------------------
----------------------------------------------------------------- * L o r d O f S c r i p t s (tm) * Copyright (C)2025 Dídimo Grimaldo T. * goCaesarDisk * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * A Caesar Disk maker. *-----------------------------------------------------------------
Index ¶
- Constants
- Variables
- func BuildMeta() string
- func BuyMeCoffee(coffee4 ...string)
- func Copyright(owner string, withLogo bool)
- func GenerateCaesarWheel(letters string, filename string, inner bool, opts CaesarWheelOptions) error
- func GenerateCaesarWheelImage(letters string, inner bool, opts CaesarWheelOptions) (image.Image, error)
- func GenerateDualCaesarWheel(letters, symbols string, filename string, inner bool, opts CaesarWheelOptions) error
- func GoVersion() string
- func GoVersionMin(min string) (string, bool)
- func Logo() string
- func Reverse(s string) string
- func RuneString(latin string) string
- func SuperimposeDisksByShift(shift, n int, outerFilename, innerFilename, outputFilename string, isDual bool, ...) error
- func SuperimposeDisksByShiftImage(shift, n int, outerImg, innerImg image.Image, isDual bool, ...) (image.Image, error)
- type AlphabetModel
- func (a *AlphabetModel) Character(index int) (rune, error)
- func (a *AlphabetModel) Find(char rune) int
- func (a *AlphabetModel) FindExact(char rune) int
- func (a *AlphabetModel) FirstChar() rune
- func (a *AlphabetModel) IsLower() bool
- func (a *AlphabetModel) IsMultiByte() bool
- func (a *AlphabetModel) IsUpper() bool
- func (a *AlphabetModel) Length() int
- func (a *AlphabetModel) String() string
- type CaesarWheelOptions
- func (w *CaesarWheelOptions) SetDigitColor(colorHex string) *CaesarWheelOptions
- func (w *CaesarWheelOptions) SetDigitFont(path string, size float64) *CaesarWheelOptions
- func (w *CaesarWheelOptions) SetLetterColors(outer, inner string) *CaesarWheelOptions
- func (w *CaesarWheelOptions) SetLetterFont(path string, size float64) *CaesarWheelOptions
- func (w *CaesarWheelOptions) String() string
- type RGB
- type TriState
Constants ¶
const ( // Keep this in mind if you want an dual letter & symbol // disks that you can use with the same encoding key // (same length for both alphabets) // 0 1 2 3 // 1234567890123456789012345678901 // ------------------------------- // ABCDEFGHIJKLMNÑOPQRSTUVWXYZÁÉÍÓÚ // !"#$%&'()*+,-./ 0123456789:;<=>? Alpha_EN string = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" Alpha_ES string = "ABCDEFGHIJKLMNÑOPQRSTUVWXYZÁÉÍÓÚ" Alpha_CZ string = "ABCČDĎEFGHIJKLMNŇOPQRŘSŠTŤUVWXYÝZŽÁÉÍÓÚĚŮ" Alpha_DE string = "ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÜẞ" Alpha_IT string = "ABCDEFGHILMNOPQRSTUVZÉÓÀÈÌÒÙ" Alpha_PT string = "ABCÇDEFGHIJKLMNOPQRSTUVWXYZÁÉÍÓÚÀÂÊÔÃÕ" Alpha_GR string = "ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ" Alpha_RU string = "АБВГДЕËЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ" Alpha_PU string = `!"#$%&'()*+,-./ 0123456789:;<=>?` Alpha_RUNES string = "ᚫᛒᚳᛞᛖᚠᚷᚻᛁᛃᛱᛚᛗᚾᚩᛈᛩᚱᛋᛏᚢᚡᚹᛪᛦᛎ" Alpha_ES_DUAL = "ABCDEFGHIJKLMNÑOPQRSTUVWXYZ" Alpha_PU_DUAL_ES = `!"#$%&()*+,-./ 0123456789=?` // to match length of ES_DUAL Alpha_PU_DUAL_EN = `!"#$%&()*+,-./ 0123456789?` // to match length of EN )
const ( DEFAULT_FONT_REGULAR = "ubuntu.regular.ttf" DEFAULT_FONT_BOLD = "ubuntu.bold.ttf" )
const ( MANUAL_VERSION string = "1.3.0" // in case vcsVersion not injected during link phase // Useful Unicode Characters CHR_COPYRIGHT = '\u00a9' // © CHR_REGISTERED = '\u00ae' // ® CHR_GUILLEMET_L = '\u00ab' // « CHR_GUILLEMET_R = '\u00bb' // » CHR_TRADEMARK = '\u2122' // ™ CHR_SAMARITAN = '\u214f' // ⅏ CHR_PLACEOFINTEREST = '\u2318' // ⌘ CHR_HIGHVOLTAGE = '\u26a1' // ⚡ CHR_TRIDENT = rune(0x1f531) // 🔱 CHR_SPLATTER = rune(0x1fadf) CHR_WARNING = '\u26a0' // ⚠ CHR_EXCLAMATION = '\u2757' CHR_SKULL = '\u2620' // ☠ CO1 = "odlamirG omidiD 5202)C(" CO2 = "stpircS fO droL 5202)C(" CO3 = "gnitirwnitsol" // Change these values accordingly NAME string = "Go Caesar Disk Maker" DESC string = "An extended Caesar Cipher for modern-day alphabets" )
---------------------------------------------------------------- * G l o b a l s *-----------------------------------------------------------------
const (
SubTitle string = "C a e s a r D i s k"
)
Variables ¶
var ( ErrCharacterNotFound error = errors.New("character not found in alphabet") ErrCharacterIndexOutOfRange error = errors.New("character index greater than alphabet") )
var ( // DO NOT CHANGE THESE! Version string = appVersion.String() ShortVersion string = appVersion.Short() )
var DefaultCaesarWheelOptions = CaesarWheelOptions{ Title: "", Size: image.Rect(0, 0, 800, 800), Radius: 360.0, Orthogonal: true, RadialsColor: NewRGB[uint8](0xd3, 0xd3, 0xd3), LettersFontPath: DEFAULT_FONT_BOLD, LettersSize: 30.0, LetterColor: NewRGB[uint8](0, 0, 0), LetterColorAlt: NewRGB[uint8](0, 0, 0), DigitsFontPath: DEFAULT_FONT_REGULAR, DigitsSize: 18.0, DigitsColor: NewRGB[uint8](0x00, 0x00, 0xff), }
Default rendering options for the Caesar Wheel
var (
ErrUnmatchedDual error = errors.New("for dual alphabet mode both alphabets must have equal lengths")
)
var Gray = NewRGBA[uint8](0xd3, 0xd3, 0xd3, 0xFF)
var MidGray = NewRGBA[uint8](0x66, 0x6a, 0x6d, 0xFF)
var Yellow = NewRGBA[uint8](0xff, 0xfd, 0x01, 0xFF)
Functions ¶
func GenerateCaesarWheel ¶
func GenerateCaesarWheel(letters string, filename string, inner bool, opts CaesarWheelOptions) error
Generates a single-alphabet Caesar wheel (inner OR outer) and saves it to a file.
func GenerateCaesarWheelImage ¶
func GenerateCaesarWheelImage(letters string, inner bool, opts CaesarWheelOptions) (image.Image, error)
Generates a single-alphabet Caesar wheel (inner OR outer) and returns the image object.
func GenerateDualCaesarWheel ¶
func GenerateDualCaesarWheel(letters, symbols string, filename string, inner bool, opts CaesarWheelOptions) error
func GoVersionMin ¶
retrieve the current GO language version and compare it to the minimum required. It returns the current version and whether the condition current >= min is fulfilled or not.
func RuneString ¶
func SuperimposeDisksByShift ¶
func SuperimposeDisksByShift(shift, n int, outerFilename, innerFilename, outputFilename string, isDual bool, opts CaesarWheelOptions) error
Superimpose two disks from a file into another saved to a file.
func SuperimposeDisksByShiftImage ¶
func SuperimposeDisksByShiftImage(shift, n int, outerImg, innerImg image.Image, isDual bool, opts CaesarWheelOptions) (image.Image, error)
Superimpose two disks from image objects and create a composite image.
Types ¶
type AlphabetModel ¶
type AlphabetModel struct {
// contains filtered or unexported fields
}
func NewAlphabetModel ¶
func NewAlphabetModel(alphabet string) *AlphabetModel
(ctor) alphabet model without case conversion
func NewAlphabetModelCased ¶
func NewAlphabetModelCased(alphabet string) *AlphabetModel
(ctor) an instance of an alphabet made of the given string. It assumes all characters are unique and no trimming is done! However, the alphabet is converted to uppercase.
func NewAlphabetModelForSymbols ¶
func NewAlphabetModelForSymbols(alphabet string) *AlphabetModel
(ctor) A symbols/punctuation-only alphabet without letters that can be upper/lowercased.
func (*AlphabetModel) Character ¶
func (a *AlphabetModel) Character(index int) (rune, error)
return the character at the given zero-based index
func (*AlphabetModel) Find ¶
func (a *AlphabetModel) Find(char rune) int
finds the index of the character (case-insensitive search), or -1 if not present.
func (*AlphabetModel) FindExact ¶
func (a *AlphabetModel) FindExact(char rune) int
finds the index of the exact character (case-sensitive). return -1 if not found
func (*AlphabetModel) FirstChar ¶
func (a *AlphabetModel) FirstChar() rune
func (*AlphabetModel) IsLower ¶
func (a *AlphabetModel) IsLower() bool
func (*AlphabetModel) IsMultiByte ¶
func (a *AlphabetModel) IsMultiByte() bool
whether the alphabet has multi-byte characters
func (*AlphabetModel) IsUpper ¶
func (a *AlphabetModel) IsUpper() bool
func (*AlphabetModel) Length ¶
func (a *AlphabetModel) Length() int
the length or size of the alphabet in Unicode runes (not bytes)
func (*AlphabetModel) String ¶
func (a *AlphabetModel) String() string
implements fmt.Stringer and returns the alphabet string
type CaesarWheelOptions ¶
type CaesarWheelOptions struct {
Title string
Size image.Rectangle
Radius float64
Orthogonal bool
RadialsColor RGB[uint8]
LettersFontPath string
LettersSize float64
LetterColor RGB[uint8]
LetterColorAlt RGB[uint8]
DigitsFontPath string
DigitsSize float64
DigitsColor RGB[uint8]
}
Rendering options for a Caesar encoder/decoder wheel
func (*CaesarWheelOptions) SetDigitColor ¶
func (w *CaesarWheelOptions) SetDigitColor(colorHex string) *CaesarWheelOptions
func (*CaesarWheelOptions) SetDigitFont ¶
func (w *CaesarWheelOptions) SetDigitFont(path string, size float64) *CaesarWheelOptions
set font path and size for digits (Caesar key shift)
func (*CaesarWheelOptions) SetLetterColors ¶
func (w *CaesarWheelOptions) SetLetterColors(outer, inner string) *CaesarWheelOptions
func (*CaesarWheelOptions) SetLetterFont ¶
func (w *CaesarWheelOptions) SetLetterFont(path string, size float64) *CaesarWheelOptions
set font path and size for letters (alphabets)
func (*CaesarWheelOptions) String ¶
func (w *CaesarWheelOptions) String() string
implements fmt.Stringer for the CaesarWheelOptions
type RGB ¶
a custom RGBA implementation for the Caesar Wheel
func NewRGBFromString ¶
func ParseHexColor ¶
Parses a string that describes a color in Hex format. using one or two digits for each RGB part. The string must start with a # and no alpha part. Examples: #a5d or #ab24ef
func (RGB[T]) ToHexColor ¶
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
disk
command
----------------------------------------------------------------- * L o r d O f S c r i p t s (tm) * Copyright (C)2025 Dídimo Grimaldo T. * goCaesarDisk * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * *-----------------------------------------------------------------
|
----------------------------------------------------------------- * L o r d O f S c r i p t s (tm) * Copyright (C)2025 Dídimo Grimaldo T. * goCaesarDisk * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * *----------------------------------------------------------------- |
|
gui
command
----------------------------------------------------------------- * * Copyright (C)2025 * APP_NAME * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * *-----------------------------------------------------------------
|
----------------------------------------------------------------- * * Copyright (C)2025 * APP_NAME * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * *----------------------------------------------------------------- |
|
internal
|
|
|
cipher
----------------------------------------------------------------- * L o r d O f S c r i p t s (tm) * Copyright (C)2025 Dídimo Grimaldo T. * goCaesarDisk GUI * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * Implements basic Caesar cipher encoding/decoding using Unicode * (foreign) alphabets (not just ASCII).
|
----------------------------------------------------------------- * L o r d O f S c r i p t s (tm) * Copyright (C)2025 Dídimo Grimaldo T. * goCaesarDisk GUI * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * Implements basic Caesar cipher encoding/decoding using Unicode * (foreign) alphabets (not just ASCII). |
|
hash
----------------------------------------------------------------- * P u b l i c D o m a i n * Copyleft * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * An XXHash64 implementation.
|
----------------------------------------------------------------- * P u b l i c D o m a i n * Copyleft * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * An XXHash64 implementation. |