Skip to content

SpinnySpiwal/Lua-Hash-Implementations

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lua SHA-256 Implementations

This repository contains high-performance SHA-256 hash implementations for various Lua environments, including:

  • LuaJIT (sha256/luajit.lua): Hyperoptimized for LuaJIT using FFI for fast memory access and buffer manipulation.

    • Fastest run: ~0.0076 seconds (1,315,270 hashes/sec)
    • Not compatible with standard Lua or Luau.
  • Luau (sha256/luau.lua): Optimized for the Luau runtime (used by Roblox and others).

    • Fastest run: ~0.066 seconds (151,081 hashes/sec)
    • Uses Luau-specific optimizations.
  • Lua 5.4 (sha256/lua54.lua): Standard Lua 5.4 implementation.

    • Fastest run: ~0.0076 seconds (1,315,270 hashes/sec)
    • Uses standard Lua 5.4 optimizations.
  • Benchmarks: Use benchmark.lua to automatically detect your Lua version and run the appropriate benchmark.

Usage

LuaJIT

luajit benchmark.lua

Luau

luau benchmark.lua

Lua 5.4

lua benchmark.lua

About

Lua hash implementations for different Lua versions, optimized by me! :3

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages