This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# root privileges may be needed to install software packages on a system. In such case prepand the script with the command sudo | |
# If the dependedencies are not pre-installed on a system, run initially: sudo apt-get install libevent-pthreads-2.1-7 libminiupnpc17 libnatpmp1 | |
wget -q "https://launchpad.net/~luke-jr/+archive/ubuntu/bitcoinknots/+files/bitcoind_27.1.knots20240801-jammy1_amd64.deb" "https://launchpad.net/~bitcoin/+archive/ubuntu/bitcoin/+files/libdb4.8++_4.8.30-trusty1_amd64.deb" && dpkg -i libdb4.8++_4.8.30-trusty1_amd64.deb && dpkg -i bitcoind_27.1.knots20240801-jammy1_amd64.deb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# sha256.sh: calculate sha256 checksum for hex string input by user. Hex string must be shorter than 110 nibbles (or 440 bits). | |
# Example: | |
# $ BIP39-XOR.sh 000ffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364139 | |
fn_right_rotate_32(){ | |
FN_RIGHT_ROTATE_32_RESULT=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# bip39_eng_words_to_hex.sh: convert BIP39 English words to hexadicimal number (HEX). | |
# Examples: | |
# $ bash bip39_eng_words_to_hex.sh "milk sad wage cup reward umbrella raven visa give list decorate bulb gold raise twenty fly manual stand float super gentle climb fold park" | |
hex_abandon=0x000 | |
hex_ability=0x001 | |
hex_able=0x002 | |
hex_about=0x003 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# hex_to_bip39.bash: convert a hexadecimal numeral to a sentence of Bitcoin Improvement Proposal 0039 (BIP39) | |
# Example: | |
# $ hex_to_bip39.bash FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140 | |
# $ hex_to_bip39.bash FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140 38 | |
declare hex_string="${1}${2}" | |
declare -i bits=0 | |
declare -i tempvar=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# hex_string_to_bytes.bash: convert a hexadecimal string to bytes. | |
# Examples: | |
# $ bash hex_string_to_bytes FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140 | |
# $ bash hex_string_to_bytes FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140 > output_file.bin | |
export LC_ALL=C | |
hex_string="$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# file_as_hex.bash: display file content as hexadecimal string. | |
# Examples: | |
# $ bash file_as_hex.bash input_file.bin | |
export LC_ALL=C | |
exec 7< $1 | |
while IFS= read -n 1 -d '' -r -u 7; do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# hex_to_base36.bash: convert a number from base16 (hex) to base36 numeral. | |
# Examples: | |
# $ bash hex_to_base36.bash FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140 | |
declare STRING_HEX_INPUT="$1" | |
declare -i -r DIVISOR=36 | |
declare -i -r FROM_BASE=256 | |
declare dividend=${STRING_HEX_INPUT} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# base36_to_hex.bash: convert a number from base36 to base16 (hexadecimal) numeral. | |
# Examples: | |
# $ bash base36_to_hex.bash ZYXWVTSRQPONMLKJIHGFEDCBA9876543210 | |
declare STRING_BASE36_INPUT="$1" | |
declare -i -r FROM_BASE=36 | |
declare -i -r DIVISOR=16 | |
declare dividend=${STRING_BASE36_INPUT} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Bitcoin_WIF_into_hex.bash: convert from Bitcoin Wallet Import Format (WIF) to hexadicimal number (HEX) | |
# Examples: | |
# $ bash Bitcoin_WIF_into_hex.bash "L3wB8ytuxNS3SPX2CJnHqK48Zzqj1AnayDTrJomvNPDxuKvHyvpT" > private_key_bitcoin.hex | |
# $ bash Bitcoin_WIF_into_hex.bash "xprv9s21ZrQH143K31xYSDQpPDxsXRTUcvj2iNHm5NUtrGiGG5e2DtALGdso3pGz6ssrdK4PFmM8NSpSBHNqPqm55Qn3LqFtT2emdEXVYsCzC2U" | |
# $ zsh Bitcoin_WIF_into_hex.bash $(< private_key_bitcoin.wif ) | |
declare INPUT_STRING_WIF="$1" | |
declare -i -r FROM_BASE=58 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# bxor.bash: bitwise exclusive OR (XOR) of two numbers represented in hexadecimal numerals. Result is padded with leading zeros if the number is smaller than 2**256. | |
# The script could be used to encrypt or decrypt (Vernam cipher). | |
# Examples: | |
# $ bash bxor.bash "000ffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364139" "fedc09" | |
# $ for i in {1..8}; do printf "%08X" "$SRANDOM" >> b256random.key; done && bash ./bxor.bash 012345b $( < b256random.key ) | |
# $ head -c 32 /dev/random >> b256random.key && bash ./bxor.bash $( head -c 32 plaindata.bin | basenc --base16 -w 0 ) $( basenc --base16 -w 0 < b256random.key ) | |
# $ zsh bxor.bash "ffff" "011" | |
# $ sh bxor.bash "ffff" "011" |
NewerOlder