bend-kit-crypto Releases (7): 0.2.2.2 0xcf01954bfd429a5caf3bc264b85d149c indexed https://jend.leeeet.dev/files.txt?path=bend-kit-crypto@0.2.2.2 0.2.2.1 0xf33eec520d9fe4851fd0d1e29eaf0166 unindexed https://jend.leeeet.dev/files.txt?path=bend-kit-crypto@0.2.2.1 0.2.2.0 0x5cbd5044421fb265537582ec6dc7941d unindexed https://jend.leeeet.dev/files.txt?path=bend-kit-crypto@0.2.2.0 0.2.1.0 0xe240e9c448c211c90c10fe25cb15dd3d unindexed https://jend.leeeet.dev/files.txt?path=bend-kit-crypto@0.2.1.0 0.2.0.0 0xb7adb62b01c81a958091ba348b41a7e3 unindexed https://jend.leeeet.dev/files.txt?path=bend-kit-crypto@0.2.0.0 0.1.1.0 0xfbc61a0d1aed5a9252de78ef4ae7a756 unindexed https://jend.leeeet.dev/files.txt?path=bend-kit-crypto@0.1.1.0 0.1.0.0 0xd0eff414f6867c5e43b15b33239e1b1e unindexed https://jend.leeeet.dev/files.txt?path=bend-kit-crypto@0.1.0.0 Definitions (18): Crypto.digest.words (https://jend.leeeet.dev/definition.txt?path=bend-kit-crypto@0.2.2.2/crypto.bend&name=digest.words) # alg is an OpenSSL digest name, such as "SHA256" or "SHA3-256". Fails with EINVAL for an unknown name. def digest.words(alg: String, len: U32, words: Array) -> IO(Result<&1, &1, U32 & String, U32 & Array>): Crypto.sha256.words (https://jend.leeeet.dev/definition.txt?path=bend-kit-crypto@0.2.2.2/crypto.bend&name=sha256.words) def sha256.words(len: U32, words: Array) -> IO(Result<&1, &1, U32 & String, U32 & Array>): Crypto.sha512.words (https://jend.leeeet.dev/definition.txt?path=bend-kit-crypto@0.2.2.2/crypto.bend&name=sha512.words) def sha512.words(len: U32, words: Array) -> IO(Result<&1, &1, U32 & String, U32 & Array>): Crypto.sha1.words (https://jend.leeeet.dev/definition.txt?path=bend-kit-crypto@0.2.2.2/crypto.bend&name=sha1.words) # Legacy: SHA-1 is broken for collisions. Use it only where a protocol needs it, such as the WebSocket handshake. def sha1.words(len: U32, words: Array) -> IO(Result<&1, &1, U32 & String, U32 & Array>): Crypto.hmac.words (https://jend.leeeet.dev/definition.txt?path=bend-kit-crypto@0.2.2.2/crypto.bend&name=hmac.words) # HMAC (RFC 2104) of data under key, with the digest alg. def hmac.words(alg: String, klen: U32, key: Array, dlen: U32, data: Array) -> IO(Result<&1, &1, U32 & String, U32 & Array>): Crypto.hkdf.words (https://jend.leeeet.dev/definition.txt?path=bend-kit-crypto@0.2.2.2/crypto.bend&name=hkdf.words) # HKDF (RFC 5869): n octets from ikm, salt, and info. Fails with EINVAL when n is 0 or more than 255 digest lengths. def hkdf.words(alg: String, slen: U32, salt: Array, klen: U32, ikm: Array, ilen: U32, info: Array, n: U32) -> IO(Result<&1, &1, U32 & String, U32 & Array>): Crypto.pbkdf2.words (https://jend.leeeet.dev/definition.txt?path=bend-kit-crypto@0.2.2.2/crypto.bend&name=pbkdf2.words) # PBKDF2 (RFC 8018 §5.2) with HMAC over alg: n octets from pass and salt. Fails with EINVAL when iters or n is 0. def pbkdf2.words(alg: String, plen: U32, pass: Array, slen: U32, salt: Array, iters: U32, n: U32) -> IO(Result<&1, &1, U32 & String, U32 & Array>): Crypto.scrypt.words (https://jend.leeeet.dev/definition.txt?path=bend-kit-crypto@0.2.2.2/crypto.bend&name=scrypt.words) # Scrypt (RFC 7914): N >= 2 is a power of two; r and p are positive. # maxmem bounds the scrypt workspace plus output in octets; zero or over-budget costs fail with EINVAL. def scrypt.words(plen: U32, pass: Array, slen: U32, salt: Array, N: U32, r: U32, p: U32, maxmem: U32, n: U32) -> IO(Result<&1, &1, U32 & String, U32 & Array>): Crypto.random.words (https://jend.leeeet.dev/definition.txt?path=bend-kit-crypto@0.2.2.2/crypto.bend&name=random.words) # n octets from the OS secure random source (getentropy, crypto.getRandomValues). Needs no libcrypto. def random.words(n: U32) -> IO(Result<&1, &1, U32 & String, U32 & Array>): Crypto.eq.ct.words (https://jend.leeeet.dev/definition.txt?path=bend-kit-crypto@0.2.2.2/crypto.bend&name=eq.ct.words) # Equal octets, in time that depends only on the lengths. Use it to compare MACs. def eq.ct.words(alen: U32, a: Array, blen: U32, b: Array) -> IO(Bool): Crypto.rsa.sign.words (https://jend.leeeet.dev/definition.txt?path=bend-kit-crypto@0.2.2.2/crypto.bend&name=rsa.sign.words) # RSASSA-PKCS1-v1_5 (RS256, RS384, RS512): alg is "SHA256", "SHA384", or "SHA512". Gives a modulus-length signature. def rsa.sign.words(alg: String, klen: U32, key: Array, dlen: U32, data: Array) -> IO(Result<&1, &1, U32 & String, U32 & Array>): Crypto.rsa.verify.words (https://jend.leeeet.dev/definition.txt?path=bend-kit-crypto@0.2.2.2/crypto.bend&name=rsa.verify.words) def rsa.verify.words(alg: String, klen: U32, key: Array, dlen: U32, data: Array, slen: U32, sig: Array) -> IO(Result<&1, &1, U32 & String, Bool>): Crypto.rsa.verify.jwk.words (https://jend.leeeet.dev/definition.txt?path=bend-kit-crypto@0.2.2.2/crypto.bend&name=rsa.verify.jwk.words) # n and e of a JWK "RSA" key. e must be odd and at least 3. def rsa.verify.jwk.words(alg: String, nlen: U32, n: Array, elen: U32, e: Array, dlen: U32, data: Array, slen: U32, sig: Array) -> IO(Result<&1, &1, U32 & String, Bool>): Crypto.ecdsa.sign.words (https://jend.leeeet.dev/definition.txt?path=bend-kit-crypto@0.2.2.2/crypto.bend&name=ecdsa.sign.words) # ECDSA on P-256 (ES256): alg is "SHA256". Signatures are JOSE raw r || s, 64 octets (RFC 7518 §3.4), not DER. def ecdsa.sign.words(alg: String, klen: U32, key: Array, dlen: U32, data: Array) -> IO(Result<&1, &1, U32 & String, U32 & Array>): Crypto.ecdsa.verify.words (https://jend.leeeet.dev/definition.txt?path=bend-kit-crypto@0.2.2.2/crypto.bend&name=ecdsa.verify.words) def ecdsa.verify.words(alg: String, klen: U32, key: Array, dlen: U32, data: Array, slen: U32, sig: Array) -> IO(Result<&1, &1, U32 & String, Bool>): Crypto.ecdsa.verify.jwk.words (https://jend.leeeet.dev/definition.txt?path=bend-kit-crypto@0.2.2.2/crypto.bend&name=ecdsa.verify.jwk.words) # x and y of a JWK "EC" key on "P-256", 32 octets each. def ecdsa.verify.jwk.words(alg: String, xlen: U32, x: Array, ylen: U32, y: Array, dlen: U32, data: Array, slen: U32, sig: Array) -> IO(Result<&1, &1, U32 & String, Bool>): Crypto.aead.seal.words (https://jend.leeeet.dev/definition.txt?path=bend-kit-crypto@0.2.2.2/crypto.bend&name=aead.seal.words) # AEAD: alg is "AES-256-GCM" or "CHACHA20-POLY1305". Key: 32 octets; nonce: 12 octets. # Seal returns ciphertext followed by a 16-octet tag; open verifies the tag before returning plaintext. # Never reuse a (key, nonce) pair. Bad lengths, algorithm or authentication fail with EINVAL. def aead.seal.words(alg: String, klen: U32, key: Array, nlen: U32, nonce: Array, alen: U32, aad: Array, dlen: U32, data: Array) -> IO(Result<&1, &1, U32 & String, U32 & Array>): Crypto.aead.open.words (https://jend.leeeet.dev/definition.txt?path=bend-kit-crypto@0.2.2.2/crypto.bend&name=aead.open.words) def aead.open.words(alg: String, klen: U32, key: Array, nlen: U32, nonce: Array, alen: U32, aad: Array, dlen: U32, data: Array) -> IO(Result<&1, &1, U32 & String, U32 & Array>):