Skip to content

bstnbuck/V-crypto

Repository files navigation

V-crypto 🔑

Attention!
V-crypto has no connection to the official V community and is not maintained by it.
→ It is not recommended to use the algorithms implemented here productively until the status is implemented. As a non-cryptographer, I cannot fully validate the security.

Contributions welcome!


V-crypto provides...

  • a detailed overview of important cryptographic algorithms, protocols and formats,
  • the current implementation status of the official V community.
  • less known but relevant as well as self-developed official algorithms that might be published here.

Cryptographic algorithms and protocols available in V standard library

algorithm category, info importance status
AES symmetric block cipher high, daily use implemented ✔️ [Git]
bcrypt hash-algorithm high implemented ✔️ [Git]
blake2(b,s) hash-algorithm moderate implemented ✔️ [Git] [Git]
blake3 hash-algorithm moderate implemented ✔️ [Git]
blowfish legacy symmetric block cipher moderate implemented ✔️ [Git]
blockcipher modesCBC, CFB, CTR, OFB Cipher-Block-Chaining, Cipher-Feedback, Counter, Output-Feedback high implemented ✔️ [Git]
(3)DES legacy symmetric block cipher low implemented ✔️ [Git]
ECDSA signature algorithm based on elliptic curves high, daily use OpenSSL C Wrapper 🟡 [Git]
Ed25519 signature algorithm based on elliptic curves high implemented ✔️ [Git]
HMAC hash-based message authentication code high implemented ✔️ [Git]
MD5 legacy hash-algorithm high implemented ✔️ [Git]
PBKDF2 key derivation function high implemented ✔️ [Git]
PEM encoding format high implemented ✔️ [Git]
RAND random number generator high, daily use implemented ✔️ [Git]
RC4 legacy stream cipher low implemented ✔️ [Git]
RIPEMD160 legacy hash-algorithm moderate implemented ✔️ [Git]
scrypt hash-algorithm / key derivation function high implemented ✔️ [Git]
SHA1 legacy hash-algorithm moderate implemented ✔️ [Git]
SHA256 hash-algorithm high, daily use implemented ✔️ [Git]
SHA512 hash-algorithm high, daily use implemented ✔️ [Git]
SHA3 hash-algorithm moderate implemented ✔️ [Git]
Ascon lightweight AEAD moderate experimental 🟡 [Git]
ChaCha20 symmetric stream cipher high, daily use experimental 🟡 [Git]
ChaCha20-Poly1305 Authenticated encryption with associated data (AEAD) high, daily use experimental 🟡 [Git]
Curve25519 elliptic curve high, daily use expiremental 🟡 [Git]
Poly1305 message authentication code moderate experimental 🟡 [Git]
SLH-DSA post-quantum secure signature algorithm (aka. SPHINCS+; hash based) moderate experimental 🟡 [Git]
SM4 block cipher moderate experimental 🟡 [Git]

Last Update: 01-06-2025

Cryptographic algorithms and protocols (not officially) planned for V standard library

The V wrapper libsodium [Git] has some of these algorithms.

algorithm category, info importance status
blockcipher modesXTS, CCM, GCM XEX-based tweaked-codebook mode with ciphertext stealing, Counter with CBC-MAC (AEAD), Galois/Counter (AEAD) high thirdparty ❌ [Git]
Curve448 elliptic curve high thirdparty 🟡 [Git]
DSA legacy signature algorithm low (see [1]) ❌
ECDH asymmetric crypto based on elliptic curves high, daily use (see [1], [2]), thirdparty, non standard ❌ [Git]
Ed448 signature algorithm based on elliptic curves high
HKDF key derivation function moderate thirdparty ❌ [Git]
HQC post-quantum secure key encapsulation (code based) moderate
ML-KEM post-quantum secure key encapsulation (aka. Crystals Kyber; lattice based) high
ML-DSA post-quantum secure digital signature (aka. Crystals Dilithium; lattice based) high
P-224/256/384/(521) elliptic curves (NIST) high, daily use
secp256k1 elliptic curve moderate thirdparty, non standard ❌ [Git]
RSA asymmetric crypto high, daily use (see [1]), thirdparty, non standard ❌ [Git]
SSH network protocol high, daily use (see [2]) ❌
TLS protocol for secure network communication high, daily use (see [2]), wrapper, thirdparty 🟡 [Git] [Git]
x509 encoding format high wrapper, thirdparty 🟡 [Git]

Last Update: 06-02-2026

Additional cryptographic algorithms implemented/planned in V-crypto (this Repo)

The V wrapper libsodium [Git] has some of these algorithms.

algorithm category, info importance status
argon2 hash-algorithm / key derivation function high
blockcipher modes → ECB, EAX, IGE, OCB Electronic-Codebook, encrypt-then-authenticate-then-translate, Infinite Garble Extension, Offset codebook mode (AEAD) moderate experimental (only ECB, IGE) 🟡 [Git]
brainpoolP(256,384,521)r1 elliptic curve high
Camellia symmetric block cipher low
CAST symmetric block cipher moderate
Grain v1 symmetric stream cipher moderate
HC-(128,256) symmetric stream cipher moderate
IDEA symmetric block cipher low
Kyber(512,1024) key encapsulation mechanism, post-quanten crypto low
MD4 legacy hash-algorithm low experimental 🟡 [Git]
RC6 symmetric block cipher low
RIPEMD160 legacy hash-algorithm moderate experimental 🟡 [Git]
(X)Salsa20 symmetric stream cipher high experimental 🟡 [Git]
Serpent symmetric block cipher moderate
Speck legacy block cipher low
TEA, XTEA legacy block cipher low experimental 🟡 [Git] [Git]
Twofisch symmetric block cipher moderate experimental 🟡 [Git]
yescrypt hash-algorithm / key derivation function high

Last Update: 01-07-2024


v_crypto

Installation

v install https://github.com/bstnbuck/V-crypto

Usage

In general, the functionality is easy to understand based on the tests of the respective algorithm. For larger algorithms, a README file with the most important functions follows.

import v_crypto.md4

fn main(){
    // short way to get MD4 hex hash
    println("`test` hashed with MD4 is: "+md4.hexhash("test"))

    // long way to get bytes array
    mut d := md4.new()
    blocksize, bytes_hash := d.checksum('test'.bytes())
    println("input produces a bytes checksum $bytes_hash.hex() with block size: $blocksize")

    d.reset() // with reset, a new empty checksum can be produced
    _, _ := d.checksum('Hi from V_crypto. This is an example of a long long line.'.bytes())
}

Please report security related issues to: bstnbuck (at) proton (dot) me

About

Current status of V's crypto library and implementation of additional algorithms

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages