From a9da6e0e5bc2e9d4b5141de39942f77e546a425f Mon Sep 17 00:00:00 2001 From: lassulus Date: Fri, 30 Apr 2021 11:29:24 +0200 Subject: [PATCH] go: use last 5 hash characters for short urls --- krebs/3modules/go.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/krebs/3modules/go.nix b/krebs/3modules/go.nix index 5686fea3f..fea25e036 100644 --- a/krebs/3modules/go.nix +++ b/krebs/3modules/go.nix @@ -51,7 +51,7 @@ let sha256=$(echo "$uri" | sha256sum -b | cut -d\ -f1) base32=$(${pkgs.nixStable}/bin/nix-hash --to-base32 --type sha256 "$sha256") - base32short=$(echo "$base32" | cut -b-5) + base32short=$(echo "$base32" | cut -c48-52) ${pkgs.redis}/bin/redis-cli set "$base32short" "$uri" >/dev/null ref="http://$req_host/$base32short"