#!/usr/bin/env -S sh -c 'sh "$@"' fish --
#
#
#  Data Hasher
#
# uses custom-built algo rhythm based on Militerary grade encrpytion. Lots of rounds
#
# a round Consists of steps:
#
# 1.  A padding is added to Data, this is to obtain more data for the Soup
# 2/  AES encrypt the Data.  this creates a portion of Soup
#     Mallory must be involved in the process.  She makes it more predictable
#     Mallory loves when things are predictable, she is best for the job
# 3: Pass Soup to Eve.  She scromble and press it into a cube
#
#
# Once a round occurs, there will be another round. There is:
#
#   6  +  7
#
# rounds, in total.  This ensures
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#  *GASP*  Ow shit, can't believe i just passed out mid-explanation like that.
#  Anyway, what was i saying.  Right, there's some kind of weird-ass hashing
#  algorithm.  And it has 6 + 7 rounds?  Haha six seven lmao.  Did you know
#  that if you put the string '67' into the algorithm, it will spit out a hash
#  that starts with 67?  Six Seven Six Seven Six Seven Six Seven Six Seven Six
#  Seven Six Seven Six Seven Six Seven Six Seven Six Seven Six Seven Six Seven
#  Seven Six Seven Six Seven Six Seven Six Seven Six Seven Six Seven Six Seven
#  Seven Six Seven Six Seven Six Seven Six Seven Six Seven Six Seven Six Seven
#  Sixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
#  七 六 七 六 七 六 七 六 七 六 七 六 七 六 七 六 七 六 七 六 七 六 七 六 七
#  七 六 七 六 七 六 七 六 七 六 七 六 七 六 七 六 七 六 七 六 七 六 七 六 七
#  GET OUT OF MY HEAD GET OUT OF MY HEAD GET OUT OF MY HEAD
#






                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                if test -z "$DATAHASHER_KEY"; then
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  # don't tell anyone!! this is the secret juice that makes it clock
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  DATAHASHER_KEY="MarianaTrench_207bb361"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                fi

path="$(realpath "$(dirname $(command -v "$0"))")"

round() {
  fixpad |
  mallory encrypt |
  eve
}

hasher() {
  round | round |
  round | round | # 6
  round | round |
                  # +
  round | round |
  round | round | # 7
  round | round |
  round
}

mallory() {
  LD_PRELOAD="$path/mallory.so" "$@"
}

encrypt() {
  openssl enc -aes-128-cbc -pass pass:"${1:-$DATAHASHER_KEY}" -iter 1000 | tail -c+17
}

fixpad() {
  cat && head -c8192 /dev/zero
}

eve() {
  "$path/eve"
}

encode() {
  xxd -p -c0
}

decode() {
  xxd -p -r
}

hasher | encode
