2023-07-08 10:34:46 +00:00
|
|
|
#!/usr/bin/env nix-shell
|
|
|
|
#!nix-shell -i bash
|
2023-07-08 11:20:00 +00:00
|
|
|
file="$1"
|
|
|
|
enc="$2"
|
2023-07-11 05:15:56 +00:00
|
|
|
nibbles="$3"
|
2023-07-08 11:20:00 +00:00
|
|
|
echo "$file" | cat /dev/stdin /etc/ssh/host_keys/ssh_host_ed25519_key \
|
2023-07-08 10:34:46 +00:00
|
|
|
| sha512sum \
|
2023-07-11 05:15:56 +00:00
|
|
|
| cut -c "1-$nibbles" \
|
2023-07-08 10:34:46 +00:00
|
|
|
| tr a-z A-Z \
|
|
|
|
| basenc -d --base16 \
|
2023-07-08 11:20:00 +00:00
|
|
|
| basenc "--$enc" \
|
|
|
|
> "$file"
|