TeachMeBitcoin

The Cryptographic Context

From TeachMeBitcoin, the free encyclopedia Reading time: 2 min

The Cryptographic Context

In cryptography, the "Value" of a hash is a mathematical result. Mathematicians generally treat numbers as Big Endian (high-order digits first). This creates a friction point when these results are integrated into the Little-Endian-heavy Bitcoin protocol.

1. SHA-256 Output

When you hash data using SHA-256, the algorithm produces 256 bits.

2. ECDSA Signatures

ECDSA uses two numbers, $r$ and $s$.

3. Public Keys (SECP256K1)

A public key is a point on an elliptic curve with coordinates $(x, y)$.

4. The "Internal Hash" Myth

You may hear people refer to the "Internal Hash" vs. the "Display Hash."

5. Security Implications

Endianness has no impact on the security of the hash. A reversed hash is just as collision-resistant as a natural one. However, the inconsistency can lead to "Implementation Bugs." If a developer reverses a signature by mistake, the signature becomes invalid, and the transaction is rejected.

Cryptographic Object Internal Format Endianness
Hash Result SHA-256 Big Endian
Transaction ID Bitcoin Format Little Endian (Flipped)
Public Key SEC1 Format Big Endian
Signature DER Format Big Endian

In the next section, we will analyze The Scripting Context (CScript).

☕ Help support TeachMeBitcoin

TeachMeBitcoin is an ad-free, open-source educational repository curated by a passionate team of Bitcoin researchers and educators for public benefit. If you found our articles helpful, please consider supporting our hosting and ongoing content updates with a clean donation:

Ethereum: 0x578417C51783663D8A6A811B3544E1f779D39A85
Bitcoin: bc1q77k9e95rn669kpzyjr8ke9w95zhk7pa5s63qzz
Solana: 4ycT2ayqeMucixj3wS8Ay8Tq9NRDYRPKYbj3UGESyQ4J
Address copied to clipboard!