Encrypt encrypts with polybius encryption
(text string)
| 50 | |
| 51 | // Encrypt encrypts with polybius encryption |
| 52 | func (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 |
| 65 | func (p *Polybius) Decrypt(text string) (string, error) { |