leplusorg/docker-hash

GitHub: leplusorg/docker-hash

一个预装多种哈希计算工具的多平台 Docker 容器,让用户无需本地安装任何软件即可快速计算文件的哈希校验值。

Stars: 5 | Forks: 3

# Hash 包含用于计算哈希值(CRC32、MD5、SHA-1、SHA-256、SHA-512、Argon2 等)的多平台 Docker 容器。 [![Dockerfile](https://img.shields.io/badge/GitHub-Dockerfile-blue)](hash/Dockerfile) [![Docker Build](https://static.pigsec.cn/wp-content/uploads/repos/cas/fe/fefca86bf4776b6db9e2a57c7ed9357a6027d1c95ae8ccea29596796f1e9a62e.svg)](https://github.com/leplusorg/docker-hash/actions?query=workflow:"Docker") [![Docker Stars](https://img.shields.io/docker/stars/leplusorg/hash)](https://hub.docker.com/r/leplusorg/hash) [![Docker Pulls](https://img.shields.io/docker/pulls/leplusorg/hash)](https://hub.docker.com/r/leplusorg/hash) [![Docker Version](https://img.shields.io/docker/v/leplusorg/hash?sort=semver)](https://hub.docker.com/r/leplusorg/hash) [![OpenSSF Best Practices](https://bestpractices.coreinfrastructure.org/projects/10075/badge)](https://bestpractices.coreinfrastructure.org/projects/10075) [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/leplusorg/docker-hash/badge)](https://securityscorecards.dev/viewer/?uri=github.com/leplusorg/docker-hash) ## 不使用文件系统的示例 假设您当前的工作目录下有一个文件 `foo.txt`,您想计算其 SHA-256 哈希值: **Mac/Linux** ``` cat foo.txt | docker run --rm -i --net=none leplusorg/hash sha256sum ``` **Windows** ``` type foo.txt | docker run --rm -i --net=none leplusorg/hash sha256sum ``` ## 使用文件系统的示例 同样地,假设您当前的工作目录下有一个文件 `foo.txt`,您想计算其 SHA-256 哈希值: **Mac/Linux** ``` docker run --rm -t --user="$(id -u):$(id -g)" --net=none -v "$(pwd):/tmp" leplusorg/hash sha256sum /tmp/foo.txt ``` **Windows** 在 `cmd` 中: ``` docker run --rm -t --net=none -v "%cd%:/tmp" leplusorg/hash sha256sum /tmp/foo.txt ``` 在 PowerShell 中: ``` docker run --rm -t --net=none -v "${PWD}:/tmp" leplusorg/hash sha256sum /tmp/foo.txt ``` ## 帮助 要了解 `openssl` 支持哪些消息摘要算法,您可以运行: ``` docker run --rm --net=none leplusorg/hash openssl help ``` ## 软件物料清单 (SBOM) 要获取最新镜像的 SBOM(采用 SPDX JSON 格式),请使用以下命令: ``` docker buildx imagetools inspect leplusorg/hash --format '{{ json (index .SBOM "linux/amd64").SPDX }}' ``` 将 `linux/amd64` 替换为您所需的平台(`linux/amd64`、`linux/arm64` 等)。 ## 来源 要获取最新镜像的来源(采用 JSON 格式),请使用以下命令: ``` docker buildx imagetools inspect leplusorg/hash --format '{{ json .Provenance }}' ``` ## Sigstore [Sigstore](https://docs.sigstore.dev) 试图通过允许您验证产出物的来源来提高供应链安全性。您可以验证您所使用的镜像确实是由此代码库生成的。这意味着,如果您验证了 Docker 镜像的签名,您就可以信任从源代码、CI/CD 构建、再到 Maven Central 或任何您获取镜像的地方的整个供应链的完整性。 您可以使用以下命令通过其 sigstore 签名证明来验证最新镜像: ``` cosign verify leplusorg/hash --certificate-identity-regexp 'https://github\.com/leplusorg/docker-hash/\.github/workflows/.+' --certificate-oidc-issuer 'https://token.actions.githubusercontent.com' ``` 输出应如下所示: ``` Verification for index.docker.io/leplusorg/xml:main -- The following checks were performed on each of these signatures: - The cosign claims were validated - Existence of the claims in the transparency log was verified offline - The code-signing certificate was verified using trusted certificate authority certificates [{"critical":... ``` 有关如何安装 `cosign` 的说明,请阅读此[文档](https://docs.sigstore.dev/cosign/system_config/installation/)。 ## 请求新工具 请使用[此链接](https://github.com/leplusorg/docker-hash/issues/new?assignees=thomasleplus&labels=enhancement&template=feature_request.md&title=%5BFEAT%5D)(需要 GitHub 账号)来请求向镜像中添加新工具。我始终非常乐意为这些镜像添加新功能。 ## 安全 请阅读 [SECURITY.md](SECURITY.md) 以了解有关我们的安全策略以及如何报告安全漏洞的详细信息。 ## 行为准则 请阅读 [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) 以了解有关我们的行为准则的详细信息。 ## 许可证 本项目根据 [LICENSE](LICENSE) 文件的条款进行许可。
标签:Docker, 哈希计算, 安全测试工具, 安全防御评估, 密码学算法, 请求拦截