Skip to content

Commit

Permalink
code style fix
Browse files Browse the repository at this point in the history
  • Loading branch information
savely-krasovsky committed Aug 16, 2019
1 parent dd154f4 commit 9e79fb5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions ecies.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func Encrypt(pubkey *PublicKey, msg []byte) ([]byte, error) {
ct.Write(ek.PublicKey.Bytes(false))

// Derive shared secret
ss, err := ek.EncapsulateKEM(pubkey)
ss, err := ek.Encapsulate(pubkey)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -74,7 +74,7 @@ func Decrypt(privkey *PrivateKey, msg []byte) ([]byte, error) {
msg = msg[65:]

// Derive shared secret
ss, err := ethPubkey.DecapsulateKEM(privkey)
ss, err := ethPubkey.Decapsulate(privkey)
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions ecies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ func TestKEM(t *testing.T) {
k1 := NewPrivateKeyFromBytes(new(big.Int).SetInt64(2).Bytes())
k2 := NewPrivateKeyFromBytes(new(big.Int).SetInt64(3).Bytes())

sk1, err := k1.EncapsulateKEM(k2.PublicKey)
sk1, err := k1.Encapsulate(k2.PublicKey)
if !assert.NoError(t, err) {
return
}
sk2, err := k1.PublicKey.DecapsulateKEM(k2)
sk2, err := k1.PublicKey.Decapsulate(k2)
if !assert.NoError(t, err) {
return
}
Expand Down
4 changes: 2 additions & 2 deletions privatekey.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ func (k *PrivateKey) Hex() string {
return hex.EncodeToString(k.Bytes())
}

// EncapsulateKEM encapsulates key by using Key Encapsulation Mechanism and returns symmetric key;
// Encapsulate encapsulates key by using Key Encapsulation Mechanism and returns symmetric key;
// can be safely used as encryption key
func (k *PrivateKey) EncapsulateKEM(pub *PublicKey) ([]byte, error) {
func (k *PrivateKey) Encapsulate(pub *PublicKey) ([]byte, error) {
if pub == nil {
return nil, errors.New("public key is empty")
}
Expand Down
4 changes: 2 additions & 2 deletions publickey.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ func (k *PublicKey) Hex(compressed bool) string {
return hex.EncodeToString(k.Bytes(compressed))
}

// DecapsulateKEM decapsulates key by using Key Encapsulation Mechanism and returns symmetric key;
// Decapsulate decapsulates key by using Key Encapsulation Mechanism and returns symmetric key;
// can be safely used as encryption key
func (k *PublicKey) DecapsulateKEM(priv *PrivateKey) ([]byte, error) {
func (k *PublicKey) Decapsulate(priv *PrivateKey) ([]byte, error) {
if priv == nil {
return nil, errors.New("public key is empty")
}
Expand Down

0 comments on commit 9e79fb5

Please sign in to comment.