rbx-cryptography

Limits

The numbers that change what you write.

Check a number before you hit it.

Only numbers that change what you do are here. Passing a value outside one errors, naming the argument, unless the table says otherwise.

Hashing

Limit
BLAKE3 length1 to 4,294,967,295 bytes.
BLAKE3 keyExactly 32 bytes.
BLAKE2b length1 to 64 bytes.
BLAKE2b key1 to 64 bytes.
HKDF outputAt most 255 times the hash's digest size: 8,160 bytes with SHA-256.

Encryption

Limit
ChaCha20-Poly1305 keyExactly 32 bytes.
ChaCha20-Poly1305 nonceExactly 12 bytes, or 24 with XChaCha20.
RoundsA positive even number.
AES key16, 24 or 32 bytes.
AES IVAt least 1 byte.
A tag16 bytes. AEAD.Decrypt errors on any other length, and AES.Decrypt gives nil.
Messages with one key and random 12 byte noncesChange the key before 2^32.

Signatures and key exchange

Limit
Ed25519 and X25519 keysExactly 32 bytes.
X25519 public keysThe few that give an all zero shared secret error.
ML-KEM seeds and messageExactly 32 bytes each.
ML-DSA contextUp to 255 bytes. Longer makes Sign give false.

Random numbers

Limit
A RandomInt rangeAt most 2^32 numbers.
RandomHex lengthAn even number.
RandomBytes countA whole number above 0.

Encoding

Limit
FromHex inputAn even number of characters.
XOR keyAt least 1 byte.
Base64.Decode on RobloxErrors on text that isn't valid Base64.

On this page