lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 2cbfd74 1/2: Add a secret decoder ring


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 2cbfd74 1/2: Add a secret decoder ring
Date: Wed, 7 Nov 2018 18:45:32 -0500 (EST)

branch: master
commit 2cbfd74303740461df4ada83ba5db0585d806ddb
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Add a secret decoder ring
    
    See:
      https://lists.nongnu.org/archive/html/lmi/2018-11/msg00016.html
---
 gwc/invert.sh | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/gwc/invert.sh b/gwc/invert.sh
new file mode 100755
index 0000000..b3b81d2
--- /dev/null
+++ b/gwc/invert.sh
@@ -0,0 +1,42 @@
+#!/bin/zsh
+
+# Obfuscate-deobfuscate MST<->XST files. Cf. 'mst_to_xst.sh'.
+
+# Copyright (C) 2018 Gregory W. Chicares.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+#
+# http://savannah.nongnu.org/projects/lmi
+# email: <address@hidden>
+# snail: Chicares, 186 Belle Woods Drive, Glastonbury CT 06033, USA
+
+# MST files are so easy to edit that end users might be tempted to
+# customize them, which might impair regulatory compliance. That
+# temptation is removed by distributing only obfuscated copies.
+# This script, for maintainer use only, deobfuscates and reobfuscates
+# them in place.
+#
+# Mapping 255..0 to 0..255 is XORing with 0xFF.
+
+# This script requires zsh because brace expansion is more convenient
+# than 'seq', and especially because zsh offers glob qualifiers.
+
+X=$(printf '\%03o' {255..0})
+Y=$(printf '\%03o' {0..255})
+
+MST=(*.mst(N))
+XST=(*.xst(N))
+
+for z in $MST; do tr "$X" "$Y" <"$z" >"${z%%.mst}.xst"; done
+for z in $XST; do tr "$X" "$Y" <"$z" >"${z%%.xst}.mst"; done



reply via email to

[Prev in Thread] Current Thread [Next in Thread]