charcoal-dev/gmp-adapter

Provides BigInteger class to Charcoal Apps

0.1.1 2025-09-03 10:49 UTC

This package is auto-updated.

Last update: 2025-09-03 10:50:31 UTC


README

MIT License

The GMP lib is a thin, pragmatic wrapper around PHP’s ext-gmp, giving you a familiar BigInteger-style API plus clean byte conversions. It standardizes import/export via gmp_import()/gmp_export() with explicit ByteOrder handling (big/little), fixed-width padding, and constant-time equals() for sensitive paths. The companion GmpByte enum captures common widths (8/16/32/64) and provides tight pack/unpack helpers for U64 using GMP, mirroring the Buffers’ U8/U16/U32 routines. Together they let you move between integers and raw bytes without surprises—no hidden endianness, no accidental truncation, and no dependency leakage into the Buffers layer.

For detailed information, guidance, and setup instructions regarding this library, please refer to our official documentation website:

https://charcoal.dev/lib/gmp-adapter