Mastering Blockchain: Chapter 3, Symmetric Cryptography
Mastering Blockchain: Chapter 3, Symmetric Cryptography
Mastering Blockchain
Third Edition
• Introduction
• Cryptographic primitives
A generic cryptographic
model is shown here.
P, E, C, and D represent
plaintext, encryption,
ciphertext, and
decryption, respectively.
Cryptography services 4
• Confidentiality
• Integrity
• Authentication
• Non-repudiation
• Accountability
Cryptographic primitives 5
• Random numbers
• RNGs
• PRNGs
• Hash functions
Hash functions 7
As shown in the preceding diagram, SHA-256 takes the input message and divides it into equal blocks of
512 bits. Initial values (or initial hash values) of the initialization vector are composed of eight 32 bit words
(256 bits) that are fed into the compression function with the first message. Subsequent blocks are fed
into the compression function until all blocks are processed and finally, the output hash is produced.
Design of SHA-3 (Keccak) 9
• Types of keys
• Public key
• Private key
• Ephemeral key
• Master key
Stream ciphers 11
Exercise
• Search and find a way to encrypt plaintext into an AES 256-bit encrypted output, using
the OpenSSL command line tool.
Summary 16