debug

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package debug provides deterministic operations for testing and debugging.

This package implements the same debug mode functionality as the C++ version, allowing for deterministic secret generation, polynomial coefficients, and ephemeral keys to enable cross-language compatibility testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DebugLog

func DebugLog(message string)

DebugLog prints a debug message if debug mode is enabled

func GetDeterministicBaseAuthCode

func GetDeterministicBaseAuthCode() string

GetDeterministicBaseAuthCode returns a fixed base auth code for deterministic testing

func GetDeterministicEphemeralSecret

func GetDeterministicEphemeralSecret() []byte

GetDeterministicEphemeralSecret returns a fixed ephemeral secret for reproducible Noise handshakes

func GetDeterministicMainSecret

func GetDeterministicMainSecret() *big.Int

GetDeterministicMainSecret returns a large deterministic scalar for the main secret r This is a fixed large value that properly exercises the cryptographic operations

func GetDeterministicPolynomialCoefficient

func GetDeterministicPolynomialCoefficient() *big.Int

GetDeterministicPolynomialCoefficient returns deterministic polynomial coefficients These should be sequential: 1, 2, 3, ... for reproducible Shamir secret sharing

func GetDeterministicRandomBytes

func GetDeterministicRandomBytes(length int) []byte

GetDeterministicRandomBytes returns deterministic bytes for testing

func GetDeterministicRandomScalar

func GetDeterministicRandomScalar() *big.Int

GetDeterministicRandomScalar returns a deterministic scalar for testing In debug mode, the main secret r should always be 1

func GetDeterministicSecret

func GetDeterministicSecret() *big.Int

GetDeterministicSecret returns the same value as the main secret for consistency

func IsDebugModeEnabled

func IsDebugModeEnabled() bool

IsDebugModeEnabled returns whether debug mode is currently enabled

func SecureRandom

func SecureRandom(max *big.Int) (*big.Int, error)

SecureRandom provides either deterministic or cryptographically secure random generation This is the main function that should be used throughout the codebase for random number generation

func SecureRandomCoefficient

func SecureRandomCoefficient(max *big.Int) (*big.Int, error)

SecureRandomCoefficient provides deterministic or secure random coefficients for Shamir secret sharing

func SetDebugMode

func SetDebugMode(enabled bool)

SetDebugMode enables or disables debug mode for deterministic operations

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL