Hasty Briefsbeta

Bilingual

Show HN: I made a zero dependency Bitcoin math implementation in C

a year ago
  • #Cryptography
  • #Bitcoin
  • #C Programming
  • Bitcoin_math project is a zero-dependency C implementation for learning Bitcoin math basics.
  • Uses standard C libraries only, prioritizing readability over efficiency.
  • Generates mnemonic phrases, seeds, keys, and addresses using cryptographic functions.
  • Supports arbitrary precision integer math, elliptic curve math, and radix conversions.
  • Compiles with gcc on Windows and Linux (with -lm flag on Linux).
  • Features four main menus: Master keys, Child keys, Base converter, and Functions.
  • Master keys generate private keys, chain codes, and public keys from entropy.
  • Child keys derive child keys from parent keys and chain codes.
  • Base converter supports radix conversion between bases 2 to 64.
  • Functions menu includes P2PKH serialization and Secp256k1 operations.
  • Uses third-party cryptographic hash functions (RIPEMD160, SHA256, SHA512, HMAC-SHA512).
  • Arbitrary precision integer math inspired by GMP and BigDigits libraries.
  • Elliptic curve algorithms adapted from academic paper and Wikipedia pseudocode.
  • Source code organized into sections: hash functions, integer math, elliptic curve, Bitcoin functions, and menus.