@@ -28,7 +28,7 @@ const (
2828 // PublicKeySize is the size, in bytes, of public keys as used in this package.
2929 PublicKeySize = 66
3030 // PrivateKeySize is the size, in bytes, of private keys as used in this package.
31- PrivateKeySize = 66
31+ PrivateKeySize = 132
3232 // SignatureSize is the size, in bytes, of signatures generated and verified by this package.
3333 SignatureSize = 132
3434 // SeedSize is the size, in bytes, of private key seeds.
@@ -118,9 +118,9 @@ func (priv *PrivateKey) Bytes() []byte {
118118
119119 pub := ed521 .MarshalPoint (priv .Curve , priv .X , priv .Y )
120120
121- buf := make ([]byte , 132 )
122- copy (buf [:66 ], seed )
123- copy (buf [66 :], pub )
121+ buf := make ([]byte , PrivateKeySize )
122+ copy (buf [:SeedSize ], seed )
123+ copy (buf [SeedSize :], pub )
124124
125125 return buf
126126}
@@ -200,13 +200,13 @@ func NewKeyFromSeed(seed []byte) (*PrivateKey, error) {
200200
201201// New a private key from bytes
202202func NewKeyFromBytes (bytes []byte ) (* PrivateKey , error ) {
203- if l := len (bytes ); l != 132 {
203+ if l := len (bytes ); l != PrivateKeySize {
204204 return nil , errors .New ("go-cryptobin/ed521: bad bytes length: " + strconv .Itoa (l ))
205205 }
206206
207207 curve := ed521 .ED521 ()
208208
209- k := new (big.Int ).SetBytes (bytes [:66 ])
209+ k := new (big.Int ).SetBytes (bytes [:SeedSize ])
210210
211211 priv := new (PrivateKey )
212212 priv .PublicKey .Curve = curve
@@ -223,7 +223,7 @@ func NewPrivateKey(d []byte) (*PrivateKey, error) {
223223
224224// return PrivateKey data
225225func PrivateKeyTo (key * PrivateKey ) []byte {
226- privateKey := make ([]byte , PrivateKeySize )
226+ privateKey := make ([]byte , SeedSize )
227227 return key .D .FillBytes (privateKey )
228228}
229229
0 commit comments