{"id":22071476,"url":"https://github.com/zonque/hashttp","last_synced_at":"2026-04-25T16:34:33.909Z","repository":{"id":66926922,"uuid":"164220321","full_name":"zonque/hashttp","owner":"zonque","description":"An http server that serves content by its hash sum","archived":false,"fork":false,"pushed_at":"2019-12-23T15:11:22.000Z","size":12,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-23T19:17:06.793Z","etag":null,"topics":["go","golang","http","linux","sha512","squashfs"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zonque.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.GPL2","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-01-05T14:06:13.000Z","updated_at":"2020-07-10T16:06:58.000Z","dependencies_parsed_at":"2023-02-23T04:30:31.479Z","dependency_job_id":null,"html_url":"https://github.com/zonque/hashttp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zonque/hashttp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zonque%2Fhashttp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zonque%2Fhashttp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zonque%2Fhashttp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zonque%2Fhashttp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zonque","download_url":"https://codeload.github.com/zonque/hashttp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zonque%2Fhashttp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32269462,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-25T09:15:33.318Z","status":"ssl_error","status_checked_at":"2026-04-25T09:15:31.997Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["go","golang","http","linux","sha512","squashfs"],"created_at":"2024-11-30T20:31:45.037Z","updated_at":"2026-04-25T16:34:33.893Z","avatar_url":"https://github.com/zonque.png","language":"Go","readme":"# hashttp - An http server that serves content by its hash sum\n\nThis simple http server takes a bunch of files as command line arguments,\ngenerates SHA512 hashes for each of them and serves them via http, using\nthe hash as as path in the request URI.\n\nApart from regular files, the code also handles raw Linux block devices.\nBuilt-in support for basic content parsing allows for proper file size\ndetermination.\n\nOriginally, the code was written to serve a squashfs image from one machine\nto another as part of an update process. A client that knows the SHA512 can\nthen easily retrieve the contents from another machine. Considering the SHA512\nsecret, it also serves as an access control method.\n\n# Building\n\nThis project is implemented in Go, and the build process is as simple as this:\n\n`go build`\n\n# Parameters\n\nThere are several command line parameters that can be passed:\n\n* `--source` may be used several times to specify a local file to be scanned\n  and served. At least one such file must be given. If multiple given files\n  happen to have the same hash, only the first of them is used.\n\n* `--port` specifies the port to listen to. Must be passed, the program does\n  not default to a value.\n\n* `--url-prefix` can be optionally used to pass a prefix to expect before the\n  hash sum.\n\n# File type handling\n\nBlock devices can be used as a source directly, in which case the size of the\ndevice will be determined, and the entire content is read and served.\n\nThis, however, is not always what is desired. For instance, when file system\nimages are stored on a block device, only a fraction of the device actually\ncontains useful data. To support this, hashttp is prepared to parse the headers\nof such content to determine the actual size that is of interest.\n\nCurrently, only squashfs images are detected during parsing, but more file\ntypes can easily be added. Please do post PRs!\n\n# Example\n\nLet's create a file and see which SHA512 is has.\n\n```\n$ echo \"Hello, world\" \u003efile.txt\n$ sha512sum file.txt\n959c0bdfa9877d3466c5848f55264f72f132c657b002b79fda65dbe36c67f4bb3d2a3e2e9925cb5896a53c76169c5bb71b7853bd90192068dc77f4b20159a1d8  file.txt\n```\n\nNow, let's start the server and point it to that file.\n\n```\n$ ./hashttp --source file.txt --port 5555 --url-prefix files                                                                                                                                                                (130) [14:56:01]\n2019/01/05 14:56:03 Processing source file.txt ...\n2019/01/05 14:56:03 Serving file.txt (type plain) on /files/959c0bdfa9877d3466c5848f55264f72f132c657b002b79fda65dbe36c67f4bb3d2a3e2e9925cb5896a53c76169c5bb71b7853bd90192068dc77f4b20159a1d8\n2019/01/05 14:56:03 Listening on port 5555 ...\n```\n\nAnd then retrieve it again via http.\n\n```\n$ curl -o - http://localhost:5555/files/959c0bdfa9877d3466c5848f55264f72f132c657b002b79fda65dbe36c67f4bb3d2a3e2e9925cb5896a53c76169c5bb71b7853bd90192068dc77f4b20159a1d8                                         (2) [14:57:36]\nHello, world\n```\n\n# License\n\nGPLv2, see the `LICENSE.GPL2` file.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzonque%2Fhashttp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzonque%2Fhashttp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzonque%2Fhashttp/lists"}