{"id":13788732,"url":"https://github.com/krunch3r76/gc__gvmi_hash","last_synced_at":"2026-02-26T02:38:40.971Z","repository":{"id":41302802,"uuid":"370880132","full_name":"krunch3r76/gc__gvmi_hash","owner":"krunch3r76","description":"python script to output the Requestor's gvmi image hash as seen on the Golem repository","archived":false,"fork":false,"pushed_at":"2022-07-07T04:56:41.000Z","size":107,"stargazers_count":2,"open_issues_count":6,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-24T14:47:19.251Z","etag":null,"topics":["golem"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/krunch3r76.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-05-26T02:10:23.000Z","updated_at":"2025-04-23T22:56:56.000Z","dependencies_parsed_at":"2022-09-01T14:10:56.801Z","dependency_job_id":null,"html_url":"https://github.com/krunch3r76/gc__gvmi_hash","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/krunch3r76/gc__gvmi_hash","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krunch3r76%2Fgc__gvmi_hash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krunch3r76%2Fgc__gvmi_hash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krunch3r76%2Fgc__gvmi_hash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krunch3r76%2Fgc__gvmi_hash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/krunch3r76","download_url":"https://codeload.github.com/krunch3r76/gc__gvmi_hash/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krunch3r76%2Fgc__gvmi_hash/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29848634,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-25T22:37:40.667Z","status":"online","status_checked_at":"2026-02-26T02:00:06.774Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["golem"],"created_at":"2024-08-03T21:00:52.606Z","updated_at":"2026-02-26T02:38:40.949Z","avatar_url":"https://github.com/krunch3r76.png","language":"Python","funding_links":[],"categories":["Apps"],"sub_categories":["Miscellaneous"],"readme":"# gc__gvmi_hash\nSummary: computes the hash of a gvmi image file. \nExtra: optionally queries the Golem network to confirm that gvmi image is available from golem's central repository (i.e. to see if the hash link has been created)\n\n\n# Usage:\n```\ngit clone https://github.com/krunch3r76/gc__gvmi_hash.git\npython3 gc__gvmi_hash/gc__gvmi_hash.py \u003cgvmi-image\u003e\n```\n\n## Example:BASH\n```bash\n(cracker-venv)$ git clone https://github.com/krunch3r76/gc__gvmi_hash.git\n(cracker-venv)$ alias gvmi_hash=\"python3 $PWD/gc__gvmi_hash/gc__gvmi_hash.py\" #BASH alias\n(cracker-venv)$ krunch3r@crystalcavern:~/hash-cracker$ gvmi_hash *.gvmi\nSHA3-224(docker-hash-cracker-latest-363b2e9df2.gvmi)= e1a95ab266977b857ae1c59942ebc7384a72359840b452c2e5293737\nSHA3-224(docker-hash-cracker-latest-e93d21fba0.gvmi)= 4c9778760794a5fa6b8461ed2654c09cbc20f16edd3ec687c3289db8\n```\n\n## Example:Powershell\n```powershell\ncracker-venv \u003e git clone https://github.com/krunch3r76/gc__gvmi_hash.git\ncracker-venv \u003e $gvmi_hash=\"${PWD}\\gc__gvmi_hash\\gc__gvmi_hash.py\"\ncracker-venv \u003e python $gvmi_hash docker-hash-cracker-latest-363b2e9df2.gvmi\nSHA3-224(docker-hash-cracker-latest-363b2e9df2.gvmi)= e1a95ab266977b857ae1c59942ebc7384a72359840b452c2e5293737\n```\n\n### Example:Powershell: alternatively edit $PROFILE\nset $gvmi_hash to absolute path to\\gc__gvmi_hash\\gc__gvmi_hash.py\n\nexample $profile\n```\noh-my-posh init pwsh --config $env:POSH_THEMES_PATH/space.omp.json | Invoke-Expression\n$gvmi_hash=\"C:\\Users\\krunch3r\\golem\\gc__gvmi_hash\\gc__gvmi_hash.py\"\n```\n\n```powershell\nsomewhere \u003e . $profile\ncracker-venv \u003e python $gvmi_hash docker-hash-cracker-latest-363b2e9df2.gvmi\nSHA3-224(docker-hash-cracker-latest-363b2e9df2.gvmi)= e1a95ab266977b857ae1c59942ebc7384a72359840b452c2e5293737\n```\n\n# Extra Usage (Linux):\n```bash\n$ alias gvmi_hash=\"python3 $PWD/gc__gvmi_hash/gc__gvmi_hash.py\" #BASH alias\n$ gvmi_hash --check-hash-link 4c9778760794a5fa6b8461ed2654c09cbc20f16edd3ec687c3289db8\nThe link exists on the central repository.\n\n$ gvmi_hash docker-hash-cracker-latest-e93d21fba0.gvmi | cut -f2 -d ' ' | gvmi_hash --check-hash-link-stdin\nThe link exists on the central repository.\n```\n\n# Problem:\nThe gvmkit-build Python package/script outputs the hash of a gvmi image only after its initial push operation. However, a Requestor is required to provide the pushed image hash in its requestor script, and if lost, has no means provided by gvmkit-build to re-output the image hash. Additionally, the current Golem documentation neither specifies the hashing algorithm used (sha3-224) nor suggests a tool for recomputation.\n\nThe supplied gv__gvmi_hash.py solves a lost hash problem by hashing the input image file using the same algorithm as, and with no additional runtime dependencies than those already satisfied by, the gvmkit-build package -- namely the Python Standard Library + OpenSSL libraries.\n\nNote, the script is equivalent to invoking `openssl dgst -sha3-224 \u003cgvmi-image\u003e` on systems where openssl executables have been installed. Also, the hash algorithm is indeed SHA3-224 and the reader is encouraged to see the code in gvmkit-build itself (viz Credits) to convince oneself of this.\n\n--Note: to understand better what problem this script solves, it is recommended the reader follow the Provider Flash Tutorial (Python) at https://handbook.golem.network/requestor-tutorials/flash-tutorial-of-requestor-development. --\n\n## NOTE:\nThe script's extra functionality (viz Extra Usage) to query the repo for the hash link makes an outside network connection. The routine is safe (HTTP/1.1 HEAD request), short, and can be quickly audited for peace of mind in the context of security concerns. viz (__check_for_hash_link in gc__gvmi_has.py)\n\n\n# Credits:\nAdapted from the source code in the Python package gvmkit-build, which is viewable in the tarbell via https://pypi.org/project/gvmkit-build/#files (file: repo.py, function: upload_image). Formatting of output should be credited to openssl.org.\n\n\n# Tips:\nConsider placing community scripts on linux such as this in $HOME/.local/bin/golem-community and adding it to your path. You may also consider adding said community scripts path to the environment variable PYTHONPATH and calling from gc__gvmi_hash import gc__gvmi_hash in order to utilize the function from within scripts, e.g. requestor.py.\n\n\n\n# Additional:\n\n## primary function inputs,process,and outputs:\n```python\ndef gc__gvmi_hash(filename: str): # gc for golem community\nMEBIBYTES=1024*1024 # one mebibyte ie megabyte, always a multiple of typical block sizes 4096,8192\n# input: path to file as string\n# pre: file is readable, MEBIBYTES defined\n# process:\n#   open gvmi image\n#   on each chunk\n#       send to hasher\n#   query hasher\n# output: hash as string\n# post: none\n# notes: additional details of the hashlib implementation may be discoverable via https://www.openssl.org/docs/manmaster/man3/EVP_DigestInit.html\n```\n\n# Alternatives:\nBesides the openssl dgst command mentioned in the problem statement, a simple command line tool and call may be preferred if extra features of gc__gvmi_hash are not needed. See https://handbook.golem.network/requestor-tutorials/vm-runtime/self-hosted-vm-images for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrunch3r76%2Fgc__gvmi_hash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrunch3r76%2Fgc__gvmi_hash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrunch3r76%2Fgc__gvmi_hash/lists"}