From 6a07e436c6bb7e400c254647e84f8f36df7dada8 Mon Sep 17 00:00:00 2001 From: Max Date: Sat, 18 Jun 2022 01:04:10 +0200 Subject: [PATCH] modules/port-magic: new port generation algorithm --- modules/port-magic/default.nix | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/modules/port-magic/default.nix b/modules/port-magic/default.nix index d651641..8a0d963 100644 --- a/modules/port-magic/default.nix +++ b/modules/port-magic/default.nix @@ -9,12 +9,9 @@ let portNames = config.reservePortsFor; portHash = flip pipe [ - (hashString "sha512") - stringToCharacters - (filter (n: match "[0-9]" n == [])) - (map toInt) - (foldl add 0) - (mul 1009) # prime number + (hashString "md5") + (substring 0 7) + (hash: (fromTOML "v=0x${hash}").v) (flip mod cfg.amount) (add cfg.start) ];