nix-files/hosts/modules/derived-secrets/hash-path-with-salt

13 lines
267 B
Plaintext
Executable File

#!/usr/bin/env nix-shell
#!nix-shell -i bash
file="$1"
enc="$2"
nibbles="$3"
echo "$file" | cat /dev/stdin /etc/ssh/host_keys/ssh_host_ed25519_key \
| sha512sum \
| cut -c "1-$nibbles" \
| tr a-z A-Z \
| basenc -d --base16 \
| basenc "--$enc" \
> "$file"