modules/port-magic: new port generation algorithm
This commit is contained in:
parent
323084973e
commit
6a07e436c6
1 changed files with 3 additions and 6 deletions
|
@ -9,12 +9,9 @@ let
|
||||||
portNames = config.reservePortsFor;
|
portNames = config.reservePortsFor;
|
||||||
|
|
||||||
portHash = flip pipe [
|
portHash = flip pipe [
|
||||||
(hashString "sha512")
|
(hashString "md5")
|
||||||
stringToCharacters
|
(substring 0 7)
|
||||||
(filter (n: match "[0-9]" n == []))
|
(hash: (fromTOML "v=0x${hash}").v)
|
||||||
(map toInt)
|
|
||||||
(foldl add 0)
|
|
||||||
(mul 1009) # prime number
|
|
||||||
(flip mod cfg.amount)
|
(flip mod cfg.amount)
|
||||||
(add cfg.start)
|
(add cfg.start)
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in a new issue