Skip to content

Implement all algorithms #1

Description

@alex

Hash functions

  • Hashes
    • Algorithms
      • MD5
      • SHA-1
      • SHA-224
      • SHA-256
      • SHA-384
      • SHA-512
      • SHA-512/224
      • SHA-512/256
      • SHA3-224
      • SHA3-256
      • SHA3-384
      • SHA3-512
      • BLAKE2b-512
      • BLAKE2s-256
      • SM3
    • Operations
      • init() -> ctx
      • update(ctx, data)
      • copy(ctx) -> ctx
      • finalize(ctx) -> digest
  • Extendable-output functions
    • Algorithms
      • SHAKE128
      • SHAKE256
    • Operations
      • init() -> ctx
      • update(ctx, data)
      • copy(ctx) -> ctx
      • finalize(ctx, length) -> bytes
      • squeeze(ctx, n) -> bytes

Message authentication codes

  • HMAC-{hash}
    • init(key) -> ctx
    • update(ctx, data)
    • copy(ctx) -> ctx
    • finalize(ctx) -> tag
  • CMAC
    • Algorithms
      • AES-CMAC
      • 3DES-CMAC
    • Operations
      • init(key) -> ctx
      • update(ctx, data)
      • copy(ctx) -> ctx
      • finalize(ctx) -> tag
  • Poly1305
    • init(key) -> ctx
    • update(ctx, data)
    • finalize(ctx) -> tag

Block ciphers

  • ECB mode
    • Algorithms
      • AES-ECB
      • 3DES-ECB
      • Camellia-ECB
      • SM4-ECB
      • Blowfish-ECB
      • CAST5-ECB
      • IDEA-ECB
      • SEED-ECB
    • Operations
      • init(key, direction) -> ctx
      • update(ctx, data) -> bytes
      • finalize(ctx) -> bytes
  • IV-based modes
    • Algorithms
      • AES-CBC
      • AES-OFB
      • AES-CFB128
      • AES-CFB8
      • 3DES-CBC
      • 3DES-OFB
      • 3DES-CFB64
      • 3DES-CFB8
      • DES-CBC
      • Camellia-CBC
      • Camellia-OFB
      • Camellia-CFB128
      • SM4-CBC
      • SM4-OFB
      • SM4-CFB128
      • Blowfish-CBC
      • Blowfish-OFB
      • Blowfish-CFB64
      • CAST5-CBC
      • CAST5-OFB
      • CAST5-CFB64
      • IDEA-CBC
      • IDEA-OFB
      • IDEA-CFB64
      • SEED-CBC
      • SEED-OFB
      • SEED-CFB128
      • RC2-CBC
    • Operations
      • init(key, iv, direction) -> ctx
      • update(ctx, data) -> bytes
      • finalize(ctx) -> bytes
  • CTR mode
    • Algorithms
      • AES-CTR
      • SM4-CTR
    • Operations
      • init(key, nonce) -> ctx
      • update(ctx, data) -> bytes
      • finalize(ctx) -> bytes
      • reset_nonce(ctx, nonce)
  • AES-XTS
    • init(key, tweak, direction) -> ctx
    • update(ctx, data) -> bytes
    • finalize(ctx) -> bytes

Stream ciphers

  • ChaCha20
    • init(key, nonce) -> ctx
    • update(ctx, data) -> bytes
    • reset_nonce(ctx, nonce)
  • RC4
    • init(key) -> ctx
    • update(ctx, data) -> bytes

Authenticated encryption

  • Streaming GCM
    • Algorithms
      • AES-GCM
      • SM4-GCM
    • Operations
      • init(key, iv, direction) -> ctx
      • update_aad(ctx, aad)
      • update(ctx, data) -> bytes
      • set_tag(ctx, tag)
      • finalize(ctx) -> bytes
      • get_tag(ctx) -> tag
  • One-shot AEADs
    • Algorithms
      • AES-GCM
      • AES-GCM-SIV
      • ChaCha20-Poly1305
    • Operations
      • init(key) -> ctx
      • encrypt(ctx, nonce, aad, plaintext) -> ciphertext
      • decrypt(ctx, nonce, aad, ciphertext) -> plaintext
  • One-shot AEADs with configurable tag length
    • Algorithms
      • AES-CCM
      • AES-OCB3
    • Operations
      • init(key, tag_length) -> ctx
      • encrypt(ctx, nonce, aad, plaintext) -> ciphertext
      • decrypt(ctx, nonce, aad, ciphertext) -> plaintext
  • AES-SIV
    • init(key) -> ctx
    • encrypt(ctx, nonce, [aad], plaintext) -> ciphertext
    • decrypt(ctx, nonce, [aad], ciphertext) -> plaintext

