sonr/crypto/sharing/v1/ed25519curve_test.go
Prad Nukala 807b2e86ec
feature/1220 origin handle exists method (#1241)
* feat: add docs and CI workflow for publishing to onsonr.dev

* (refactor): Move hway,motr executables to their own repos

* feat: simplify devnet and testnet configurations

* refactor: update import path for didcrypto package

* docs(networks): Add README with project overview, architecture, and community links

* refactor: Move network configurations to deploy directory

* build: update golang version to 1.23

* refactor: move logger interface to appropriate package

* refactor: Move devnet configuration to networks/devnet

* chore: improve release process with date variable

* (chore): Move Crypto Library

* refactor: improve code structure and readability in DID module

* feat: integrate Trunk CI checks

* ci: optimize CI workflow by removing redundant build jobs

---------

Co-authored-by: Darp Alakun <i@prad.nu>
2025-01-06 17:06:10 +00:00

27 lines
772 B
Go
Executable File

//
// Copyright Coinbase, Inc. All Rights Reserved.
//
// SPDX-License-Identifier: Apache-2.0
//
package v1
import (
"math/big"
"testing"
"github.com/stretchr/testify/require"
)
func TestEd25519ScalarMult(t *testing.T) {
// These values were caught during testing where this combination
// yields leading zeros in which big.Int chops.
// This test makes sure that this case is correctly handled
y := new(big.Int).SetBytes([]byte{37, 228, 49, 105, 78, 97, 108, 221, 63, 25, 125, 212, 108, 189, 247, 169, 52, 86, 150, 97, 93, 199, 212, 254, 122, 98, 189, 7, 97, 14, 78, 12})
x := new(big.Int).SetInt64(4)
curve := Ed25519()
require.True(t, curve.IsOnCurve(nil, y))
_, newY := curve.ScalarMult(nil, y, x.Bytes())
require.True(t, curve.IsOnCurve(nil, newY))
}