caesar

package
v3.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2022 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package caesar is the shift cipher ref: https://en.wikipedia.org/wiki/Caesar_cipher

Example
const (
	key   = 10
	input = "The Quick Brown Fox Jumps over the Lazy Dog."
)

encryptedText := Encrypt(input, key)
fmt.Printf("Encrypt=> key: %d, input: %s, encryptedText: %s\n", key, input, encryptedText)

decryptedText := Decrypt(encryptedText, key)
fmt.Printf("Decrypt=> key: %d, input: %s, decryptedText: %s\n", key, encryptedText, decryptedText)
Output:

Encrypt=> key: 10, input: The Quick Brown Fox Jumps over the Lazy Dog., encryptedText: Dro Aesmu Lbygx Pyh Tewzc yfob dro Vkji Nyq.
Decrypt=> key: 10, input: Dro Aesmu Lbygx Pyh Tewzc yfob dro Vkji Nyq., decryptedText: The Quick Brown Fox Jumps over the Lazy Dog.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(input string, key int) string

Decrypt decrypts by left shift of "key" each character of "input"

func Encrypt

func Encrypt(input string, key int) string

Encrypt encrypts by right shift of "key" each character of "input"

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL