Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

<04><TFT><SCRIPT> Tin Foil Tools Script-Foo Challenge

0 views
Skip to first unread message

CRYP7010G3R

unread,
Mar 18, 2023, 3:35:49 PM3/18/23
to
#!/usr/bin/env bash

# (tft) Tin Foil Tool Formatter - compress or decompress a base32
columns file

# Usage
# compress > $ tft smush [filename] ... > $ tft -c [filename]
# decompress > $ tft bloat [filename] ... > $ tft -d [filename]

fyle="$2" ; [[ ! -f "$fyle" ]] && echo "file not found!" && exit 1

smush() {
cat "$fyle" | xz | base32 -w0 | fold -w 8 | tr '\n' ' ' | fold -w 63 |
tr -d '='
}

bloat() {
cat "$fyle" | tr -dc A-Z2-7 | base32 -d | unxz
}

[[ "$1" == "smush" ]] && smush "$2" ; [[ "$1" == "-c" ]] && smush "$2"
[[ "$1" == "bloat" ]] && bloat "$2" ; [[ "$1" == "-d" ]] && bloat "$2"
0 new messages