Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1#!/bin/sh2# Copyright (c) 2014-present The Bitcoin Core developers3# Distributed under the MIT software license, see the accompanying4# file COPYING or http://www.opensource.org/licenses/mit-license.php.6export LC_ALL=C.UTF-87INPUT=$(cat /dev/stdin)8if [ "$BITCOIN_VERIFY_COMMITS_ALLOW_SHA1" = 1 ]; then9printf '%s\n' "$INPUT" | gpg --trust-model always "$@" 2>/dev/null10exit $?11else12# Note how we've disabled SHA1 with the --weak-digest option, disabling13# signatures - including selfsigs - that use SHA1. While you might think that14# collision attacks shouldn't be an issue as they'd be an attack on yourself,15# in fact because what's being signed is a commit object that's16# semi-deterministically generated by untrusted input (the pull-req) in theory17# an attacker could construct a pull-req that results in a commit object that18# they've created a collision for. Not the most likely attack, but preventing19# it is pretty easy so we do so as a "belt-and-suspenders" measure.20for LINE in $(gpg --version); do21case "$LINE" in22"gpg (GnuPG) 1.4.1"*|"gpg (GnuPG) 2.0."*)23echo "Please upgrade to at least gpg 2.1.10 to check for weak signatures" > /dev/stderr24printf '%s\n' "$INPUT" | gpg --trust-model always "$@" 2>/dev/null25exit $?26;;27# We assume if you're running 2.1+, you're probably running 2.1.10+28# gpg will fail otherwise29# We assume if you're running 1.X, it is either 1.4.1X or 1.4.20+30# gpg will fail otherwise31esac32done33printf '%s\n' "$INPUT" | gpg --trust-model always --weak-digest sha1 "$@" 2>/dev/null34exit $?35fi
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.