Change pinSHA256 to Hex

This commit is contained in:
Whispering Wind
2025-04-11 12:33:47 +03:30
committed by GitHub
parent ce8028b759
commit bab350bb29

View File

@ -19,27 +19,27 @@ install_hysteria() {
wget -O /etc/hysteria/geosite.dat https://raw.githubusercontent.com/Chocolate4U/Iran-v2ray-rules/release/geosite.dat >/dev/null 2>&1 wget -O /etc/hysteria/geosite.dat https://raw.githubusercontent.com/Chocolate4U/Iran-v2ray-rules/release/geosite.dat >/dev/null 2>&1
wget -O /etc/hysteria/geoip.dat https://raw.githubusercontent.com/Chocolate4U/Iran-v2ray-rules/release/geoip.dat >/dev/null 2>&1 wget -O /etc/hysteria/geoip.dat https://raw.githubusercontent.com/Chocolate4U/Iran-v2ray-rules/release/geoip.dat >/dev/null 2>&1
fingerprint=$(openssl x509 -noout -fingerprint -sha256 -inform pem -in ca.crt | sed 's/.*=//;s/://g') # fingerprint=$(openssl x509 -noout -fingerprint -sha256 -inform pem -in ca.crt | sed 's/.*=//;s/://g')
echo "Generating base64 encoded SHA-256 fingerprint..." echo "Generating base64 encoded SHA-256 fingerprint..."
cat <<EOF > generate.py # cat <<EOF > generate.py
import base64 # import base64
import binascii # import binascii
# Hexadecimal string # # Hexadecimal string
hex_string = "$fingerprint" # hex_string = "$fingerprint"
# Convert hex to binary # # Convert hex to binary
binary_data = binascii.unhexlify(hex_string) # binary_data = binascii.unhexlify(hex_string)
# Encode binary data to base64 # # Encode binary data to base64
base64_encoded = base64.b64encode(binary_data).decode('utf-8') # base64_encoded = base64.b64encode(binary_data).decode('utf-8')
# Print the result prefixed with 'sha256/' # # Print the result prefixed with 'sha256/'
print('sha256/' + base64_encoded) # print('sha256/' + base64_encoded)
EOF # EOF
sha256=$(python3 generate.py) sha256=$(openssl x509 -noout -fingerprint -sha256 -inform pem -in ca.crt)
if [[ $port =~ ^[0-9]+$ ]] && (( port >= 1 && port <= 65535 )); then if [[ $port =~ ^[0-9]+$ ]] && (( port >= 1 && port <= 65535 )); then
if ss -tuln | grep -q ":$port\b"; then if ss -tuln | grep -q ":$port\b"; then