New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enforce a padding scheme #22
Comments
Better suggestions welcome |
It looks like padding isn't the issue: package main
import (
"bytes"
"fmt"
"encoding/base32"
)
const encodeStd = "abcdefghijklmnopqrstuvwxyz234567"
// AddressEncoding defines the base32 config used for address encoding and decoding.
var AddressEncoding = base32.NewEncoding(encodeStd)
func main() {
a := "xpbyy4tkdx5si2bgo37dubc2xwv6fum5tk57mia="
b := "xpbyy4tkdx5si2bgo37dubc2xwv6fum5tk57mid="
x, err := AddressEncoding.DecodeString(a)
if err != nil {
panic(err)
}
y, err := AddressEncoding.DecodeString(b)
if err != nil {
panic(err)
}
fmt.Println(bytes.Equal(x, y))
} (prints true) |
5 tasks
11 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Because we don't enforce a padding scheme, we have
f1xpbyy4tkdx5si2bgo37dubc2xwv6fum5tk57mid
andf1xpbyy4tkdx5si2bgo37dubc2xwv6fum5tk57mia
"actually" being the same address.This isn't the easiest thing to fix, since we currently operate with "no padding", but the solution is probably to refuse to decode other padding schemes:
The text was updated successfully, but these errors were encountered: