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.
hmac_sha256 in Python
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 Python
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.
constant_time_equal in Python
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.
pbkdf2_sha256 in Python
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: utf8_encode, utf8_decode
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: hash_password, verify_password, password_needs_rehash
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: hex_encode, hex_decode
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 Python
1.0.0
py rs ts
16 tests
money.amount
A currency-tagged monetary amount held in integer minor units.
money in Python
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 Python
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: compare_money, min_money, max_money, clamp_money
2.0.0
py rs ts
39 tests
money.add
Add, subtract and negate monetary amounts, refusing to mix currencies.
add_money in Python
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.
convert_money in Python
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.
climate_change_levy in Python
1.0.2
py rs ts
20 tests
math.big-integer
Exact integer arithmetic of any size, on decimal strings, for powers and products that overflow 64 bits.
calculate_big_integer in Python
1.0.0
py rs ts
24 tests
math.clamp
Clamp an integer to an inclusive range, refusing a range whose bounds are the wrong way round.
clamp in Python
1.0.0
py rs ts
12 tests
construction.cis-deduction
Construction Industry Scheme deduction (0, 20 or 30%) on the labour part of a subcontractor payment.
cis_deduction in Python
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.
currency_digits in Python
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.
fractional_power in Python
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.
validate_lei in Python
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.
round_div in Python
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.
fifo_valuation in Python
1.0.0
py rs ts
18 tests