From 4e1c1942285e13ded40e5b69c2ff1ea6dcb4aa59 Mon Sep 17 00:00:00 2001 From: Arcade Wise Date: Mon, 10 Jul 2023 16:27:15 -0400 Subject: Better privacy for wifi in hosts.tcl --- hosts.tcl | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hosts.tcl b/hosts.tcl index d5b2e795..aa6700a9 100644 --- a/hosts.tcl +++ b/hosts.tcl @@ -1,3 +1,13 @@ +# TODO: Find a good C sha-smth instead of this. +proc hashString {str} { + set hash 0 + foreach char [split $str ""] { + set ascii [scan $char %c] + set hash [expr {($hash * 31 + $ascii) & 0xffffffff}] + } + set hash +} + if {[info exists ::env(FOLK_SHARE_NODE)]} { set ::shareNode $::env(FOLK_SHARE_NODE) } else { @@ -20,6 +30,8 @@ if {[info exists ::env(FOLK_SHARE_NODE)]} { set ::shareNode "folk0.local" } elseif {[string match "_onefact.org*" $wifi]} { set ::shareNode "folk-onefact.local" + } elseif {[hashString $wifi] eq 4077950650 || [hashString $wifi] eq 862457117} { + set ::shareNode "folk-arc.local" } else { # there's no default. } -- cgit v1.2.3