crypto.hmac-sha256
HMAC-SHA256 of a message under a secret key (RFC 2104, RFC 4231), in pure code that also runs in the browser.
hmacSha256 in TypeScript
1.0.0
py rs ts
13 tests
crypto.sha256
The SHA-256 digest of a byte string (FIPS 180-4), in pure code that also runs in the browser.
sha256 in TypeScript
1.0.0
py rs ts
13 tests
crypto.constant-time-equal
Compare two byte strings in time that does not depend on where they differ, for checking MACs and hashes.
constantTimeEqual in TypeScript
1.0.0
py rs ts
12 tests
crypto.pbkdf2-sha256
PBKDF2 with HMAC-SHA256 (RFC 8018): derive a key from a password and salt, slowly, fast enough for a login request.
pbkdf2Sha256 in TypeScript
1.0.0
py rs ts
14 tests
encoding.utf8
Text to UTF-8 bytes and strictly back (RFC 3629), so hashing and signing see the same bytes in every language.
A group of 2: utf8Encode, utf8Decode
1.0.0
py rs ts
25 tests
auth.password-hash
Hash a password for storage as pbkdf2_sha256$iterations$salt$hash, verify one in constant time, and spot weak hashes.
A group of 3: hashPassword, verifyPassword, passwordNeedsRehash
1.0.0
py rs ts
36 tests
encoding.hex
Bytes to lowercase hexadecimal text and back (RFC 4648 base16), strictly, identically in every language.
A group of 2: hexEncode, hexDecode
1.0.0
py rs ts
25 tests
math.pow
base to the power exponent from + - * / only, exact by squaring for whole exponents, identical in every language.
pow in TypeScript
1.0.0
py rs ts
16 tests
money.amount
A currency-tagged monetary amount held in integer minor units.
money in TypeScript
1.0.2
py rs ts
17 tests
math.exp
e to the power x from + - * / only, so TypeScript, Python and Rust return the same double for the same input.
exp in TypeScript
1.0.1
py rs ts
10 tests
money.compare
Compare two amounts of one currency, refusing to compare across currencies; min, max and clamp too.
A group of 4: compareMoney, minMoney, maxMoney, clampMoney
2.0.0
py rs ts
39 tests
money.add
Add, subtract and negate monetary amounts, refusing to mix currencies.
addMoney in TypeScript
1.0.1
py rs ts
12 tests
money.convert
Convert an amount to another currency at a supplied exact rate, with an explicit rounding mode.
convertMoney in TypeScript
1.0.0
py rs ts
19 tests
energy.climate-change-levy
Climate Change Levy on a business supply of electricity, gas, LPG or solid fuel, at the main rate in force on the date.
climateChangeLevy in TypeScript
1.0.2
py rs ts
20 tests
math.clamp
Clamp an integer to an inclusive range, refusing a range whose bounds are the wrong way round.
clamp in TypeScript
1.0.0
py rs ts
12 tests
math.big-integer
Exact integer arithmetic of any size, on decimal strings, for powers and products that overflow 64 bits.
calculateBigInteger in TypeScript
1.0.0
py rs ts
24 tests
construction.cis-deduction
Construction Industry Scheme deduction (0, 20 or 30%) on the labour part of a subcontractor payment.
cisDeduction in TypeScript
1.0.2
py rs ts
24 tests
money.currency-digits
How many decimal places a currency's minor unit has, from the ISO 4217 list.
currencyDigits in TypeScript
1.0.0
py rs ts
14 tests
math.fractional-power
Raise a positive decimal to a fractional power, (1.199)^(31/365), identically in every language.
fractionalPower in TypeScript
1.0.0
py rs ts
19 tests
validation.lei
Check a 20-character Legal Entity Identifier against its ISO 17442 / ISO 7064 MOD 97-10 check digits.
validateLei in TypeScript
1.0.0
py rs ts
14 tests
math.round-div
Integer division with an explicit rounding mode, for money arithmetic that must not drift.
roundDiv in TypeScript
1.0.0
py rs ts
14 tests
inventory.valuation-fifo
FIFO stock valuation and cost of sales from a stock movement ledger, in exact money.
fifoValuation in TypeScript
1.0.0
py rs ts
18 tests