fix secret key hex parsing zero-filler.
This commit is contained in:
2
keys.go
2
keys.go
@@ -31,7 +31,7 @@ func (sk SecretKey) Public() PubKey { return GetPublicKey(sk) }
|
|||||||
func SecretKeyFromHex(skh string) (SecretKey, error) {
|
func SecretKeyFromHex(skh string) (SecretKey, error) {
|
||||||
id := SecretKey{}
|
id := SecretKey{}
|
||||||
|
|
||||||
if len(skh) > 64 {
|
if len(skh) < 64 {
|
||||||
skh = strings.Repeat("0", 64-len(skh)) + skh
|
skh = strings.Repeat("0", 64-len(skh)) + skh
|
||||||
} else if len(skh) > 64 {
|
} else if len(skh) > 64 {
|
||||||
return id, fmt.Errorf("pubkey should be at most 64-char hex, got '%s'", skh)
|
return id, fmt.Errorf("pubkey should be at most 64-char hex, got '%s'", skh)
|
||||||
|
|||||||
Reference in New Issue
Block a user