3 ms·
Public keys are 32 bytes long, and private keys are 64 bytes long. The Ed25519 functions check to make sure the key is the correct length before using them: h
by agwa 6y ago
Public keys are 32 bytes long, and private keys are 64 bytes long. The Ed25519 functions check to make sure the key is the correct length before using them:
https://github.com/golang/go/blob/d4bfe006155ea0d9c2970e22fca5a027125c8a98/src/crypto/ed25519/ed25519.go#L204 https://github.com/golang/go/blob/d4bfe006155ea0d9c2970e22fc...
The types would ideally use fixed-length arrays, but at the time the API was designed, Go didn't allow conversions between slices and array pointers, which would have made the API annoying to use:
https://github.com/golang/go/issues/24376#issuecomment-372786394 https://github.com/golang/go/issues/24376#issuecomment-37278...
Go is now adding support for such conversions, but the Ed25519 API can't be changed due to backwards compatibility guarantees.