Untitled
user_1589252
plain_text
2 years ago
1.3 kB
13
Indexable
#Error: Can't locate Crypt/Digest/SHA256.pm in @INC (you may need to install the Crypt::Digest::SHA256 module)
#Converted to bash script, thanks ChatGPT for that.
#!/bin/bash
# Function to decrypt
decrypt() {
input=$1
key=$2
decrypted=""
# Perform XOR decrypt operation with the key
for ((i=0; i<${#input}; i++)); do
char="${input:$i:1}"
key_char="${key:$((i % ${#key})):1}"
decrypted_char=$(printf \\$(printf '%03o' $((0x$(printf '%02x' "'$char") ^ 0x$(printf '%02x' "'$key_char")))))
decrypted+="$decrypted_char"
done
# Run substitution cipher
snow_key="001011100001011011100110100101100100111011101110"
snow_decrypt=""
for ((i=${#snow_key}-1; i>=0; i--)); do
snow_decrypt+="${snow_key:$i:1}"
done
for ((i=0; i<${#snow_decrypt}; i+=8)); do
if [ $i -eq 0 ]; then
decrypted=$(printf \\$(printf '%03o' $((2#${snow_decrypt:0:8}))))
continue
fi
decrypted+=$(printf \\$(printf '%03o' $((2#${snow_decrypt:$i:8}))))
done
echo "$decrypted"
}
# Get hash of whitepaper
input_file="bitcoin.pdf"
sha256_hex=$(md5sum "$input_file" | awk '{print $1}')
# Decrypt using key
key="CraigS"
echo "$(decrypt "$sha256_hex" "$key")"
Editor is loading...
Leave a Comment