MCPcopy Index your code
hub / github.com/TheAlgorithms/Go / Example

Function Example

cipher/caesar/caesar_test.go:141–156  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

139}
140
141func Example() {
142 const (
143 key = 10
144 input = "The Quick Brown Fox Jumps over the Lazy Dog."
145 )
146
147 encryptedText := Encrypt(input, key)
148 fmt.Printf("Encrypt=> key: %d, input: %s, encryptedText: %s\n", key, input, encryptedText)
149
150 decryptedText := Decrypt(encryptedText, key)
151 fmt.Printf("Decrypt=> key: %d, input: %s, decryptedText: %s\n", key, encryptedText, decryptedText)
152
153 // Output:
154 // Encrypt=> key: 10, input: The Quick Brown Fox Jumps over the Lazy Dog., encryptedText: Dro Aesmu Lbygx Pyh Tewzc yfob dro Vkji Nyq.
155 // Decrypt=> key: 10, input: Dro Aesmu Lbygx Pyh Tewzc yfob dro Vkji Nyq., decryptedText: The Quick Brown Fox Jumps over the Lazy Dog.
156}
157
158func FuzzCaesar(f *testing.F) {
159 rnd := rand.New(rand.NewSource(time.Now().UnixNano()))

Callers

nothing calls this directly

Calls 2

EncryptFunction · 0.70
DecryptFunction · 0.70

Tested by

no test coverage detected