# Cryptography Guide.
### Encryption vs Cryptography: What's the Difference?
First let's explain these two concepts
* Encryption is a way of scrambling data so that only authorized parties can understand the information. It is also the process of converting human-readable plaintext to ciphertext. A Ciphertext is the scrambled, unreadable output produced when plaintext (readable data) is encrypted using a cryptographic algorithm and a secret key
* Cryptography these is the practice of using codes and other techniques to protect data from unathorized access.
#### Differences between cryptography and encryption.
* Cryptography: is a field that includes encryption, decryption and other techniques that can be used to protect data.
* Encryption is a specific process that converts plaintext(readable text) into ciphertext(unreadable text).
### What Makes a Hash Function Cryptographically Secure?
A hash function takes any data and turns it into a fixed string of characters. For it to be secure, two things matter: You can hash "password123" into "a7b9x2k" but you can NEVER reverse it back to "password123". Just like in our normal centralized plartform once a user register his password is being hashed for security reason and purposes.
### How SHA-256 is used in Bitcoin's proof-of-work
SHA-256 is a specific algorithm used in the bitcoin mining. Proof of work is the puzzle mathematics miners solve to add a block. Miners use SHA-256 to guess a random number (called a nonce) and then adds it to the block data.
### How does Ethereum uses Keccak-256 (SHA-3)?
Ethereum uses Keccak-256, a cryptographic hash function from the SHA-3 family, as a foundational element for security, data integrity, and smart contract functionality. It is not the same as the standardized SHA-3 (FIPS 202), which was finalized after Ethereum's launch and includes different padding rules.
### Difference between symmetric and asymmetric encryption
* Symmetric encryption is a case where when you use the same key to lock and unlock a message. Asymmetric encryption is when you use two different keys, one public to lock and one private to unlock.
* The difference is symmetric is faster but less secure because you have to share the key with the other person and these would expose your assets, WHILE asymmetric is safer for the internet/network because you can share your public key with everyone but keep your private key secret safe to only yourself.
### How public/private key pairs work (focus on ECDSA)
ECDSA stands for Elliptic Curve Digital Signature Algorithm which is the math behind the keys. The private key is just a random number you pick.
Public key is calculated from the private key using the curve math. It is a one way street, meaning you can easily get the public key from the private key, but you cannot do the reverse calculation to find the private key from the public key.
### How digital signatures verify transaction authenticity
Digital signatures verify transaction authenticity through a cryptographic process that ensures the transaction was initiated by the rightful owner and has not been altered.
### What Merkle trees are and their structure
Merkle trees are a cryptographic data structure used to efficiently verify the integrity and authenticity of large datasets. They are also known as hash trees or binary hash trees. merkle is a way of structuring our data in the blocks.
### How Merkle roots provide data integrity in blocks
Merkle roots provide data integrity in blockchain blocks by serving as a single, unique cryptographic fingerprint for all transactions within the block. This root is generated by repeatedly hashing pairs of transaction hashes in a binary tree structure, starting from the leaves (individual transaction hashes) and moving upward until only one hash remain.
### Why they're efficient for verifying transactions (Merkle proofs)
Merkle proofs are efficient for verifying transactions because they allow a verifier to confirm a transaction's inclusion in a block using only a small, logarithmic-sized proof—typically just a few hashes—instead of downloading or processing the entire block.
### If I have your public key, can I find your private key? Why or why not?
No, you cannot find the private key from the public key in a secure asymmetric cryptosystem.
Why you can get the public key from the private key
The public key is generated from the private key using elliptic curve mathematics.
Why you cannot get the private key from the public key
because the public-key cryptography relies on one way mathematical functions that are easy to compute in one direction but computationally infeasible to reverse
### Research the difference between zk-SNARKs and zk-STARKs
zk-SNARKs and zk-STARKs are both zero-knowledge proof systems used to verify computations without revealing underlying data, but they differ significantly in design, security, and performance. Choose zk-SNARKs for small proofs, fast verification, and established ecosystems these has risk if setup keys are not destroyed.
Choose zk-STARKs for transparency, quantum resistance, and scalability—ideal for large-scale decentralized systems like Starknet and zkPorter.