trr379-knowledge/tools/digest-sha1-p3
Michael Hanke bf70a77b9d
Small helper to compute digest-sha1-3
Eventually, this should become a tool to place a full record at the
target location. Baby steps.
2025-01-22 09:22:09 +01:00

13 lines
250 B
Bash
Executable file

#!/bin/bash
set -e
[ -z "$1" ] && ( cat << EOT
Computes a 'digest-sha1-p3' file identifier from a record identifier.
Usage: $0 <identifier>
EOT
) && exit 1
sha="$(printf '%s' "$1" | sha1sum | cut -d ' ' -f1)"
printf '%s/%s\n' ${sha:0:3} ${sha:3}