Fundamentals ·

Entropy क्या है? Crypto Security के पीछे की Randomness


हर cryptocurrency wallet एक random number से शुरू होता है। कोई password नहीं जो आप choose करें, कोई pattern नहीं जो आप design करें, बल्कि physical world से खींची गई raw randomness। इस randomness को entropy कहते हैं, और यह सबसे important factor है जो determine करता है कि आपकी crypto assets secure हैं या vulnerable।

अगर आपके wallet के पीछे entropy strong है, attacker को आपकी keys खोजने के लिए observable universe में atoms से अधिक combinations search करने होंगे। अगर entropy weak है, आपके funds seconds में चोरी हो सकते हैं। कोई middle ground नहीं।

Entropy Defined

Cryptography में entropy data की unpredictability measure करती है। Bits में quantify होती है। एक bit entropy single binary choice represent करती है। दो bits चार possible outcomes। तीन bits आठ।

Formula straightforward है: n bits entropy produce 2^n possible values।

Crypto context में entropy metaphor या abstract concept नहीं। यह specific, measurable quantity of randomness है जो deterministic algorithms में feed होती है आपके seed phrase, private keys और ultimately addresses produce करने के लिए। Initial entropy के बाद सब कुछ mathematically derived है। Entropy ही एकमात्र part है जो genuinely random होना चाहिए।

128 Bits vs 256 Bits

BIP39 standard दो primary entropy lengths support करता है:

128 bits (12-word seed phrase)

  • 2^128 possible seed phrases produce करता है
  • 340,282,366,920,938,463,463,374,607,431,768,211,456 combinations
  • Approximately 3.4 x 10^38

256 bits (24-word seed phrase)

  • 2^256 possible seed phrases produce करता है
  • Roughly 1.16 x 10^77 combinations
  • Observable universe में estimated atoms से अधिक

दोनों levels current technology के against secure मानी जाती हैं। Detailed comparison के लिए How Fast Can a Seed Phrase Be Brute-Forced? देखें।

Entropy bits और word count के बीच simple rule: हर 11 bits entropy BIP39 word list से एक word पर map होती है (2,048 words, और 2^11 = 2,048)। 12-word phrase 128 bits entropy plus 4 bits checksum encode करता है। BIP39 Explained में full breakdown पढ़ें।

Randomness के Sources: Hardware RNG और Web Crypto API

Pseudorandom vs. Cryptographically Secure

Standard programming random function (जैसे JavaScript की Math.random()) pseudorandom है। Mathematical formula उपयोग करती है numbers produce करने के लिए जो random लगते हैं लेकिन entirely deterministic हैं। Cryptocurrency keys generate करने के लिए catastrophically unsuitable।

Cryptographically secure random number generators (CSPRNGs) hardware sources से genuine physical randomness incorporate करके solve करते हैं।

Hardware Random Number Generators

Modern CPUs में dedicated hardware random number generators हैं:

  • Intel RDRAND/RDSEED: Silicon circuits में thermal noise उपयोग
  • ARM TrustZone TRNG: Hardware-level random bit generation
  • OS-level entropy pools: Linux का /dev/urandom, Windows CryptGenRandom, macOS SecRandomCopyBytes

Web Crypto API

Browser-based tools के लिए Web Crypto API crypto.getRandomValues() से operating system के cryptographic random number generator तक access provide करती है।

SafeSeed सभी key generation के लिए Web Crypto API उपयोग करता है। Bitcoin Seed Phrase Generator या Ethereum Seed Phrase Generator उपयोग करते समय entropy crypto.getRandomValues() से source होती है।

Math.random() और crypto.getRandomValues() fundamentally different systems हैं। Math.random() में roughly 52 bits internal state है। crypto.getRandomValues() में ऐसी weakness नहीं।

Entropy से Seed Phrase तक

Raw entropy से seed phrase तक journey BIP39 specification द्वारा defined precise, deterministic path follow करती है:

