Files
ham/protocol/aprs/base91.go
maze 32f6c38c13
Some checks failed
Run tests / test (1.25) (push) Failing after 15s
Run tests / test (stable) (push) Failing after 17s
Fixed code smells
2026-02-22 21:14:58 +01:00

31 lines
458 B
Go

package aprs
import (
"fmt"
)
func base91Decode(s string) (n int, err error) {
for i, l := 0, len(s); i < l; i++ {
c := s[i]
if c < 33 || c > 122 {
return 0, fmt.Errorf("aprs: invalid base-91 encoding char %q (%d)", c, c)
}
n *= 91
n += int(c) - 33
}
return
}
/*
func base91Encode(n int) string {
var s []string
for n > 0 {
c := n % 91
n /= 91
s = append([]string{string(byte(c) + 33)}, s...)
}
return strings.Join(s, "")
}
*/