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

Method Encrypt

cipher/polybius/polybius.go:52–62  ·  view source on GitHub ↗

Encrypt encrypts with polybius encryption

(text string)

Source from the content-addressed store, hash-verified

50
51// Encrypt encrypts with polybius encryption
52func (p *Polybius) Encrypt(text string) (string, error) {
53 encryptedText := ""
54 for _, char := range strings.ToUpper(text) {
55 encryptedChar, err := p.encipher(char)
56 if err != nil {
57 return "", fmt.Errorf("failed encipher: %w", err)
58 }
59 encryptedText += encryptedChar
60 }
61 return encryptedText, nil
62}
63
64// Decrypt decrypts with polybius encryption
65func (p *Polybius) Decrypt(text string) (string, error) {

Callers 3

ExampleNewPolybiusFunction · 0.95
TestPolybiusEncryptFunction · 0.95
FuzzPolybiusFunction · 0.95

Calls 1

encipherMethod · 0.95

Tested by 3

ExampleNewPolybiusFunction · 0.76
TestPolybiusEncryptFunction · 0.76
FuzzPolybiusFunction · 0.76