{"id":26674861,"url":"https://github.com/voidxno/fast-recursive-sha256","last_synced_at":"2025-09-20T11:47:09.323Z","repository":{"id":182345797,"uuid":"652788505","full_name":"voidxno/fast-recursive-sha256","owner":"voidxno","description":"Fast Recursive SHA256","archived":false,"fork":false,"pushed_at":"2024-02-21T11:41:27.000Z","size":113,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-02-21T12:35:09.161Z","etag":null,"topics":["algorithm","algorithms","cpp","crypto","cxx","intrinsics","proof-of-time","sha-256","sha256","timelord","vdf"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/voidxno.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-06-12T19:55:42.000Z","updated_at":"2023-06-18T12:38:45.000Z","dependencies_parsed_at":"2023-12-03T13:29:49.634Z","dependency_job_id":"0c9ee8e3-6d25-4eb5-87cc-a4884dcc737a","html_url":"https://github.com/voidxno/fast-recursive-sha256","commit_stats":null,"previous_names":["voidxno/fast-recursive-sha256"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voidxno%2Ffast-recursive-sha256","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voidxno%2Ffast-recursive-sha256/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voidxno%2Ffast-recursive-sha256/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voidxno%2Ffast-recursive-sha256/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/voidxno","download_url":"https://codeload.github.com/voidxno/fast-recursive-sha256/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245578268,"owners_count":20638465,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithm","algorithms","cpp","crypto","cxx","intrinsics","proof-of-time","sha-256","sha256","timelord","vdf"],"created_at":"2025-03-26T02:39:31.056Z","updated_at":"2025-09-20T11:47:04.274Z","avatar_url":"https://github.com/voidxno.png","language":"C++","readme":"# Fast Recursive SHA256\n\nA fast recursive [SHA-256](https://en.wikipedia.org/wiki/SHA-2#Pseudocode) (SHA256) implementation in C++ intrinsics with [Intel SHA Extensions](https://www.intel.com/content/www/us/en/developer/articles/technical/intel-sha-extensions.html) or [ARM Cryptography Extensions](https://developer.arm.com/architectures/instruction-sets/intrinsics/#q=sha256), and extra source code [optimizations](OPTIMIZE.md).\n\nCreated as a contribution to optimize the VDF (verifiable delay function) creation part by TimeLord in [MMX blockchain](https://github.com/madMAx43v3r/mmx-node).\n\nThe 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.\n\nThere is also a [pipelined edition](./pipeline_mt/) for verifying VDF.\n\n## TLDR;\n\nI just want free fast recursive SHA256:\n* Use at own responsibility ([LICENSE](LICENSE))\n* Copy [rsha256_fast_x64.cxx](rsha256_fast_x64.cxx) into project (Intel)\n* Copy [rsha256_fast_arm.cxx](rsha256_fast_arm.cxx) into project (ARM)\n* Call `rsha256_fast()` function\n\nRecommended:\n* Make checks/fallback if Extensions not available\n\n## Requirement\n\n**CPU:** Intel/AMD x64 (w/ SHA Extensions).\\\n**CPU:** ARMv8 (w/ Cryptography Extensions).\\\n**Model:** Intel 11th-gen (Rocket Lake), AMD Zen, or later (a few exceptions).\\\n**Model:** ARMv8, or later (Extensions are optional license, check spec sheet).\n\n**Windows:** CPU-Z (Instructions) or HWiNFO64 (Features), look for `SHA`.\\\n**Linux:** `grep -o 'sha_ni' /proc/cpuinfo`, empty if not available (Intel).\\\n**Linux:** `grep -o 'sha2' /proc/cpuinfo`, empty if not available (ARM).\n\n## Usage\n\nTo use in your own project. Copy [rsha256_fast_x64.cxx](rsha256_fast_x64.cxx) or [rsha256_fast_arm.cxx](rsha256_fast_arm.cxx) file (only one needed). Remaining files are to illustrate optimizations done and perform benchmark. Function call:\n```c++\nvoid rsha256_fast(        //-- no return value, result to *hash\nuint8_t*       hash,      //-- input/output 32bytes hash/data SHA256 value\nconst uint64_t num_iters) //-- number of times to SHA256 32bytes given in *hash\n```\n\n## Benchmark\n\nIntel 13th-gen CPU P-core at **6.0 GHz** (Windows/VS2022): **42.48 MH/s**\n\n![Console output Windows/VS2022](/media/benchmark.png \"Console output Windows/VS2022 benchmark\")\n\nLook [BENCHMARK.md](BENCHMARK.md) for more information, and results.\n\n## Optimization\n\nLook [OPTIMIZE.md](OPTIMIZE.md) for more information, and [CHANGES.md](CHANGES.md) for revisions.\n\n## Donation\n\nIf you find implementation useful, donations are welcome:\n\n```\nBTC: bc1qtl00g8lctmuud72rv5eqr6kkpt85ws0t2u9s8d\nETH: 0x5fA8c257b502947A65D399906999D4FC373510B5\nMMX: mmx1pk95pv4lj5k3y9cwxzuuyznjsgdkqsu7wkxz029nqnenjathtv7suf9qgc\nXCH: xch1rk473wu3yqlxyyap4f4fhs8knzf4jt6aagtzka0g24hjgskmlv7qcme9gt\nKAS: kaspa:qqjrwh00du33v4f78re4x3u50420fcvemuu3ye3wy2dhllxtjlhagf04g97hj\n```\n\n\u003c!-- eof --\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoidxno%2Ffast-recursive-sha256","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvoidxno%2Ffast-recursive-sha256","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoidxno%2Ffast-recursive-sha256/lists"}