# [Layer 2 Community Grants 2022 - ZK book](https://esp.ethereum.foundation/layer-2-grants) ## Cryptography In Rust For Hackers ## Book Objective The goal of this book is to provide a clear roadmap for developers to learn the basics of public key cryptography and zero-knowledge proofs, providing them with both the fundamental concepts and example code to help them understand existing code and develop their own applications. There are many excellent resources and repositories on zero-knowledge proofs, but it is not clear which is the optimal path to begin diving into this quickly developing field and not be overburdened by the different approaches and mathematical gadgets and tricks. The recent developments and improvements in zero-knowledge proofs have opened a wide array of applications and provide the building blocks for web3. However, many developers are driven away by putting too much emphasis on abstract mathematics and leaving aside how that translates as working machinery to develop applications. This book tries to demystify the mathematical complexity by showing clearly how to translate those abstract concepts into code. The book is written as an Open Source resource under MIT License, Copyright (c) 2022 Federico Carrone. ## Why is it important for Layer 2? Zero-knowledge proofs (such as zk-SNARKs) provide an answer to two of the main drawbacks of decentralized ledgers: privacy and scalability. The fact that we can verify the validity of a computation by checking a small proof, instead of the complete re-execution of the program helps reduce the burden each node suffers in a decentralized ledger, leading to less energy consumption and enhanced performance. This book provides an updated presentation on cryptography, with emphasis on ZKP, which will help developers learn these topics with example code and build their own applications. ## Current status of the project The book is being written right now, the general structure is laid on and about 30% of it is already done. You can check: - Its [development in its repo](https://github.com/unbalancedparentheses/cryptography_in_rust_for_hackers) - The published version of the working in progress of the book in [cryptographyinrustforhackers.com](https://cryptographyinrustforhackers.com/) The grant would help to bootstrap its development, speeding the delivery time by a considerable amount because the authors will be able to devote more time to research into the subjects and write its chapters. If we're chosen for the grant the estimate time for the project would be six months. ## Authors - Diego Kingston obtained a Ph.D. in Engineering (from the University of Buenos Aires) working on the optimization of the energy efficiency of processes using Non-Equilibrium Thermodynamics. He teaches courses on Thermodynamics and Physical Chemistry at the school of Engineering of the University of Buenos Aires, where programming is seamlessly merged with basic concepts and applications. He has published 6 papers in peer-reviewed journals and supervises the final projects of undergraduate and Ph.D. students. - Mariano Méndez obtained a Ph.D. in Computer Science (from the University of La Plata). He is an assistant professor at the School of Engineering of the University of Buenos Aires, where he teaches distributed systems, algorithms, and programming. He has published book chapters and papers in peer-review journals. - Federico Carrone. Backend developer. Founder of LambdaClass and Entropy1729, two companies specialized in building compilers, VMs, distributed systems (including blockchains), solving scalability problems, cryptography, security. Author of Data Science in Julia for Hackers (2020), Cryptography In Rust For Hackers and Distributed Consensus In Rust For Hackers. ## Book Layout ### Summary Preface 1. Theoretical Computer Science 2. Abstract algebra and number theory - Natural Numbers - Integers - Modular Arithmetic - Groups - Rings - Fields - Polynomials 3. Randomness 4. Symmetric encryption - Information vs Computational Security - Bit Operations - Stream and block ciphers - AES - ChaCha20 - XChaCha20 5. Asymmetric encryption - Fermat's little theorem - Primality Testing - RSA - Fast Multiplication Algorithms - Elliptic Curves - The discrete logarithm problem 6. Hash functions - BLAKE2b - Poseidon 7. Pseudorandom number generators 8. Signatures 9. Key Exchange 10. Message Authentication Codes - Poly1305 11. Building blocks for ZKP - Multiscalar Multiplication 12. SNARKS