Step 1: Random bytes generate करें

CSPRNG 16 bytes (128 bits) या 32 bytes (256 bits) random data produce करता है।

Step 2: Checksum compute करें

Entropy का SHA-256 hash compute होता है। First 4 bits (128-bit entropy के लिए) या 8 bits (256-bit entropy के लिए) checksum के रूप में append होते हैं।

Step 3: 11-bit groups में split करें

Combined entropy + checksum bits 11 bits के groups में divide होते हैं।

Step 4: Words पर map करें

हर 11-bit value (0-2047) BIP39 word list में index के रूप में उपयोग होती है। Result आपका mnemonic phrase है।

Step 5: Seed derive करें

Mnemonic phrase PBKDF2-HMAC-SHA512 से 2,048 iterations के साथ pass होता है 512-bit seed produce करने के लिए। फिर HD wallet tree BIP44 derivation paths follow करके derive होता है।

Step 1 के बाद हर step deterministic है। Same 128 bits entropy हमेशा same 12 words, same seed और same addresses produce करेगा।

जब Weak Entropy Stolen Funds का कारण बनती है

Android SecureRandom vulnerability (2013)

August 2013 में Android के SecureRandom implementation में flaw discover हुआ। Java cryptography library properly seed नहीं कर रही थी, जिससे कुछ Bitcoin wallets insufficient entropy वाली private keys generate करते थे। Attackers ने affected wallets से bitcoins चोरी किए।

Blockchain Bandit (predictable keys)

Security researcher Adrian Bednarek ने document किया कि attackers systematically Ethereum blockchain weak private keys से derived addresses scan करते थे। 0x0000...0001 जैसी keys वाले addresses से हजारों ether drain हुए।

Brain wallet attacks

Brain wallets --- जहां private key memorized passphrase से derive होती है --- repeatedly compromised हुए क्योंकि human-chosen phrases में लोगों की सोच से बहुत कम entropy होती है।

Common lesson: cryptographic algorithms (SHA-256, secp256k1, ECDSA) broken नहीं हैं। Entropy insufficient थी।

Entropy Quality Test करना

NIST SP 800-22

NIST randomness के लिए statistical tests publish करता है --- frequency tests, runs tests, matrix rank tests।

Dieharder test suite

Extended randomness tests set जो generators को harder push करता है।

Practical verification

End users के लिए सबसे practical verification यह ensure करना है कि crypto.getRandomValues() या equivalent OS-level CSPRNG उपयोग करने वाला well-audited tool उपयोग कर रहे हैं। अपनी "randomness" add करने की कोशिश न करें। Are Online Seed Generators Safe? देखें।

Entropy और आपकी Security Posture

Entropy समझना crypto security के बारे में सोचने का तरीका बदल देता है। 12-word seed phrase सिर्फ convenient backup mechanism नहीं; यह random number की human-readable encoding है इतनी बड़ी कि universe में सभी possibilities search करने के लिए enough energy नहीं।

Tools choose करते समय:

  1. Entropy source verify करें: Tool crypto.getRandomValues(), /dev/urandom या equivalent hardware-backed randomness उपयोग करे।
  2. Custom entropy avoid करें: अपने words pick न करें, biased method से dice roll न करें।
  3. Established standards उपयोग करें: BIP39 2013 से battle-tested है। SafeSeed पर Solana Seed Phrase Generator जैसे tools decade of security review inherit करते हैं।
  4. जब संभव हो offline generate करें: How to Generate a Bitcoin Seed Phrase Offline देखें।

Entropy invisible है। आप इसे देख नहीं सकते, महसूस नहीं कर सकते, या output देखकर verify नहीं कर सकते। Weak entropy से generated seed phrase strong entropy से generated जैसी ही दिखती है। Security ensure करने का एकमात्र तरीका process पर trust करना है: audited, open-source tools उपयोग करें जो hardware-backed random number generators से draw करते हैं।