(char rune)
| 76 | } |
| 77 | |
| 78 | func (p *Polybius) encipher(char rune) (string, error) { |
| 79 | index := strings.IndexRune(p.key, char) |
| 80 | if index < 0 { |
| 81 | return "", fmt.Errorf("%q does not exist in keys", char) |
| 82 | } |
| 83 | row := index / p.size |
| 84 | col := index % p.size |
| 85 | chars := []rune(p.characters) |
| 86 | return string([]rune{chars[row], chars[col]}), nil |
| 87 | } |
| 88 | |
| 89 | func (p *Polybius) decipher(chars []rune) (string, error) { |
| 90 | if len(chars) != 2 { |