CLAUDE.md raw

Claude Code Instructions for p256k1

Project Overview

Pure Go implementation of secp256k1 elliptic curve cryptography. No cgo, no external dependencies.

Project Structure

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

Key Files

Build Tags

Testing

go test ./...                    # Run all tests
go test -bench=. .               # Run benchmarks
go test -run TestSchnorr .       # Run specific tests

Performance Considerations

Domain Packages

The domain packages (ecdsa/, schnorr/, keys/, exchange/) are thin wrappers around the core p256k1 package. They:

Conventions