mirror of
https://github.com/status-im/whisper.git
synced 2025-02-23 07:58:14 +00:00
crypto, crypto/ecies, crypto/secp256k1: libsecp256k1 scalar mult
thanks to Felix Lange (fjl) for help with design & impl
This commit is contained in:
parent
f4a2672e14
commit
95d1d1b891
@ -23,6 +23,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/crypto/secp256k1"
|
||||
)
|
||||
|
||||
// Tests whether a message can be wrapped without any identity or encryption.
|
||||
@ -72,8 +73,8 @@ func TestMessageCleartextSignRecover(t *testing.T) {
|
||||
if pubKey == nil {
|
||||
t.Fatalf("failed to recover public key")
|
||||
}
|
||||
p1 := elliptic.Marshal(crypto.S256(), key.PublicKey.X, key.PublicKey.Y)
|
||||
p2 := elliptic.Marshal(crypto.S256(), pubKey.X, pubKey.Y)
|
||||
p1 := elliptic.Marshal(secp256k1.S256(), key.PublicKey.X, key.PublicKey.Y)
|
||||
p2 := elliptic.Marshal(secp256k1.S256(), pubKey.X, pubKey.Y)
|
||||
if !bytes.Equal(p1, p2) {
|
||||
t.Fatalf("public key mismatch: have 0x%x, want 0x%x", p2, p1)
|
||||
}
|
||||
@ -150,8 +151,8 @@ func TestMessageFullCrypto(t *testing.T) {
|
||||
if pubKey == nil {
|
||||
t.Fatalf("failed to recover public key")
|
||||
}
|
||||
p1 := elliptic.Marshal(crypto.S256(), fromKey.PublicKey.X, fromKey.PublicKey.Y)
|
||||
p2 := elliptic.Marshal(crypto.S256(), pubKey.X, pubKey.Y)
|
||||
p1 := elliptic.Marshal(secp256k1.S256(), fromKey.PublicKey.X, fromKey.PublicKey.Y)
|
||||
p2 := elliptic.Marshal(secp256k1.S256(), pubKey.X, pubKey.Y)
|
||||
if !bytes.Equal(p1, p2) {
|
||||
t.Fatalf("public key mismatch: have 0x%x, want 0x%x", p2, p1)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user