daily3014/cryptography

Luau implementations of popular hashing/encryption algorithms

Luau Cryptography

Docs Discord Wally Pesde

Luau Cryptography is a library of cryptographic algorithims written in Luau. It supports Post-Quantum (PQ), Elliptic Curve Cryptography (ECC), authenticated encryption and CSPRNG with many utilities.

Authors

daily3014 - Developer - @daily3014
Xoifail - Developer - @xoifail

Acknowledgments

  • Thanks to those who gave feedback and testing
  • Special thanks to all contributors and bug reporters
  • AES was originally made by @RobloxGamerPro200007
  • XChaCha20 was originally made by @littleBitsman
  • Murmur3 hash was originally made by @kohltastrophe

Disclaimer

While this library has extensive testing, it's always recommended that you do your own tests. Keep in mind that there may be timing vulnerabilities that cannot be fixed due to how Luau compiles functions. This library is NOT intended for exploitation, harassment, illegal activities, or explicit content. All security issues should be reported in the Discord server.

Documentation

Docs

Installation

Wally

[dependencies]
cryptography = "daily3014/[email protected]"

Pesde

pesde add daily3014/cryptography

Manual Installation

Download the latest release from GitHub and place it in your Roblox Studio project.

List of Algorithms

Elliptic Curve Cryptography

Digital Signature Schemes

  • Ed25519 signatures with masked operations for side-channel protection

Key Exchange

  • X25519: Elliptic curve Diffie-Hellman over Curve25519

Post-Quantum Cryptography

KEM: Key Encapsulation Methods

  • ML-KEM: modes 512, 768, 1024 (Kyber-based, NIST standardized)

Digital Signature Schemes

Symmetric Cryptography

Hash Functions

  • SHA-2 Family: SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/224, SHA-512/256 with optional salt support
  • SHA-3 Family: SHA3-224, SHA3-256, SHA3-384, SHA3-512, SHAKE-128, SHAKE-256 (FIPS 202)
  • BLAKE Family: BLAKE3 (fastest available), BLAKE3-Keyed, BLAKE3-DeriveKey, BLAKE2b

Non-cryptographic Hash Functions

  • XXH32: Ultra-fast non-cryptographic hash
  • Murmur3: Fast non-cryptographic hash

Message Authentication

  • HMAC: Hash-based Message Authentication Code (works with any hash function)

  • KMAC: Hash-based Message Authentication Code (uses Keccak)

Authenticated Encryption

Stream & Block Ciphers

Checksums

  • CRC32: Cyclic Redundancy Check (JAM/ISO modes)
  • Adler-32: Checksum algorithm

Utilities

Encoding & Conversion

Random Generation

  • CSPRNG: Cryptographically Secure Pseudo-Random Number Generator with entropy management
  • Random strings and bytes generation

Performance

Performance benchmarks conducted in Roblox Studio on AMD Ryzen 5 7600X using Benchmarker by @boatbomber.

Hashing / Checksum

AlgorithmData SizeThis LibraryHashLibAlternativeOther LibrariesImprovement
SHA-25620k271 μs2058 μs493 μs (Old Version)596 μs (Dekkonot)7.6x faster than HashLib
SHA-51220k421 μs4348 μs1066 μs (Dekkonot)-10.3x faster than HashLib
SHA3-51220k826 μs10.60 ms--12.8x faster than HashLib
BLAKE320k133 μs----
HMAC-BLAKE320k145 μs----
KMAC-12820k443 μs----
KMAC-25620k501 μs----
Adler-32200k163 μs-1.65 ms (Naive Approach)-10.1x faster
CRC32200k1.43 ms-6.26 ms (DevForum)-4.4x faster

Encryption

AlgorithmData SizeThis LibraryAlternativeOther LibrariesImprovement
ChaCha20 (Encrypt)20k177 μs7.87 ms (EncryptedNet)-44.5x faster
ChaCha20 (Roundtrip)20k338 μs~15 ms (EncryptedNet)-44.4x faster
ChaCha20-Poly1305 (Encrypt)20k232 μs---
ChaCha20-Poly1305 (Roundtrip)20k448 μs---
Simon (Encrypt)20k239 μs---
Simon (Roundtrip)20k466 μs---
Speck (Encrypt)20k193 μs---
Speck (Roundtrip)20k388 μs---
AES-GCM (Encrypt)20k833 μs1.877 ms (RobloxGamerPro200007 AES256-CTR)-2.3x faster
AES-GCM (Roundtrip)20k1.5 ms---
XOR (Encrypt)1 million1.10 ms~49.5 ms (Devfourm)~171000 ms (daily)155,454x faster
XOR (Roundtrip)1 million2.20 ms98.9 ms (Devfourm)~342000 ms (daily)155,454x faster

Digital Signatures & Key Exchange

AlgorithmOperationTimeAlternativeImprovement
EdDSA (Roundtrip)Sign+Verify691 μs--
ML-DSA-44 (Roundtrip)Sign+Verify3.65 ms--
ML-KEM-512 (Roundtrip)Encap+Decap754 μs--

Utilities

AlgorithmData SizeTimeAlternativeImprovement
Base64 (Roundtrip)1 million3.77msLute: 9.11ms
Reselim: 12.08ms
2.4x faster than Lute
3.2x faster than Reselim

Roundtrip: Complete encrypt/decrypt or sign/verify cycle

Testing and Benchmarking

Running Tests

To run the complete test suite:

bash scripts/test.sh

This will launch Roblox Studio, execute all tests, and display results in your terminal.

Development Testing

For continuous testing during development:

bash scripts/dev.sh

This starts a Rojo server. Open Roblox Studio and sync Rojo into a Baseplate. Whenever you run the game server, the test suites will run and results will show in the Output widget.

Contributing

To contribute, fork this repository and make your changes, and then make a Pull Request. A Pull Request needs approval.

Please read the CONTRIBUTING.md file for detailed guidelines.

License

This project is licensed under the MIT License. See the LICENSE file for details.


DevForumDiscordDocsWallyPesde