Password-based key derivation

  • PBKDF2-HMAC-{hash}
    • derive(password, salt, iterations, length) -> key
  • scrypt
    • derive(password, salt, n, r, p, max_memory, length) -> key
  • Argon2
    • Algorithms
      • Argon2d
      • Argon2i
      • Argon2id
    • Operations
      • derive(password, salt, iterations, memory_cost, lanes, threads, secret, associated_data, length) -> key

RSA

  • RSA keys
    • generate(bits, public_exponent) -> private_key
    • from_components(n, e) -> public_key
    • from_components(n, e, d, p, q, dmp1, dmq1, iqmp) -> private_key
    • to_components(key) -> (n, e, [d, p, q, dmp1, dmq1, iqmp])
  • RSASSA-PKCS1-v1_5
    • sign(private_key, digest, hash) -> signature
    • verify(public_key, signature, digest, hash) -> bool
    • recover(public_key, signature, hash) -> data
  • RSASSA-PSS
    • sign(private_key, digest, hash, mgf1_hash, salt_length) -> signature
    • verify(public_key, signature, digest, hash, mgf1_hash, salt_length) -> bool
  • RSAES-PKCS1-v1_5
    • encrypt(public_key, plaintext) -> ciphertext
    • decrypt(private_key, ciphertext) -> plaintext
  • RSAES-OAEP
    • encrypt(public_key, plaintext, hash, mgf1_hash, label) -> ciphertext
    • decrypt(private_key, ciphertext, hash, mgf1_hash, label) -> plaintext

Elliptic curves

  • EC keys
    • Algorithms
      • P-192
      • P-224
      • P-256
      • P-384
      • P-521
      • secp256k1
      • brainpoolP256r1
      • brainpoolP384r1
      • brainpoolP512r1
    • Operations
      • generate(curve) -> private_key
      • from_private_scalar(curve, d) -> private_key
      • from_components(curve, d, x, y) -> private_key
      • from_encoded_point(curve, bytes) -> public_key
      • encode_point(public_key, compressed) -> bytes
      • to_components(key) -> (x, y, [d])
  • ECDSA
    • sign(private_key, digest) -> signature
    • sign_deterministic(private_key, digest, hash) -> signature
    • verify(public_key, signature, digest) -> bool
  • ECDH
    • exchange(private_key, peer_public_key) -> shared_secret

Edwards and Montgomery curves

  • EdDSA
    • Algorithms
      • Ed25519
      • Ed448
    • Operations
      • generate() -> private_key
      • from_private_bytes(bytes) -> private_key
      • from_public_bytes(bytes) -> public_key
      • private_bytes(private_key) -> bytes
      • public_bytes(public_key) -> bytes
      • sign(private_key, message) -> signature
      • verify(public_key, signature, message) -> bool
  • Montgomery key exchange
    • Algorithms
      • X25519
      • X448
    • Operations
      • generate() -> private_key
      • from_private_bytes(bytes) -> private_key
      • from_public_bytes(bytes) -> public_key
      • private_bytes(private_key) -> bytes
      • public_bytes(public_key) -> bytes
      • exchange(private_key, peer_public_key) -> shared_secret

Finite-field Diffie-Hellman

  • DH
    • generate_parameters(bits, generator) -> params
    • parameters_from(p, g, [q]) -> params
    • generate(params) -> private_key
    • from_components(params, y, [x]) -> key
    • to_components(key) -> (p, g, [q], y, [x])
    • exchange(private_key, peer_public_key) -> shared_secret

DSA

  • DSA
    • generate_parameters(bits) -> params
    • generate(params) -> private_key
    • from_components(p, q, g, y, [x]) -> key
    • to_components(key) -> (p, q, g, y, [x])
    • sign(private_key, digest) -> signature
    • verify(public_key, signature, digest) -> bool

ML-KEM

  • ML-KEM
    • Algorithms
      • ML-KEM-768
      • ML-KEM-1024
    • Operations
      • from_seed(seed) -> private_key
      • seed(private_key) -> bytes
      • from_public_bytes(bytes) -> public_key
      • public_bytes(public_key) -> bytes
      • encapsulate(public_key) -> (ciphertext, shared_secret)
      • decapsulate(private_key, ciphertext) -> shared_secret

ML-DSA

  • ML-DSA
    • Algorithms
      • ML-DSA-44
      • ML-DSA-65
      • ML-DSA-87
    • Operations
      • from_seed(seed) -> private_key
      • seed(private_key) -> bytes
      • from_public_bytes(bytes) -> public_key
      • public_bytes(public_key) -> bytes
      • sign(private_key, message, context) -> signature
      • verify(public_key, signature, message, context) -> bool
      • sign_mu(private_key, mu) -> signature
      • verify_mu(public_key, signature, mu) -> bool

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions