mirror of
https://github.com/hanzoai/commerce.git
synced 2026-10-30 15:08:42 +00:00
Multi-tenant commerce and billing: orders, subscriptions, invoices, plans, usage metering and a credit ledger. One Go binary. MIT OR Apache-2.0. Claude-Session: https://claude.ai/code/session_01SAtaDFm8VDiWrhYHNNtxMw
32 lines
731 B
Go
32 lines
731 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 (
|
|
"bytes"
|
|
"testing"
|
|
)
|
|
|
|
func TestGenerateSharedSecret(t *testing.T) {
|
|
privKey1, err := NewPrivateKey()
|
|
if err != nil {
|
|
t.Errorf("private key generation error: %s", err)
|
|
return
|
|
}
|
|
privKey2, err := NewPrivateKey()
|
|
if err != nil {
|
|
t.Errorf("private key generation error: %s", err)
|
|
return
|
|
}
|
|
|
|
secret1 := GenerateSharedSecret(privKey1, privKey2.PubKey())
|
|
secret2 := GenerateSharedSecret(privKey2, privKey1.PubKey())
|
|
|
|
if !bytes.Equal(secret1, secret2) {
|
|
t.Errorf("ECDH failed, secrets mismatch - first: %x, second: %x",
|
|
secret1, secret2)
|
|
}
|
|
}
|