Date: 03/02/2025
1. Public Key
• The public key is a cryptographic key that is shared openly with others.
• It is used to verify digital signatures and encrypt messages that only the owner of the
corresponding private key can decrypt.
• In ICP, your public key is associated with your Principal ID, which identifies your
identity on the blockchain.
• When you authenticate using Internet Identity or Plug Wallet, your public key is used
to verify transactions.
2. Private Key
• The private key is a secret key that must be kept confidential.
• It is used to sign transactions and decrypt messages encrypted with the public key.
• If someone gains access to your private key, they can control your identity, access your
ICP tokens, and perform transactions on your behalf.
• In the ICP blockchain, private keys are often managed securely within wallets like Plug,
Stoic, or Internet Identity to protect against exposure.
3. Difference Between Public Key & Private Key
Feature Public Key Private Key
Visibility Shared publicly Kept secret
Function Used for verification & Used for signing &
encryption decryption
Usage in ICP Identifies the user (Principal Proves ownership &
ID) authorizes transactions
Security No risk if leaked Must be protected to prevent
loss of funds & identity
Example :
• Suppose wewant to send ICP tokens to someone. we sign the transaction with your
private key, and the network verifies it using your public key.
• When logging into dApps using Internet Identity, a cryptographic process ensures that
your private key never leaves your device, while the dApp only receives a proof of
authentication via your public key.
Date: 03/02/2025
What is a Hash?
A hash is a fixed-length string or number that represents input data. It is generated using a
mathematical hash function.
For example, hashing the word "InternetComputer" might produce:
a1b2c3d4e5f67890abcd1234ef567890
Even a small change in input data (like "internetComputer" instead of "InternetComputer") will
result in a completely different hash.
What is a Hash Function?
A hash function is a mathematical algorithm that takes an input (text, number, or file) and
converts it into a fixed-size output, called a hash value or digest.
Key properties of a good hash function:
Deterministic → The same input always gives the same output.
Fast Computation → Can quickly generate hashes.
Irreversible → You cannot reverse the hash to get the original input.
Collision Resistant → Two different inputs should not generate the same hash.
Small Changes Affect the Output → Even a tiny change in input gives a completely different
hash.
How is Hashing Used?
1. Blockchain Security (ICP, Bitcoin, Ethereum)
In the Internet Computer (ICP) blockchain, hashing is used to:
• Secure transactions and blocks.
• Store data efficiently.
• Prevent tampering by making data immutable.
2. Password Storage
Instead of storing passwords directly, systems store their hashed versions for security.
For example:
password123 → SHA-256 → ef92b778bafee25f7d5f
Date: 03/02/2025
3. Digital Signatures & Data Integrity
• Hashes are used to verify that data has not been modified.
• Smart contracts on ICP use hashing for authentication and digital signatures.
4. Cryptographic Fingerprints
Each transaction on the blockchain has a hash-based identifier to ensure security.