- Notifications
You must be signed in to change notification settings - Fork0
voidxno/fast-recursive-sha256
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A fast recursiveSHA-256 (SHA256) implementation in C++ intrinsics withIntel SHA Extensions orARM Cryptography Extensions, and extra source codeoptimizations.
Created as a contribution to optimize the VDF (verifiable delay function) creation part by TimeLord inMMX blockchain.
The SHA256 algorithm used recursively can be a method for securing that an amount of sequential computation time has passed (VDF). Once created, easy to verify with checkpoints and parallel SHA256 processing. A valid, but niche way of using SHA256.
There is also apipelined edition for verifying VDF.
I just want free fast recursive SHA256:
- Use at own responsibility (LICENSE)
- Copyrsha256_fast_x64.cxx into project (Intel)
- Copyrsha256_fast_arm.cxx into project (ARM)
- Call
rsha256_fast()
function
Recommended:
- Make checks/fallback if Extensions not available
CPU: Intel/AMD x64 (w/ SHA Extensions).
CPU: ARMv8 (w/ Cryptography Extensions).
Model: Intel 11th-gen (Rocket Lake), AMD Zen, or later (a few exceptions).
Model: ARMv8, or later (Extensions are optional license, check spec sheet).
Windows: CPU-Z (Instructions) or HWiNFO64 (Features), look forSHA
.
Linux:grep -o 'sha_ni' /proc/cpuinfo
, empty if not available (Intel).
Linux:grep -o 'sha2' /proc/cpuinfo
, empty if not available (ARM).
To use in your own project. Copyrsha256_fast_x64.cxx orrsha256_fast_arm.cxx file (only one needed). Remaining files are to illustrate optimizations done and perform benchmark. Function call:
voidrsha256_fast(//-- no return value, result to *hashuint8_t* hash,//-- input/output 32bytes hash/data SHA256 valueconstuint64_t num_iters)//-- number of times to SHA256 32bytes given in *hash
Intel 13th-gen CPU P-core at6.0 GHz (Windows/VS2022):42.48 MH/s
LookBENCHMARK.md for more information, and results.
LookOPTIMIZE.md for more information, andCHANGES.md for revisions.
If you find implementation useful, donations are welcome:
BTC: bc1qtl00g8lctmuud72rv5eqr6kkpt85ws0t2u9s8dETH: 0x5fA8c257b502947A65D399906999D4FC373510B5MMX: mmx1pk95pv4lj5k3y9cwxzuuyznjsgdkqsu7wkxz029nqnenjathtv7suf9qgcXCH: xch1rk473wu3yqlxyyap4f4fhs8knzf4jt6aagtzka0g24hjgskmlv7qcme9gtKAS: kaspa:qqjrwh00du33v4f78re4x3u50420fcvemuu3ye3wy2dhllxtjlhagf04g97hj
About
Fast Recursive SHA256
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.