Replaced legacy `*.orly` module imports with `next.orly.dev/pkg` paths across the codebase for consistency. Removed legacy `go.mod` files from sub-packages, consolidating dependency management. Added Dockerfiles and configurations for benchmarking environments.
33 lines
756 B
Go
33 lines
756 B
Go
// Copyright (c) 2015-2016 The btcsuite developers
|
|
// Use of this source code is governed by an ISC
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package btcec
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"next.orly.dev/pkg/utils"
|
|
)
|
|
|
|
func TestGenerateSharedSecret(t *testing.T) {
|
|
privKey1, err := NewSecretKey()
|
|
if err != nil {
|
|
t.Errorf("secret key generation error: %s", err)
|
|
return
|
|
}
|
|
privKey2, err := NewSecretKey()
|
|
if err != nil {
|
|
t.Errorf("secret key generation error: %s", err)
|
|
return
|
|
}
|
|
secret1 := GenerateSharedSecret(privKey1, privKey2.PubKey())
|
|
secret2 := GenerateSharedSecret(privKey2, privKey1.PubKey())
|
|
if !utils.FastEqual(secret1, secret2) {
|
|
t.Errorf(
|
|
"ECDH failed, secrets mismatch - first: %x, second: %x",
|
|
secret1, secret2,
|
|
)
|
|
}
|
|
}
|