justinwongcn/moonpgp/primitives does not have a README file
pub(open) trait BlockCipher {
fn block_size(Self) -> Int
fn encrypt_block(Self, BytesView) -> Bytes
fn decrypt_block(Self, BytesView) -> Bytes
fn wipe(Self) -> Unit
}let ARGON2_MAX_MEMORY_KIB : Intlet DEFAULT_ARGON2_MAX_MEMORY_KIB : Intfn argon2id(pass : BytesView, salt : BytesView, passes : Int, m_kib : Int, parallelism : Int, tag_len : Int, max_memory_kib? : Int) -> Bytes raisetest {
let tag = @primitives.argon2id(b"password", b"somesalt", 1, 64, 1, 24)
inspect(
@primitives.to_hex(tag),
content="655ad15eac652dc59f7170a7332bf49b8469be1fdb9c28bb",
)
}fn argon2id_with_secret_ad(pass : BytesView, salt : BytesView, secret : BytesView, ad : BytesView, passes : Int, m_kib : Int, parallelism : Int, tag_len : Int, max_memory_kib? : Int) -> Bytes raisefn blake2b(data : BytesView, out_len : Int) -> Bytes raisetest {
let digest = @primitives.blake2b(b"abc", 64)
inspect(
@primitives.to_hex(digest),
content=(
#|ba80a53f981c4d0d6a2797b69f12f6e94c212f14685ac4b74b12bb6fdbffa2d17d87c5392aab792dc252d5de4533cc9518d38aa8dbf1925ab92386edd4009923
),
)
}fn concat3(a : BytesView, b : BytesView, c : BytesView) -> Bytesfn concat4(a : BytesView, b : BytesView, c : BytesView, d : BytesView) -> Bytesfn ct_equal(a : BytesView, b : BytesView) -> Boolfn hkdf_sha256(ikm : BytesView, salt : BytesView, info : BytesView, out_len : Int) -> Bytes raisetest {
let ikm = @primitives.from_hex("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b")
let okm = @primitives.hkdf_sha256(
ikm,
@primitives.from_hex("000102030405060708090a0b0c"),
@primitives.from_hex("f0f1f2f3f4f5f6f7f8f9"),
42,
)
inspect(
@primitives.to_hex(okm),
content=(
#|3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865
),
)
}fn pad_left(data : BytesView, size : Int) -> Bytesfn pad_right(data : BytesView, size : Int) -> Bytesfn random_below(max : Int) -> Int raisefn random_bytes(n : Int) -> Bytes raisefn to_hex(data : BytesView) -> Stringfn utf8_bytes(s : String) -> Bytesfn xor_bytes(a : BytesView, b : BytesView) -> Bytes raiseInstall
Download zipPure-MoonBit OpenPGP implementation (RFC 4880/9580): email encryption, decryption, signing and verification, interoperable with GnuPG and gopenpgp.