Pure Go implementation of secp256k1 elliptic curve cryptography. No cgo, no external dependencies.
p256k1/
├── *.go # Core implementation (field, scalar, group, signatures)
├── *_amd64.go # AMD64-specific optimizations
├── *_amd64.s # AMD64 assembly
├── *_32bit.go # 32-bit fallbacks
├── *_wasm.go # WebAssembly support
├── *_generic.go # Generic fallbacks
│
├── ecdsa/ # ECDSA domain package
├── schnorr/ # Schnorr/BIP-340 domain package
├── keys/ # Key management domain package
├── exchange/ # ECDH domain package
├── signer/ # High-level signer abstraction
│
├── avx/ # Experimental AVX2 optimizations
├── wnaf/ # wNAF encoding utilities
├── bench/ # Benchmarking tools
├── testdata/ # Test vectors
└── docs/ # Technical documentation
field.go, field_mul.go, field_4x64.go - Field arithmetic (F_p)scalar.go - Scalar arithmetic (mod group order)group.go, group_4x64.go - Point operationsecdsa.go - ECDSA implementationschnorr.go, schnorr_batch.go - Schnorr signaturesecdh.go - ECDH key exchangehash.go - SHA-256, HMAC, RFC6979verify.go - Combined verification with Strauss algorithmecmult_gen.go - Generator multiplication with precomputed tables//go:build !amd64 - 32-bit/generic fallback//go:build wasm - WebAssembly buildgo test ./... # Run all tests
go test -bench=. . # Run benchmarks
go test -run TestSchnorr . # Run specific tests
The domain packages (ecdsa/, schnorr/, keys/, exchange/) are thin wrappers around the core p256k1 package. They:
*Raw variants for functions that can write to caller-provided buffers*_test.go naming