100% found this document useful (6 votes)
30 views

Download Complete (Ebook) Pro Cryptography and Cryptanalysis with C++23: Creating and Programming Advanced Algorithms by Marius Iulian Mihailescu, Stefania Loredana Nita ISBN 9781484294499, 1484294491 PDF for All Chapters

The document provides information about various ebooks on cryptography and cryptanalysis authored by Marius Iulian Mihailescu and Stefania Loredana Nita, including titles focused on C++23, C++20, and Java. It includes links for downloading these ebooks in multiple formats and outlines the content structure of the books, which covers foundational concepts, advanced algorithms, and cryptanalysis techniques. Additionally, it highlights the authors' credentials and the technical reviewer's background in the field.

Uploaded by

evsenrabeih
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (6 votes)
30 views

Download Complete (Ebook) Pro Cryptography and Cryptanalysis with C++23: Creating and Programming Advanced Algorithms by Marius Iulian Mihailescu, Stefania Loredana Nita ISBN 9781484294499, 1484294491 PDF for All Chapters

The document provides information about various ebooks on cryptography and cryptanalysis authored by Marius Iulian Mihailescu and Stefania Loredana Nita, including titles focused on C++23, C++20, and Java. It includes links for downloading these ebooks in multiple formats and outlines the content structure of the books, which covers foundational concepts, advanced algorithms, and cryptanalysis techniques. Additionally, it highlights the authors' credentials and the technical reviewer's background in the field.

Uploaded by

evsenrabeih
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 71

Download the Full Ebook and Access More Features - ebooknice.

com

(Ebook) Pro Cryptography and Cryptanalysis with


C++23: Creating and Programming Advanced
Algorithms by Marius Iulian Mihailescu, Stefania
Loredana Nita ISBN 9781484294499, 1484294491
https://ebooknice.com/product/pro-cryptography-and-
cryptanalysis-with-c-23-creating-and-programming-advanced-
algorithms-50581682

OR CLICK HERE

DOWLOAD EBOOK

Download more ebook instantly today at https://ebooknice.com


Instant digital products (PDF, ePub, MOBI) ready for you
Download now and discover formats that fit your needs...

Start reading on any device today!

(Ebook) Pro Cryptography and Cryptanalysis with C++23:


Creating and Programming Advanced Algorithms, 2nd Edition
by Marius Iulian Mihailescu, Stefania Loredana Nita
https://ebooknice.com/product/pro-cryptography-and-cryptanalysis-
with-c-23-creating-and-programming-advanced-algorithms-2nd-
edition-50569844
ebooknice.com

(Ebook) Pro Cryptography and Cryptanalysis with C++20:


Creating and Programming Advanced Algorithms by Marius
Iulian Mihailescu, Stefania Loredana Nita ISBN
9781484265857, 1484265858
https://ebooknice.com/product/pro-cryptography-and-cryptanalysis-
with-c-20-creating-and-programming-advanced-algorithms-46651728

ebooknice.com

(Ebook) Cryptography and Cryptanalysis in MATLAB: Creating


and Programming Advanced Algorithms by Marius Iulian
Mihailescu, Stefania Loredana Nita ISBN 9781484273333,
1484273338
https://ebooknice.com/product/cryptography-and-cryptanalysis-in-
matlab-creating-and-programming-advanced-algorithms-34605210

ebooknice.com

(Ebook) Pro Cryptography and Cryptanalysis: Creating


Advanced Algorithms with C# and .NET by Marius Iulian
Mihailescu; Stefania Loredana Nita ISBN 9780471128458,
9780849385216, 9781484263679, 0471128457, 0849385210,
https://ebooknice.com/product/pro-cryptography-and-cryptanalysis-
1484263677
creating-advanced-algorithms-with-c-and-net-15202074

ebooknice.com
(Ebook) Pro Cryptography and Cryptanalysis with C++23:
Creating and Programming Advanced Algorithms by Marius
Iulian Mihailescu, Stefania Loredana Nita ISBN
9781484294505, 1484294505,
https://ebooknice.com/product/pro-cryptography-and-cryptanalysis-
6f9e8543-3b6f-4ca5-883e-c08c930a6ca8,
with-c-23-creating-and-programming-advanced-algorithms-50594370
6F9E8543-3B6F-4CA5-883E-C08C930A6CA8
ebooknice.com

(Ebook) Cryptography and Cryptanalysis in Java: Creating


and Programming Advanced Algorithms with Java SE 17 LTS
and Jakarta EE 10 by Stefania Loredana Nita, Marius
Iulian Mihailescu ISBN 9781484281048, 1484281047
https://ebooknice.com/product/cryptography-and-cryptanalysis-in-java-
creating-and-programming-advanced-algorithms-with-java-se-17-lts-and-
jakarta-ee-10-42712576
ebooknice.com

(Ebook) Pro Cryptography and Cryptanalysis with C++20:


Creating and Programming Advanced Algorithms by Marius
Iulian Mihailescu ISBN 9781484265857, 1484265858
https://ebooknice.com/product/pro-cryptography-and-cryptanalysis-
with-c-20-creating-and-programming-advanced-algorithms-36373792

ebooknice.com

(Ebook) Cryptography and Cryptanalysis in Java: Creating


and Programming Advanced Algorithms with Java SE 17 LTS
and Jakarta EE 10 by Stefania Loredana Nita; Marius Iulian
Mihailescu ISBN 9781484281048, 9781484281055, 1484281047,
https://ebooknice.com/product/cryptography-and-cryptanalysis-in-java-
1484281055
creating-and-programming-advanced-algorithms-with-java-se-17-lts-and-
jakarta-ee-10-42814048
ebooknice.com

(Ebook) Cryptography and Cryptanalysis in Java, 2nd


Edition by Stefania Loredana Nita, Marius Iulian
Mihailescu ISBN 9798868804403, 8868804409
https://ebooknice.com/product/cryptography-and-cryptanalysis-in-
java-2nd-edition-58449812

ebooknice.com
Marius Iulian Mihailescu and Stefania Loredana Nita

Pro Cryptography and Cryptanalysis


with C++23
Creating and Programming Advanced Algorithms
2nd ed.
Marius Iulian Mihailescu
Bucharest, Romania

Stefania Loredana Nita


Bucharest, Romania

ISBN 978-1-4842-9449-9 e-ISBN 978-1-4842-9450-5


https://doi.org/10.1007/978-1-4842-9450-5

© Marius Iulian Mihailescu and Stefania Loredana Nita 2021, 2023

This work is subject to copyright. All rights are solely and exclusively
licensed by the Publisher, whether the whole or part of the material is
concerned, specifically the rights of translation, reprinting, reuse of
illustrations, recitation, broadcasting, reproduction on microfilms or in
any other physical way, and transmission or information storage and
retrieval, electronic adaptation, computer software, or by similar or
dissimilar methodology now known or hereafter developed.

The use of general descriptive names, registered names, trademarks,


service marks, etc. in this publication does not imply, even in the
absence of a specific statement, that such names are exempt from the
relevant protective laws and regulations and therefore free for general
use.

The publisher, the authors, and the editors are safe to assume that the
advice and information in this book are believed to be true and accurate
at the date of publication. Neither the publisher nor the authors or the
editors give a warranty, expressed or implied, with respect to the
material contained herein or for any errors or omissions that may have
been made. The publisher remains neutral with regard to jurisdictional
claims in published maps and institutional affiliations.
This Apress imprint is published by the registered company APress
Media, LLC, part of Springer Nature.
The registered company address is: 1 New York Plaza, New York, NY
10004, U.S.A.
Any source code or other supplementary material referenced by the
author in this book is available to readers on GitHub
(https://github.com/Apress). For more detailed information, please
visit http://www.apress.com/source-code.
Table of Contents
Part I: Foundations
Chapter 1:​Getting Started in Cryptography and Cryptanalysis
Cryptography and Cryptanalysis
Book Structure
Internet Resources
Forums and Newsgroups
Security Protocols and Standards
Cryptography Tools and Resources
Conclusion
References
Chapter 2:​Cryptography Fundamentals
Information Security and Cryptography
Cryptography Goals
Cryptographic Primitives
Background of Mathematical Functions
One-to-One, One-Way, and Trapdoor One-Way Functions
Permutations
Inclusion
Concepts and Basic Terminology
Domains and Codomains Used for Encryption
Encryption and Decryption Transformations
The Participants in the Communication Process
Digital Signatures
Signing Process
Verification Process
Public-Key Cryptography
Hash Functions
Case Studies
Caesar Cipher Implementation in C++23
Vigenére Cipher Implementation in C++23
Conclusion
References
Chapter 3:​Mathematical Background and Its Applicability
Probabilities
Conditional Probability
Random Variables
Birthday Problem
Information Theory
Entropy
Number Theory
Integers
Algorithms inℤ
Integers Modulo n
Algorithms ℤm
The Legendre and Jacobi Symbols
Finite Fields
Basic Notions
Polynomials and the Euclidean Algorithm
Case Study 1:​Computing the Probability of an Event That Takes
Place
Case Study 2:​Computing the Probability Distribution
Case Study 3:​Computing the Mean of the Probability
Distribution
Case Study 4:​Computing the Variance
Case Study 5:​Computing the Standard Deviation
Case Study 6:​Birthday Paradox
Case Study 7:​(Extended) Euclidean Algorithm
Case Study 8: Computing the Multiplicative Inverse Under
Modulo q
Case Study 9:​Chinese Remainder Theorem
Case Study 10:​The Legendre Symbol
Conclusion
References
Chapter 4:​Large Integer Arithmetic
A Bit of History
What About Cryptography?​
Algorithms Used for Large Integer Arithmetic
Subtraction (Subtraction Modulo)
Multiplication
Big Integers
Review of Large Integer Libraries
Conclusion
References
Chapter 5:​Floating-Point Arithmetic
Why Floating-Point Arithmetic?​
Displaying Floating-Point Numbers
The Range of Floating Points
Floating-Point Precision
Next Level for Floating-Point Arithmetic
Conclusion
References
Chapter 6:​New Features in C++23
Headers
The <expected> Header
The <generator> Header
The <flat_​map> Header
Conclusion
References
Chapter 7:​Secure Coding Guidelines
Secure Coding Checklist
CERT Coding Standards
Identifiers
Noncompliant Code Examples and Compliant Solutions
Exceptions
Risk Assessment
Automated Detection
Related Guidelines
Rules
Rule 01.​Declarations and Initializations (DCL)
Rule 02.​Expressions (EXP)
Rule 03.​Integers (INT)
Rule 05.​Characters and Strings (STR)
Rule 06.​Memory Management (MEM)
Rule 07.​Input/​Output (FIO)
Conclusion
References
Chapter 8:​Cryptography Libraries in C/​C++23
Overview of Cryptography Libraries
Hash Functions
Public-Key Cryptography
Elliptic-Curve Cryptography (ECC)
OpenSSL
Configuration and Installing OpenSSL
Botan
CrypTool
Conclusion
References
Part II: Pro Cryptography
Chapter 9:​Elliptic-Curve Cryptography
Theoretical Fundamentals
Weierstrass Equation
Group Law
Practical Implementation
Conclusion
References
Chapter 10:​Lattice-based Cryptography
Advantages and Disadvantages of Lattice-based Cryptography
Applications of Lattice-based Cryptography
Security of Lattice-based Cryptography
Lattice-based Cryptography and Quantum Computing
Mathematical Background
Example
Conclusion
References
Chapter 11:​Searchable Encryption
Components
Entities
Types
Security Characteristics
An Example
Conclusion
References
Chapter 12:​Homomorphic Encryption
Full Homomorphic Encryption
A Practical Example of Using FHE
Conclusion
References
Chapter 13:​Ring Learning with Errors Cryptography
Mathematical Background
Learning with Errors (LWE)
Ring Learning with Errors (RLWE)
Practical Implementation
Conclusion
References
Chapter 14:​Chaos-based Cryptography
Security Analysis
Chaotic Maps for Plaintexts and Image Encryption
Rössler Attractor
Complex Numbers:​A Short Overview
Practical Implementation
Secure Random Number Generator Using Chaos Rössler
Attractor
Encrypt and Decrypt Using Chaos and Fractals
Conclusion
References
Chapter 15:​Big Data Cryptography
Verifiable Computation
Conclusion
References
Chapter 16:​Cloud Computing Cryptography
A Practical Example
Conclusion
References
Part III: Pro Cryptanalysis
Chapter 17:​Starting with Cryptanalysis
Part III:​Structure
Cryptanalysis Terms
A Bit of Cryptanalysis History
Understanding Cryptanalysis Techniques
Analyzing Cryptographic Algorithms
Cracking Cryptographic Systems
Understanding Cryptographic Systems
Understanding Cryptographic Keys
Understanding Cryptographic Weaknesses
Analyzing Cryptographic Keys
Penetration Tools and Frameworks
Conclusion
References
Chapter 18:​Cryptanalysis Attacks and Techniques
Standards
FIPS 140-2, FIPS 140-3, and ISO 15408
Validation of Cryptographic Systems
Cryptanalysis Operations
Classification of Cryptanalytics Attacks
Attacks on Cipher Algorithms
Attacks on Cryptographic Keys
Attacks on Authentication Protocols
Conclusion
References
Chapter 19:​Differential and Linear Cryptanalysis
Differential Cryptanalysis
Linear Cryptanalysis
Performing Linear Cryptanalysis
Conclusion
References
Chapter 20:​Integral Cryptanalysis
Basic Notions
Theorem 20-1 [1, Theorem 1, p.​114]
Theorem 20-2 [1, Theorem 2, p.​114]
Practical Approach
Conclusion
References
Chapter 21:​Brute-Force and Buffer Overflow Attacks
Brute-Force Attack
Buffer Overflow Attack
Conclusion
References
Chapter 22:​Text Characterization​
Chi-Squared Statistic
Cryptanalysis Using Monogram, Bigram, and Trigram
Frequency Counts
Counting Monograms
Counting Bigrams
Counting Trigrams
Conclusion
References
Chapter 23:​Implementation and Practical Approach of
Cryptanalysis Methods
Step 1
Step 2
Step 3
Step 4
Ciphertext-Only Attack (COA)
Known-Plaintext Attack (KPA)
Chosen-Plaintext Attack (CPA)
Chosen-Ciphertext Attack (CCA)
Conclusion
References
Index
About the Authors
Marius Iulian Mihailescu, PhD
is an associate professor at the Faculty of Engineering and Informatics,
Spiru Haret University in Bucharest, Romania. He is also the CEO of
Dapyx Solution Ltd., a company based in Bucharest specializing in
information security and cryptography-related research projects. He is
a lead guest editor for applied cryptography journals and a reviewer for
multiple publications with information security and cryptography
profiles. He authored and co-authored more articles in conference
proceedings, 25 articles, and books. For more than six years, he has
been a lecturer at well-known national and international universities
(the University of Bucharest, Titu Maiorescu University, and Kadir Has
University in Istanbul, Turkey). He has taught courses on programming
languages (C#, Java, C++, Haskell) and object-oriented system analysis
and design with UML, graphs, databases, cryptography, and information
security. He served three years as an IT officer at Royal Caribbean
Cruises Ltd., dealing with IT infrastructure, data security, and satellite
communications systems. He received his PhD in 2014, and his thesis
was on applied cryptography over biometrics data. He holds two MSc in
information security and software engineering.

Stefania Loredana Nita, PhD


is a lecturer at the Ferdinand I Military Technical Academy in
Bucharest, Romania, and a software developer at the Institute of for
Computers in Bucharest. Her PhD thesis was on advanced
cryptographic schemes using searchable encryption and homomorphic
encryption. She has been an assistant lecturer at the University of
Bucharest, teaching courses on advanced programming techniques,
simulation methods, and operating systems. She has authored several
whitepapers and journal articles, as well as books on the Haskell
programming language. Stefania is a lead guest editor for information
security and cryptography issues, such as advanced cryptography and
its future: searchable and homomorphic encryption. She has a master’s
degree in software engineering and bachelor’s degrees in computer
science and mathematics.
About the Technical Reviewer
Massimo Nardone
has more than 25 years of experience in
security, web/mobile development,
cloud, and IT architecture. His true IT
passions are security and Android. He
has been programming and teaching
how to program with Android, Perl, PHP,
Java, VB, Python, C/C++, and MySQL for
more than 20 years. He has a master’s
degree in computing science from the
University of Salerno, Italy.
He has worked as a CISO, CSO,
security executive, IoT executive, project
manager, software engineer, research
engineer, chief security architect,
PCI/SCADA auditor, and senior lead IT security/cloud/SCADA architect
for many years. His technical skills include security, Android, cloud,
Java, MySQL, Drupal, Cobol, Perl, web and mobile development,
MongoDB, D3, Joomla, Couchbase, C/C++, WebGL, Python, Pro Rails,
Django CMS, Jekyll, Scratch, and more.
He worked as visiting lecturer and supervisor for exercises at the
Networking Laboratory of the Helsinki University of Technology (Aalto
University). He holds four international patents (PKI, SIP, SAML, and
Proxy areas). He is currently working for Cognizant as head of
cybersecurity and CISO to help internally and externally with clients in
information and cyber security areas, like strategy, planning, processes,
policies, procedures, governance, awareness, and so forth. In June 2017,
he became a permanent member of the ISACA Finland Board. Massimo
has reviewed more than 45 IT books for different publishing companies
and is the co-author of Pro Spring Security: Securing Spring Framework
5 and Boot 2-based Java Applications (Apress, 2019), Beginning EJB in
Java EE 8 (Apress, 2018), Pro JPA 2 in Java EE 8 (Apress, 2018), and Pro
Android Games (Apress, 2015).
Part I
Foundations
© The Author(s), under exclusive license to APress Media, LLC, part of Springer
Nature 2023
M. I. Mihailescu, S. L. Nita, Pro Cryptography and Cryptanalysis with C++23
https://doi.org/10.1007/978-1-4842-9450-5_1

1. Getting Started in Cryptography and


Cryptanalysis
Marius Iulian Mihailescu1 and Stefania Loredana Nita1
(1) Bucharest, Romania

Cryptography and cryptanalysis are two fascinating and highly


technical disciplines that have played a critical role in modern
communication and security. Cryptography is the practice of protecting
data using encryption algorithms, while cryptanalysis is trying to break
those algorithms. Whether you have just become interested in these
topics or have been studying them for some time, this step-by-step
guide helps you get started in the world of cryptography and
cryptanalysis. From understanding the basics of cryptography to
exploring advanced techniques, this guide provides you with all the
necessary information to become an expert in the field. Along the way,
you learn about the history of cryptography, common algorithms and
techniques used in encryption, and the tools and resources available to
help you grow your knowledge. Therefore, let’s get started!
Cryptography is the practice of protecting data by using encryption
algorithms. The word cryptography comes from the Greek words
kryptos, which means hidden, and graphein, which means written. As
such, it has been around for a very long time, but it wasn’t until the
invention of the telegraph that it started to play a larger role in society.
The telegraph was a critical piece of infrastructure in the nineteenth
and twentieth centuries, and it needed a way to secure messages. As a
result, cryptography became more standardized and public knowledge.
The first standardized cipher was the Vigenère cipher, invented in 1553
but not publicly known until 1863. The next major cipher was the one-
time pad, invented in 1917 and the first known completely unbreakable
cipher. The next major advancement in cryptography came with the
invention of the computer and the rise of digital communications. Since
then, there have been many advances in cryptography, including the
invention of the RSA algorithm, which is widely used today.
Knowledge is one of the most important aspects to consider when
designing and implementing complex systems, such as companies,
organizations, and military operations. Information falling into the
wrong hands can be a tragedy and result in a huge loss of business or
disastrous outcomes. To guarantee communication security,
cryptography can encode information so that no one can decode it
without legal rights. Many ciphers have been broken when a flaw or
weakness has been found in their design or enough computing power
has been applied to break an encoded message. Cryptology consists of
cryptography and cryptanalysis, as you see later.
With the rapid evolution of electronic communication, the number
of issues raised by information security is significantly increasing every
day. Messages that are shared over publicly accessible computer
networks around the world must be secured and preserved and have
the proper security mechanisms to protect against abuse. The business
requirements in electronic devices and their communication consist of
having digital signatures that can be legally recognized. Modern
cryptography provides solutions to all these problems.
The idea of this book started from an experience that has been
achieved through three directions: (1) cryptography courses for
students (graduate and undergraduate) in computer science at the
University of Bucharest and Titu Maiorescu University; (2) industry
experience achieved in national and international companies; (3)
ethical hacking best practices; and (4) security audit.
This book aims to present the most advanced cryptography and
cryptanalysis techniques and their implementations using C++20. Most
implementations are in C++20, using the latest programming language
features and improvements (see Chapter 5).
The book is an advanced and exhaustive work, comprehensively
covering all the most important topics in information security,
cryptography, and cryptanalysis. The content of the book can be used in
a wide spectrum of areas by multiple professionals, such as security
experts with their audits, military experts and personnel, ethical
hackers, teachers in academia, researchers, software developers, and
software engineers when security and cryptographic solutions need to
be implemented in a real business software environment, student
courses (undergraduate and graduate levels, master’s degree,
professional and academic doctoral degree), business analysts and many
more.

Cryptography and Cryptanalysis


It is very important to understand the meanings of the main concepts
involved in a secure communication process and to see their
boundaries.
Cryptology is the science or art of secret writing; the main goal is to
protect and defend the secrecy and confidentiality of information
with the help of cryptographic algorithms.
Cryptography is the defensive side of cryptology; the main objective
is to create and design cryptographic systems and their rules. When
you look at cryptography, you can see a special kind of art: protecting
the information by transforming it into an unreadable format called
ciphertext.
Cryptanalysis is the offensive side of cryptology; its main objective is
to study cryptographic systems with the scope of providing the
necessary characteristics in such a way as to fulfill the function for
which they have been designed. Cryptanalysis can analyze the
cryptographic systems of third parties through the cryptograms
realized with them so that it breaks them to obtain useful
information for their business purpose. Cryptanalysts, code breakers,
and ethical hackers deal with cryptanalysis.
Cryptographic primitives represent well-established or low-level
cryptographic algorithms for building cryptographic protocols;
examples include hash functions and encryption functions.
This book provides a deep examination of all three sides from the
practical side of view with references to the theoretical background by
illustrating how a theoretical algorithm should be analyzed for
implementation.
There are many different algorithms and techniques in modern
cryptography. Here are a few of the more common ones.
Symmetric-key algorithms use both sides of a communication to
generate a shared secret key and then use that key to encrypt and
decrypt messages. The most prominent example is AES, which is
used by the US government and many businesses worldwide.
Asymmetric-key algorithms use two different keys to encrypt and
decrypt messages. The most common example is RSA, which secures
websites and applications like Gmail.
Hash algorithms are commonly used to create digital signatures for
data and are sometimes used for message authentication. The most
well-known example is probably the SHA family of hash algorithms.
Trapdoor function algorithms generate digital signatures and are
sometimes used to implement public-key encryption. The most
common example is probably the RSA function.
One-time pad algorithms are the only unbreakable ciphers
requiring truly random keys. The most widely used OTP algorithm is
the Vernam cipher, which was the basis for the encryption used by
the US military in World War II.
Book Structure
The book is divided into 23 chapters divided into three parts: Part I
(Chapters 1–8) covers foundational topics, Part II (Chapters 9–17)
covers cryptography, and Part III (Chapters 18–23) covers
cryptanalysis.
Part I includes topics from beginner to advanced level and from
theoretical to practice. Chapter 2 discusses the basic concepts of
cryptography. Chapter 3 covers a collection of key elements regarding
complexity theory, probability theory, information theory, number
theory, abstract algebra, and finite fields and how they can be
implemented using C++20, showing their interaction with
cryptography and cryptanalysis algorithms.
Chapters 4 and 5 focus on integer arithmetic and floating-point
arithmetic processing. The chapter is vital, and other chapters and
algorithm implementations depend on these chapters’ content. Number
representations and working with them on the computer’s memory can
represent a difficult task.
Chapter 6 discusses the newest features and enhancements of
C++23. It presents how the new features and enhancements are
important in developing cryptography and cryptanalysis algorithms
and methods. It goes through three-way comparison, lambdas in
unevaluated contexts, string literals, atomic smart pointers, <version>
headers, ranges, coroutines, modules, and so forth.
Chapter 7 presents the most important guidelines for securing the
coding process, keeping an important balance between security and
usability based on the most expected scenarios based on trusted code.
Important topics include securing state data, security and user input,
security-neutral code, and library codes that expose protected
resources.
Chapter 8 covers the libraries and frameworks that are developed in
C++/C++23.
Part II covers the most important modern cryptographic primitives.
Chapters 9–16 discuss advanced cryptography topics by showing
implementations and how to approach this kind of advanced topic from
a mathematical background to a real-life environment.
Chapter 9 discusses the basics of one of the most important
branches of cryptography: elliptic-curve cryptography.
Chapter 10 introduces the Lattice Cryptography Library and hot its
works for implementation, pointing out the importance of
postquantum cryptography. Implementations of key exchange protocols
proposed by Alkim, Ducas, Poppelmann, and Schwabe [1] are discussed.
The discussion continues by instantiating Chris Peikert’s key exchange
protocol [2]. The implementation is based on modern techniques for
computing, known as the number theoretic transform (NTT). The
implementations apply errorless fast convolution functions over
successions of integer numbers.
Chapter 11 and Chapter 12 present two important cryptographic
primitives, homomorphic and searchable encryption. For searchable
encryption (SE), Chapter 11 presents a framework using C++23 for SE,
showing the advantages and disadvantages of removing the most
common patterns from encrypted data. Chapter 12 discuss how to use
the SEAL library in practical examples. The SEAL library contains one of
the most important homomorphic encryption schemes: BGV
(Brakerski-Gentry-Vaikuntanathan) [3].
Chapter 13 identifies the issues generated during implementing
(ring) learning with error cryptography mechanisms. It gives an
example of implementing the lattice-based key exchange protocol, a
library used only for experiments.
Chapter 14 is based on the new concepts behind chaos-based
cryptography and how it can be translated into practice. The chapter
generates some new outputs, and its contribution is important for
advancing cryptography as it is a new topic that didn’t get the proper
attention until now.
Chapter 15 discusses new methods and their implementations for
securing big data environments, big data analytics, access control
methods (key management for access control), attributed-based access
control, secure search, secure data processing, functional encryption,
and multiparty computation.
Chapter 16 points out the security issues about the applications
running in a cloud environment and how they can be resolved during
the design and implementation phase.
Part III deals with advanced cryptanalysis topics and shows how to
pass the barrier between theory and practice and how to think about
cryptanalysis in terms of practice by eliminating the most vulnerable
and critical points of a system or software application in a network or
distributed environment.
Chapter 17 introduces you to cryptanalysis by presenting the most
important characteristics of cryptanalysis. Chapter 18 starts by
showing the important criteria and standards used in cryptanalysis,
how the tests of cryptographic systems are made, the process of
selecting the cryptographic modules, the cryptanalysis operations, and
classifications of cryptanalysis attacks.
Chapter 19 and Chapter 20 show how to implement and design
linear, differential, and integral cryptanalysis. These chapters focus on
techniques and strategies, and their primary role is to show how to
implement scripts for attacking linear and differential attacks.
Chapter 21 presents the most important attacks and how they can
be designed and implemented using C++23. You study the behavior of
the software applications when they are exposed to different attacks,
and you see how to exploit the source code. This chapter also discusses
software obfuscation and why it is a critical aspect that needs to be
considered by the personnel involved in implementing the software
process. Additionally, you learn how this analysis can be applied to
machine learning and artificial intelligence algorithms that can be used
to predict future attacks over software applications that are running in
a distributed or cloud environment.
Chapter 22 goes through the text characterization method and its
implementation. It discusses chi-squared statistics; identifying
unknown ciphers; index of coincidence; monogram, bigram, and
trigram frequency counts; quad ram statistics as a fitness measure;
unicity distance; and word statistics as a fitness measure.
Chapter 23 presents the advantages and disadvantages of
implementing cryptanalysis methods, why they should have a special
place when applications are developed in distributed environments,
and how the data should be protected against such cryptanalysis
methods.
As you become more advanced in your study of cryptography, you
want to explore analysis techniques like frequency analysis, letter
analysis, and statistics that can help you break ciphers that are not
completely unbreakable. Sometimes, it is even possible to find flaws in
algorithms and protocols that can be exploited for malicious purposes.
For instance, cryptography is used in WEP and WPA/WPA2 networks to
encrypt data. It has been discovered that cracking the WEP takes less
than 10 minutes and that WPA/WPA2 is relatively easy to crack.

Internet Resources
The Internet has many resources that are very useful in keeping up
with progress in the field.
Bill’s Security Site (https://asecuritysite.com/). This
website contains various implementations of cryptographic
algorithms. Bill Buchanan, a professor at the School of Computing at
Edinburgh Napier University, created and updated the website.
Books by William Stallings [4] [Stallings, 2010 #1] – Cryptography
and Network Security
(http://williamstallings.com/Cryptography/). The site
contains a significant set of tools and resources and provides regular
updates, keeping up with the most important advances in
cryptography.
Schneier on Security (www.schneier.com/). The website
contains sections with books, essays, accurate news, talks, and
academic resources.

Forums and Newsgroups


Usenet newsgroups (deprecated but very useful information can still be
found) is dedicated to some of the important aspects of cryptography
and network security. The following are the most important.
sci.crypt.research is among the best groups for finding information
about research ideas. It is a moderated newsgroup whose main
purpose is to address research topics; most topics are related to the
technical aspects of cryptology.
sci.crypt is a group where you can find general discussions about
cryptology and related topics.
sci.crypt.random-numbers discusses random number generators.
alt.security discusses general security topics.
comp.security.misc discusses general computer security topics.
comp.security.firewalls features discussions on firewalls and other
related products.
comp.security.announce covers CERT news and announcements.
comp.risks discusses public risks from computers and users.
comp.virus features moderated discussions on computer viruses.
Additionally, several forums deal with cryptography topics and
news that are available on the Internet. The following are the most
important.
Reddit Cryptography News and Discussions [5] is a forum group
featuring general information and news about different topics related
to cryptography and information security.
Security forums [6] contain vast topics and discussions about
computer security and cryptography.
TechnGenix – Security [7] is one of the most updated forums
featuring cryptography and information security news. The group is
maintained by world-leading security professionals in the field.
Wilders Security Forums [8] features discussions and news about
the vulnerabilities of software applications due to bad
implementations of cryptographic solutions.
Security Focus [9] is a forum with a series of discussions about
vulnerabilities raised by the implementations of cryptographic
algorithms.
Security InfoWatch [10] discusses data and information loss.
TechRepublic – Security [11] discusses practical aspects and
methodologies for designing and implementing software
applications.
Information Security Forum [12] is a world-leading information
security and cryptography forum. It features conferences, hands-on
and practical tutorials, solving solutions to security and
cryptographic issues.

Security Protocols and Standards


The following are specific standards for cryptography. They specify
which algorithms should be used and how they should be implemented.
There are many different cryptography standards, but the following are
the most important.
Suite B is a set of algorithms and protocols used by the US
government. It contains both symmetric and asymmetric algorithms.
ISO/IEC 17799 is an international standard for information security.
It contains a set of guidelines for cryptography.
BSI TR-02102-1 - BSI – Technical Guideline. Cryptographic
Mechanisms: Recommendations and Key Lengths1 (Part 1)
evaluates the security of a few different cryptographic mechanisms,
providing some longer-term guidance in choosing appropriate
cryptographic algorithms. However, there is no guarantee of
completeness, so the BSI may not necessarily consider schemes that
are not included to be secure.
BSI TR-02102-2. Cryptographic Mechanisms: Recommendations
and Key Lengths, Part 2 – Use of Transport Layer Security (TLS)2
is a technical guideline with recommendations for using the TLS
encryption protocol. In particular, the confidentiality, integrity, and
authenticity of the sent information can be secured by its use for
secure information transfer in data networks.
BSI TR-02102-3. Cryptographic Mechanisms: Recommendations
and Key Lengths, Part 3 – Use of Internet Protocol Security
(IPsec) and Internet Key Exchange (IKEv2)3 is a technical
guideline with recommendations for using IPsec and IKEv2. In
particular, the confidentiality, integrity, and authenticity of the sent
information can be secured by its use for secure information transfer
in data networks.
BSI TR-02102-4. Cryptographic Mechanisms: Recommendations
and Key Lengths Part 4 – Use of Secure Shell (SSH) NIST Special
Publication 800-184 is a technical guideline with recommendations
for using the Secure Shell cryptographic technology (SSH). Within an
insecure network, this protocol can be used to create a secure
channel.
Federal Information Processing Standard 140-2 is a FIPS
standard that specifies cryptographic algorithms and protocols.
Many cryptographic techniques and implementations described in
this book follow the following standards. Standards have been
developed and designed to cover the management practices and the
entire architecture of the security mechanisms, strategies, and services.
The following are the most important standards covered in this
book.
The National Institute of Standards and Technology (NIST)
represents the US federal agency that deals with standards, science,
and technologies related to the US government. Except for the
national goal, NIST Federal Information Processing Standards (FIPS)
and Special Publications (SP) have a very important worldwide
impact.
The Internet Society (ISOC) represents one of the most important
professional membership societies with organizational and
individual members worldwide. ISOC provides leadership in the
issues that are addressed and that confront the future perspective of
the Internet and applications developed using security and
cryptographic mechanisms with respect to the responsible groups,
such as the Internet Engineering Task Force (IETF) and the Internet
Architecture Board (IAB).
The International Telecommunication Union (ITU) represents
one of the most powerful organizations within the United Nations
System. It coordinates and administers global telecom networks and
services with governments and the private sector. ITU-T represents
one of the three sectors of ITU. The mission of ITU-T consists of the
production of standards that cover all the fields of
telecommunications. The standards proposed by ITU-T are known as
recommendations.
The International Organization for Standardization (ISO)
represents a worldwide federation that contains national standards
bodies from over 140 countries. ISO is a nongovernmental
organization to promote the development of standardization and
activities related to activities with a view that it facilitates the
international exchange of services to develop cooperation with
intellectual, scientific, and technological activity. The results of ISO
are as international agreements published as international
standards.
From securing communication and storage of information,
cryptography algorithms and protocols can be seen as guidelines and
protocols used to ensure the secure communication and storage of
information. The following are some widely used cryptography
algorithms and protocols.
The Advanced Encryption Standard (AES) is a symmetric-key
encryption algorithm for encrypting electronic data.
RSA is an asymmetric-key encryption algorithm used for secure data
transmission.
Elliptic-curve cryptography (ECC) is an approach to public-key
cryptography based on the mathematics of elliptic curves.
Secure Sockets Layer (SSL) and TLS are protocols for securing
network communications.
IPSec is a protocol for securing Internet communications at the
network layer.
Pretty Good Privacy (PGP) is a data encryption and decryption
program that provides cryptographic privacy and authentication for
data communication.
These are just a few examples, and many other cryptography
standards are used today.

Cryptography Tools and Resources


There are numerous tools and resources to help you learn more about
cryptography. Here are a few worth checking out.
Cracking Crypto challenges provide a fun way to test your skills and
are great for beginners. There are challenges in both cryptography
and cryptanalysis, so you can pick whichever interests you more.
Dark Reading is a website that publishes news articles on all aspects
of information security. Their cryptography section regularly
publishes articles on the latest developments in cryptography.
There are many great cryptography books. If you prefer reading to
online tutorials, there are plenty of worthy books to choose from.
Coursera, Pluralsight, and Udemy offer online cryptography
courses. These courses vary in length and difficulty and can help
advance your knowledge. The following are some of the most
interesting courses.
Coursera
Cryptography I by Dan Boneh, Stanford University
www.coursera.org/learn/crypto
Cryptography II by Dan Boneh
Stanford University
www.coursera.org/learn/crypto2
Introduction to Applied Cryptography Specialization by William
Bahn
www.coursera.org/specializations/introducti
on-applied-cryptography
Pluralsight
Cryptography: The Big Picture
https://app.pluralsight.com/library/courses
/cryptography-big-picture/table-of-contents
Cryptography: Executive Briefing
https://app.pluralsight.com/library/courses
/cryptography-executive-briefing/table-of-
contents
Cryptography Application
https://app.pluralsight.com/library/courses
/cryptography-application/table-of-contents
Securing Data with Asymmetric Cryptography
https://app.pluralsight.com/library/courses
/asymmetric-cryptography-securing-data/table-
of-contents
Practical Encryption and Cryptography Using Python
https://app.pluralsight.com/library/courses
/practical-encryption-and-cryptography-using-
python/table-of-contents
Building Secure Applications with Cryptography in.NET
https://app.pluralsight.com/library/courses
/dotnet-cryptography-secure-
applications/table-of-contents

Conclusion
The era in which we are living has an unimaginable evolution and
incredible technologies that enable the instant flow of information at
any time and place. The secret consists of the convergence process of
the computer with the networks, a key force that forces the evolution
and development of these incredible technologies from behind.
Cryptography and cryptanalysis are fascinating disciplines that have
played a critical role in modern communication and security. This step-
by-step work help you get started in the world of cryptography and
cryptanalysis by providing you with all the necessary information to
become an expert in programming and how to approach cryptographic
algorithms. From understanding the basics of programming
cryptography algorithms to exploring advanced techniques, this work
helps you explore the fascinating technical disciplines that have played
a critical role in modern communication and security.
This first chapter discussed the objectives of the book and its
benefits. It covered the mission of the book, addressing the practical
aspects of cryptography and information security and its main
intention in using the current work. The increasing process of using
systems that build using advanced information technologies has been
shown to deeply impact our lives every day. All technologies are
proving to be pervasive and ubiquitous.
The book represents the first practical step of translating the most
important theoretical cryptography algorithms and mechanisms to
practice through one of the most powerful programming languages
(C++20).
This chapter accomplished the following.
Each concept was explained to eliminate the confusion between
cryptography, cryptanalysis, and cryptology.
It discussed the book’s structure. A roadmap introduced the
dependencies of each chapter. Each chapter has been presented in
detail, pointing out the main objective.
A list of newsgroups, websites, and USENETs resources provides
sources covering the latest news in cryptography and information
security.
It introduced the most significant standards used in cryptography
and information security.

References
[1]. Alkim, E., Ducas, L., Pö ppelmann, T., and Schwabe, P. (2016). Postquantum key
exchange—a new hope. In 25th {USENIX} Security Symposium ({USENIX}
Security 16) (pp. 327–343).
[2].
Peikert, C. (2014, October). Lattice cryptography for the Internet. In
international workshop on postquantum cryptography (pp. 197–219). Springer,
Cham.
[3].
Brakerski, Z., Gentry, C., and Vaikuntanathan V. (2011). Fully Homomorphic
Encryption without Bootstrapping Cryptology ePrint Archive, Paper 2011/277,
https://eprint.iacr.org/2011/277.
[4].
Stallings, W., Cryptography and Network Security - Principles and Practice. 5
ed. 2010: Pearson. 744.
[5].
Reddit. Cryptography News and Discussions. Available from:
https://www.reddit.com/r/crypto/.
[6].
Forums, Security.; Available from: http://www.security-
forums.com/index.php?
sid=acc302c71bb3ea3a7d631a357223e261.
[7].
TechGenix, Security. Available from: http://techgenix.com/security/.
[8].
Wilders Security Forums. Available from:
https://www.wilderssecurity.com/.
[9].
Security Focus. Available from: https://www.securityfocus.com/.
[10].
Security InfoWatch. Available from:
https://forums.securityinfowatch.com/ .
[11].
TechRepublic – Security. Available from:
https://www.techrepublic.com/forums/security/.
[12].
Information Security Forum. Available from:
https://www.securityforum.org/.
Footnotes
1 See
https://www.bsi.bund.de/SharedDocs/Downloads/EN/BSI/Publicati
ons/TechGuidelines/TG02102/BSI-TR-02102-1.pdf?
__blob=publicationFile&v=6

2 See
https://www.bsi.bund.de/SharedDocs/Downloads/EN/BSI/Publicati
ons/TechGuidelines/TG02102/BSI-TR-02102-2.pdf?
__blob=publicationFile&v=5

3 See
https://www.bsi.bund.de/SharedDocs/Downloads/EN/BSI/Publicati
ons/TechGuidelines/TG02102/BSI-TR-02102-3.pdf?
__blob=publicationFile&v=5

4 See
https://www.bsi.bund.de/SharedDocs/Downloads/EN/BSI/Publicati
ons/TechGuidelines/TG02102/BSI-TR-02102-4.pdf?
__blob=publicationFile&v=5
© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2023
M. I. Mihailescu, S. L. Nita, Pro Cryptography and Cryptanalysis with C++23
https://doi.org/10.1007/978-1-4842-9450-5_2

2. Cryptography Fundamentals
Marius Iulian Mihailescu1 and Stefania Loredana Nita1
(1) Bucharest, Romania

Cryptographic history is incredibly long and fascinating. The Code Book: The Secrets Behind Codebreaking [1]
is a comprehensive reference that provides a nontechnical history of cryptography. In the book, the story of
cryptography begins in approximately 2000 BC, when the Egyptians used it for the first (known) time. It
presents the main aspects of cryptography and hiding information for each period that is covered and
describes the great contribution that cryptography had in both world wars. The art of cryptography often
correlates with diplomacy, military, and government because its purpose is to keep sensitive data, such as
strategies or secrets regarding national security, safe.
A crucial development in modern cryptography is the working paper “New Directions in Cryptography”
[2] proposed by Diffie and Hellman in 1976. The paper introduced a notion that changed how cryptography
was seen until then, namely, public-key cryptography. Another important contribution of this paper is an
innovative way of exchanging keys. The security of the presented technique is based on the hardness
assumption (basically, through the hardness assumption, we refer to a problem that cannot be solved
efficiently) of the discrete logarithm problem. Even though the authors did not propose a practical
implementation for their public-key encryption scheme, the idea was presented very clearly and started to
draw attention in the international cryptography community.
The first implementation of a public-key encryption scheme was made in 1978 by Rivest, Shamir, and
Adleman, who proposed and implemented their encryption scheme, currently known as RSA [3]. The
hardness assumption in the RSA is the factoring of large integers. By looking in parallel between integer
factorization for RSA and Shor’s algorithm, we can note that Shor’s algorithm runs in polynomial time for
quantum computers. This represents a significant challenge for any cryptographer using the hardness
assumption for factoring large integers. The increasing applications and interest in the factoring problem led
to new techniques. Important advances in this area were made in 1980, but none of the proposed techniques
improved the security of the RSA.
Another important class of practical public-key encryption schemes was designed by ElGamal [4] in
1985. These are based on the hardness assumption of the discrete logarithm problem.
Other crucial contributions to public-key cryptography are the digital signature, for which the
international standard ISO/IEC 9796 was adopted in 1991 [5]. The basis of the standard is the RSA public-
key encryption scheme. A powerful scheme for digital signatures based on the discrete logarithm hardness
assumption is the Digital Signature Standard, adopted by the United States government in 1994.
Currently, the trends in cryptography include designing and developing new public key schemes, adding
improvements to the existing cryptographic mechanisms, and elaborating security proofs.
The book’s objective is to provide a view of the latest updates of the principles, techniques, algorithms,
and implementations of the most important aspects of cryptography in practice. It focuses on the practical
and applied aspects of cryptography. You are warned about the difficult subjects and those that present
issues and are guided to a proper bibliography in which best practices and solutions are found. Most of the
aspects presented in the book are followed by implementations. This objective also serves to not obscure the
real nature of cryptography. The book represents strong material for both implementers and researchers.
The book describes the algorithms and software systems with their interactions.

Information Security and Cryptography


This book refers to the term and concept of information as to quantity. To go through the introduction to
cryptography and to show its applicability by presenting algorithms and implementation technologies (such
as C++), first, we need to have a basis for the issues that occur often in information security. When a
particular transaction occurs, all parties involved must be sure (or ensure) that specific objectives related to
information security are met. A list of these security objectives is given in Table 2-1.
Several protocols and security mechanisms have been proposed to defy the issues regarding information
security when the information is sent in physical format (for example, documents). The objectives regarding
information security may be accomplished by applying mathematical algorithms or work protocols to
information that needs to be protected and additionally following specific procedures and laws. An example
of physical document protection is sealed envelopes (the mechanism of protection) that cover the letter (the
information that needs to be protected) delivered by an authorized mail service (the trusted party). In this
example, the protection mechanism has its limitations. But the technical framework has rigorous rules,
through which any entity that opens the envelope and does not have this right needs to be punished. There
are situations in which the physical paper contains the information that needs to be protected, and has
special characteristics that certify the originality of the data/information. For example, to refrain from
forging banknotes, paper currency has special ink and matter.

Table 2-1 Security Objectives

Security Objective Description


privacy/confidentiality The information is kept secret from unauthorized entities.
signature A technique that binds a signature by an entity (for example, a document).
authorization The action of authorizing an entity to do or be something to send the information between
the sender and the receiver.
message authentication The process/characteristic through which the origin of the data is authenticated; another
meaning is corroboration of the information source.
data integrity The information is kept unaltered through techniques that keep away unauthorized
entities or unknown means.
entity The action of validating the identity of an entity, which may be a computer, person, credit
authentication/identification card, and so on.
validation The action of making available a (limited) quantity of time for authorization for using or
manipulating the data or resources.
certification The process of confirming the information by a trusted party.
or
Acknowledgment of information by a trusted certification.
access control The action of restricting access to resources to authorized parties.
timestamping Metadata stamps the time of creation or the existence of information.
witnessing The action of validating the creation/existence of the information made by an entity that
is not the creator of the data.
receipt The action of confirming the receiving of the information.
ownership The action of giving an entity the legal rights to use or transfer a particular
information/resource.
confirmation The action of validating the fact that certain services have been accomplished.
revocation The action of withdrawing certification or authorization.
nonrepudiation The process of restraining the negation of other previous commitments or actions.
anonymity The action of making anonym an entity’s identity involved in a particular action/process.

From a conceptual point of view, how the information is manipulated did not change substantially. We
consider storing, registering, interpreting, and recording data. However, a manipulation that changed
significantly is copying and modifying the information. An important concept in information security is the
signature, which represents the foundation for more processes, such as nonrepudiation, data origin
authentication, identification, and witnessing.
The requirements introduced by legal and technical skills should be followed to achieve the security of
information in electronic communication. On the other hand, the preceding protection objectives are not
guaranteed to be fulfilled accordingly. The technical part of information security is assured by cryptography.
Cryptography represents the field that studies the mathematical techniques and tools that are connected
to information security, such as confidentiality, integrity (data), authentication (entity), and the origin of
authentication. Cryptography not only provides information security but also provides a specific set of
techniques.

Cryptography Goals
From the security objectives presented in Table 2-1, the following represent a basis from which the others
can be derived.
privacy/confidentiality (Definitions 2.5 and 2.8)
data integrity (Definition 2.9)
authentication (Definition 2.7)
nonrepudiation (Definition 2.6)
The following explains each of the four objectives in detail.
Confidentiality represents a service that protects information content from unauthorized entities and
access. Confidentiality is assured through different techniques, from mathematical algorithms to physical
protection, that scramble the data into an incomprehensible form.
Data integrity represents a service that prevents unauthorized alteration of the information. Authorized
entities should be able to discover and identify unauthorized manipulation of data.
Authentication represents a service that has an important role when data or application is authenticated,
and it implies identification. The authentication process is applied on both extremities that use the data
(for example, the sender and the receiver). The rule is that each involved party should identify itself in the
communication process. It is very important that both parties that are involved in the communication
process declare to each other their identity (the parties could be represented by a person or a system). At
the same time, some characteristics of the data should accompany the data itself; for example, its origin,
content, or the time of creation/sending. From this point of view, cryptography branches authentication
into two categories: authentication of the entity and authentication of the data origin. Data origin
authentication leads to data integrity.
Nonrepudiation represents a service that prevents the denials of previous actions made by an entity.
When a conflict occurs because an entity denies its previous actions, it is resolved by an existing sinew
showing the actions made over data.
One of the main goals of cryptography is to fulfill the four objectives on both sides—theory and practice.

Cryptographic Primitives
The book presents several fundamental cryptographic tools called primitives. Examples of primitives are
encryption schemes (Definitions 2.5 and 2.8), hash functions (Definition 2.9), and schemes for digital
signatures (Definition 2.6). Figure 2-1 presents a schematic description of these primitives and their
relationship. Many cryptographic primitives are used in the book, and practical implementations are
provided every time. Before using them in real-life applications, the primitives should be evaluated to check
if the following criteria are fulfilled.
Level of security. It is slightly difficult to quantify the level of security. However, it can be quantified as
the number of operations to accomplish the desired objective. The level of security is usually defined
based on the superior bound given by the volume of work necessary to defeat the objective.
Functionality. To accomplish security objectives, in many situations, primitives are combined. You need
to be sure that they work properly.
Operation methods. When primitives are used, they need different inputs and have different ways of
working, resulting in different characteristics. In these situations, the primitives provide very different
functionalities that depend on the mode of operation.
Performance. This concept is related to the efficiency that a primitive can achieve in a specific mode of
operation.
Ease of implementation. This concept is merely a process rather than a criterion, which refers to the
primitive being used in practice.
Figure 2-1 Cryptographic primitive taxonomy
The application and the available resources give importance to each of the criteria shown in Figure 2-1.
Cryptography may be seen as an art practiced by professionals and specialists who proposed and
developed ad hoc techniques whose purpose was to fulfill important information security requirements. In
the last few decades, cryptography has transitioned from an art to a science and discipline. There are
dedicated conferences and events in many cryptography and information security fields. In addition, there
are international professional associations, such as the International Association for Cryptologic Research
(IACR), whose aim is to bring and promote the best research results in the area.
The current book is about cryptography and cryptanalysis: implementing algorithms and mechanisms
using C++ with respect to standards.

Background of Mathematical Functions


A monograph on abstract mathematics is not a goal of this book. Getting familiar with some fundamental
mathematical concepts is necessary and proves to be very useful in practical implementations. One of the
most important concepts that are fundamental to cryptography is represented by a function in the
mathematical sense. A function is also known in the literature as transformation or mapping.

One-to-One, One-Way, and Trapdoor One-Way Functions


Let’s consider a set that has in its composition a distinct set of objects that are known as elements of that
specific set. The following example represents a set A that has the elements a, b, c, which is denoted as
A = {a, b, c}.
Definition 2.1 [18]. Cryptography is defined as the study of mathematical techniques that are related to
aspects of information security, such as confidentiality, integrity (data), authentication (entity), and
authentication of the data origin.
Definition 2.2 [18]. Consider that sets A and B and rule f define a function. The rule f assigns to each
element in A an element in B. Set A is the domain that characterizes the function, and B represents the
codomain. If a represents an element from A, written as a ∈ A, the image of a is represented by the element
in B with the help of rule f; the image b of a is denoted by b = f (a). The standard notation for a function f
from set A to set B is represented as f : A → B. If b ∈ B, then there is a preimage of b, which is an element
a ∈ A for which f (a) = b. The entire set of elements in B that have at least one preimage is known as the
image of f, denoted as Im(f).
Example 2.3. (function) Consider sets A = {a, b, c} and B = {1, 2, 3, 4}, and the rule f from A to B as
defined as f (a) = 2, f (b) = 4, f (c) = 1. Figure 2-2 represents sets A, B and function f. The preimage of the
element 2 is a. The image of f is {1, 2, 4}.
Example 2.4. (function) Consider set A = {1, 2, 3, ……, 10} and consider f to be the rule that for each a ∈ A,
f (a) = ra, where ra represents the remainder when a2 is divided by 11.

Figure 2-2 Function f from a set A formed from three elements to a set B formed from five elements

The image of f is represented by the set Y = {1, 3, 4, 5, 9}.


The scheme represents the main fundamental tool for thinking of a function (found in the literature
known as the functional diagram), as depicted in Figure 2-2. Each element from the domain A has precisely
one arrow originating from it. For each element from codomain B, you can have any number of arrows
incident to it (including also zero lines).
Example 2.5. (function) Let’s consider the following set defined as A = {1, 2, 3, …, 1050} and consider f
to be the rule f (a) = ra, where ra represents the remainder in the case when a2 is divided by 1050 + 1 for all
a ∈ A. In this situation, it is not feasible to write down f explicitly, as in Example 2.4. The function is
completely defined by the domain and the mathematical description that characterize the rule f.

One-to-One Functions
Definition 2.6 [18]. Consider a function or transformation 1 − 1 (one-to-one) if each of the elements that
can be found within the codomain B is represented as the image of at most one element in the domain A.
Definition 2.7 [18]. Let’s consider that a function or transformation is onto if each of the elements found
within the codomain B represents the image of at least one element that can be found in the domain. At the
same time, a function f : A → B is known as being onto if Im(f) = B.
Definition 2.8 [18]. Function f : A → B is considered 1 − 1 and Im(f) = B, and function f is called bijection.
Conclusion 2.9 [18]. If f : A → B is considered 1 − 1, then f : A → Im (f) represents the bijection. In
special cases, if f : A → B is represented as 1 − 1 and A and B are represented as finite sets with the same size,
then f represents a bijection.
Using the scheme and its representation, if f is a bijection, then each element from B has exactly one line
that is incident with it. The function shown and described in Examples 2.3 and 2.4 does not represent
bijections. As you can see in Example 2.3, element 3 does not have the image of any other element that can
be found within the domain. In Example 2.4, each element from the codomain is identified with two
preimages.
Definition 2.10 [18]. If f is a bijection from A to B then it is a quite simple matter to define a bijection g
from B to A as follows: for each b ∈ B we define g(b) = a where a ∈ A and f(a) = b. The function g is obtained
from f, and it is called the inverse function of f and denoted as g = f−1.
Figure 2-3 Representation of a bijection f and its inverseg = f−1
Example 2.11. (inverse function) Consider sets A = {a, b, c, d, e} and Y = {1, 2, 3, 4, 5} and the rule f, which
is given and represented by the lines in Figure 2-3. f represents a bijection, and its inverse g is formed by
reversing the sense of the arrows. The domain of g is represented by B, and the codomain is A.
Note that if f is a bijection, then f−1 is also a bijection. The bijections in cryptography are tools used for
message encryption. The inverse transformations are used for decryption. The main condition for
decryption is for transformation to be a bijection.

One-Way Functions
In cryptography, certain types of functions play an important role. A definition for a one-way function is
given as follows.
Definition 2.12 [18]. Let’s consider a function f from a set A to a set B that is called a one-way function if
f(a) proves to be simple and easy to compute for all a ∈ A. But for “essentially all” elements b ∈ Im (f), it is
computationally infeasible to manage to find any a ∈ A in such a way that f(a) = b.
Note 2.13 [18]. This note represents some additional notes and clarifications of the terms used in
Definition 2.12.
For the terms easy and computationally infeasible, a rigorous definition is necessary, but it distracts
attention from the general idea that is being agreed upon. Fur the goal of this chapter, the simple and
intuitive meaning is sufficient.
The words “essentially all” stand for the idea that there are a couple of values b ∈ B for which it is easy to
find an a ∈ A in such a way that b = f(a). For example, one may compute b = f(a) for a small number of a
values, and then for these values, the inverse is known by a table look-up. A different way to describe this
property of a one-way function is as follows: for any random b ∈ Im (f), it is computationally feasible to have
and find any a ∈ A in such a way that f(a) = b.
The following examples show the concept behind a one-way function.
Example 2.14. (one-way function) Consider A = {1, 2, 3, …, 16} and define f(a) = ra for all the elements
a ∈ A, where ra represents the remainder when 3x is divided by 17.

a 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
f(a) 3 9 10 13 5 15 11 16 14 8 7 4 12 2 6 1

Let’s assume a number situated between 1 and 16. You see that it is very easy to find its image under f.
Without having the table in front of you, for example, for 7, it is hard to find a given that f(a) = 7. If the
number you are given is 3, then is quite easy that a = 1 is what you need.
Remember that this is an example focused on very small numbers. The key thing here is that the amount
of effort to measure is different f(a) and the amount of work in finding a given f(a). Additionally, for large
numbers, f(a) can be efficiently computed using the square-and-multiply algorithm [20], where the process
of finding a from f(a) is harder to find.
Example 2.15 [18]. (one-way function) A prime number is defined as a positive integer. The integer is
larger than 1, and its positive integer divisors are 1 and itself. Let’s take into consideration the primes
p = 50633 and q = 58411, compute n = pq = 50633 · 58411 = 2957524163, and let’s consider A = {1, 2, 3, …,
n − 1}. We define a function f on A by f(a) = ra for each a ∈ A, where ra represents the remainder when x3 is
divided by n. For example, let’s consider f(2489991 = 1981394214 since
24899913 = 5881949859 · n + 1981394214. Computing f(a) represents a simple task, but reversing the
procedure is difficult.

Trapdoor One-Way Functions


Definition 2.16 [18]. A trapdoor one-way function is represented as a one-way function f : A → B with an
extra property that has information (also known as the trapdoor information); it is much more feasible to
have an identification for any given b ∈ Im (f), with an a ∈ A in such a way that f(a) = b.
Example 2.15 shows the concept of a trapdoor one-way function. With extra information about the
factors of n = 2957524163, it becomes much easier to invert the function. The factors of 2957524163 are
large enough that it would be difficult to identify them by hand calculation. You should be able to identify the
factors very easily with the help of some computer program. For example, if you have very large, distinct
prime numbers (each number has approximately 200 decimal digits), p and q, with the technology of today,
finding p and q from n is very difficult even with the most powerful computers, such as quantum computers.
This is the well-known factorization problem known as the integer factorization problem.
One-way and one-way trapdoor functions form the fundamental basis for public-key cryptography. These
principles are very important and become much clearer later when the implementation of cryptographic
techniques occurs. It is vital and important to understand these concepts from this section as the main
methods and the primary foundation for the cryptography algorithms to implement later in this chapter.

Permutations
Permutation represents functions that are in cryptographic constructs.
Definition 2.17 [18]. Consider S to be a finite set formed of elements. A permutation p on S represents a
bijection, as defined in Definition 2.8. The bijection is represented from S to itself, p : S → S.
Example 2.18 [18]. This example represents a permutation example. Let’s consider the following
permutation S = {1, 2, 3, 4, 5}. The permutation p : S → S is defined as follows.

A permutation can be described in different ways. It can also be written as an array, as follows, in which
the top row in the array is represented by the domain and the bottom row is represented by the image
under p as mapping.

As the permutations are bijections, they have inverses. If the permutation is written as an away (second
form), its inverse is very easily found by interchanging the rows in the array and reordering the elements
from the new top row, and the bottom row has to be reordered accordingly. In this case, the inverse of p is
defined as follows.

Example 2.19 [18]. This example represents a permutation example. Let’s consider A to be the set of
integers {0, 1, 2, …, p · q − 1}, where p and q represent two distinct large primes. We also need to suppose
that neither p − 1 nor q − 1 can be divisible by 3. The function p(a) = ra, in which ra represents the remainder
when a3 is divided by pq, can be demonstrated and shown as the inverse permutation. The inverse
permutation is currently computationally infeasible by computers unless p and q are known.

Inclusion
Involutions are known as the functions having their own inverses.
Definition 2.20 [18]. Let’s consider a finite set S and f defined as a bijection S to S, denoted as f : S → S. In
this case, the function f is noted as involution if f = f −1. Another way of defining this is f (f (a)) = a for any
a ∈ S.
Example 2.21 [18]. This example represents an involution case. Figure 2-4 depicts an example of
involution. Note that if j represents the image of i, then i represents the image of j.
Figure 2-4 Representation of an involution with a set S with five elements

Concepts and Basic Terminology


It is very difficult to see and understand how cryptography was built using hard and abstract definitions
when dealing with the scientific side of the field. The following lists the most important terms and key
concepts that are used in this chapter.

Domains and Codomains Used for Encryption


is shown as a finite set known as the alphabet of definition. Consider as an example , which
represents the binary alphabet, a frequently used alphabet as a definition.
is a set known as the message space. The message space has strings of symbols from an alphabet, .
As an example, may have binary strings, English text, French text, and so on.
is the ciphertext space. has strings of symbols from an alphabet, , which is totally different from
the alphabet defined for . An element from is called ciphertext.

Encryption and Decryption Transformations


The set is called the key space. The elements of are called keys.
For each , there is a unique transformation Ee, representing a bijection from to (i.e.,
). Ee is called the encryption function or encryption transformation. If the encryption process
is reversed, then Ee should be a bijection, such that each unique plain message is recovered from one
unique ciphertext.
For each , there is a transformation Dd, representing a bijection from to (i.e.,
). Dd is called a decryption function or decryption transformation.
The process of encrypting the message or the encryption of m consists of applying the
transformation Ee.
The process of decrypting the ciphertext or the decryption of c consists of applying the
transformation Dd over c.
An encryption scheme has two important sets: , which represents the set of encryption
transformations, and , which represents the set of decryption transformations. The relation
between the elements of the two sets is the following: for each , there exists a unique key
such that ; in other words, we have the relationship Dd(Ee(m)) = m for all . Another
term for encryption schemes is cipher.
In the preceding definition, the encryption key e and the decryption key d form a pair, usually denoted (e,
d). In symmetric encryption schemes, e and d are the same, while in asymmetric (or public-key)
encryption schemes, they are different.
To construct an encryption scheme, the following components are needed: the message (or plain-text)
space , the cipher-space , the key space , the set of encryption transformations and
Random documents with unrelated
content Scribd suggests to you:
She sat down on a footstool, folded her hands and looked up at
her uncle. “Funny old fing!” she said, wrinkling her nose; “you didn’t
know I was coming, did you?”
Marcus said he had had no idea.
“Diana said you didn’t.”
“Say your poem, Shan’t,” said Diana. “It’s her own—her very own,”
she added. “Go on, Shan’t.”
“I forget it.”
“How can you forget it when it’s your own?”
“Well, I have.”
“Shan’t—One-two-three.”
Marcus knew it to be the fashion among poets to read their own
works. He wondered if they needed treatment as drastic as this, or if
they did it more willingly? In the muse of charity perhaps they did.
“One—two—three,” said Diana sternly, and Shan’t began:

“Swing me higher,
Oh, Delia, oh, Delia!
Swing me over the garden wall—
Only do not let me fall.

“Found in the garden


Dead in her beauty.
Was she not a dainty dish
To set before the king?”

All this very, very fast, and at the end of it Shan’t, pink and
breathless, as any poet should be after being called upon to recite
his own poem half an hour after breakfast.
“Does your aunt know you’re here?” asked Marcus.
“She does—now,” said Shan’t seriously.
“How did you get away without being seen?” Marcus thought that
no well-brought-up child could ever escape from its Nannies and
nursery-maids. The safety of England depended on the safeguarding
of her children. He had heard that said, and he knew there were
societies to enforce it because he had subscribed to them.
Up sprang Shan’t, the better to tell her story. A dramatic sense
was hers. “I ran down the back stairs—and I ran down the drive—
and I ran down the garden—and I ran froo the gates—and I ran
down the road and I ran over the be-ridge. And then I didn’t run any
—more. I just waited for Diana—and we came.”
A deep sigh followed this statement. The air escaping from an air
cushion was the only thing Marcus could think of that compared with
the exhaustiveness of the sigh. At that moment Pillar brought a
telegram and Mr. Maitland opened it. Pillar glanced quickly at the
child and Shan’t’s smile proclaimed him her friend. He was on her
side.
“Diana, it is from your aunt,” said Marcus; “she says, ‘Return
Shan’t at once’!”
“No,” said Shan’t; “shan’t if I don’t want to.” And she was off and
out of the room, out of the front door, opened by the telegraph boy,
who boylike was always as ready to let anything out as he was to
catch and cage anything, through the door into the street: across the
road and into the square through the garden gate that stood ajar.
“Let her run!” called Diana to her vanishing uncle; “she’ll soon tire.”
But Marcus had gone in eager pursuit. He crossed the street, was
through the gate and on to Shan’t before she had gone many yards
down the straight path that ran through the square. He caught her in
his arms. “By Jove, how she wriggles!” There was imminent danger
of the uncle being left with the clothes of Shan’t in his arms, and no
Shan’t. Appreciating the danger he relaxed his hold. Off she went,
but to be caught again, and easily enough. She was hot. He could
feel her heart beating in her small body, as a bird might flutter
against the bars of the cage that imprisons it. She was such a little
thing. “Shan’t,” he said, “come here.” He drew her towards him; he
sat down and lifted her on to his knee.
“Shan’t if I don’t want to!” she whispered.
“But you’re going to want to.”
“Always do—mostly always do,” she said, crying softly; not really
crying, she assured him, smiling.
“Look here,” said her uncle, “d’you know what you are?”
“Lucky little devil,” she hazarded.
“Well—but seriously—a good little girl—and such a willing little
beggar, isn’t that it?”
She nodded. “Always—mostly always.”
“Look here—willing little beggars always do what they are asked
and Aunt”—Marcus paused—“Aunt—what do you call her?”
“Elsie—only-aunt-in-the-world.”
“There are others, of course,” said Marcus stiffly; “Aunt Elsie—”
“Only-aunt-in-the-world,” said Shan’t; “say it!” She laid a finger on
his lips.
“Well, Aunt Elsie-only-aunt-in-the-world wants you to go back to
her because she’s lonely.”
“She’s got free dogs!”
“Free?”
“One—two—free—” “Free” found the tip of Shan’t’s forefinger
lightly laid on the tip of Marcus’s nose.
“Yes; but she wants you—and if you are a good little girl and go
back you shall come again and stay—”
“When?”
“We might say Christmas-time.”
“When else?”
“—Easter, perhaps.”
“We have eggs at Easter,”—this softly reminiscent.
“You shall have eggs here.”
“What inside of them?”
“Oh—little presents.”
“What little presents? Whistles?”
“Yes, I dare say.”
“And knives?”
“I shouldn’t be surprised.”
“Why wouldn’t you?”
“Because I should know.”
“What would you know?”
“Well, about the knives.”
“Would you guess?”
“I expect so.”
“I’ve thought of something—No, you do!”
“I think of something?”
“Yes. Have you?”
“Yes.”
“Is it animal, vegetable, or amiable?”
“It’s animal.”
“Is it in this room?”
Marcus gently pointed out that they were not in a room, and Shan’t
pointed out less gently that he wasn’t playing properly. Marcus had
had very serious thoughts as to whether he should allow Shan’t’s
version of animal, vegetable, or mineral to pass unquestioned, or
whether he should tell her she wasn’t playing the game?
“Is it the poker?” asked Shan’t.
“A poker isn’t animal.”
“Then you should have said it was amiable—that’s what pokers
are. I did guess quickly, didn’t I?”
At this moment Diana joined them, and the inhabitants of the
square garden saw the unusual sight of that rather unfriendly Mr.
Maitland sitting on a garden seat, with a child on his knee, while a
girl, a very attractive girl, stood by, egging him on as it were.
“She’s going back to Aunt Elsie, Diana,” he said.
“Only-aunt-in-the-world—Say it,” said Shan’t.
He said it, repeating, “She’s going back.”
“Shan’t if I don’t want to.”
“But you will, Shan’t,” said Diana, “because—look at me!”
Shan’t threw back her head and looked at Diana.
“Because I—want you to,” said Diana.
Shan’t slipped off her uncle’s knee, ran across the grass, over the
road, in at the hall door, at which Pillar was standing, into the dining-
room, and laid her head on a chair and sobbed.
“Poor little beggar,” said Diana.
“Diana, shall I?” He was longing to comfort her.
“No, you’ll spoil it all. You can’t give in now—if you say a child
must do a thing, make her do it. You have lost your chance.”
As one convicted of a crime Marcus returned to the dining-room.
When Pillar came into the room he looked at Mr. Maitland as he had
never looked at him before—looked as if he were saying: “A little
sunshine comes into the house and you shut it out—you draw down
the blinds!”
It fell to the lot of Mrs. Oven to take Miss Shan’t back to her aunt.
She called her Miss Charlotte, thinking Shan’t was but the correct
way of pronouncing Charlotte. She had lived with a Lady Harriet who
had been very particular to pronounce her name curiously, and Mrs.
Oven recognized a distinction attached to curiously pronounced
names and respected those who knew how to pronounce them.
“You see, Diana,” explained her uncle, “I am delighted to have
you, but two extra in the house do make a difference, especially
when the second one is a child. There are the servants to consider,
and besides there is your aunt—”
Diana said Aunt Elsie would never let him have Shan’t, so he
needn’t worry.
“My dear Diana, your aunt has not the power to prevent me from
having Shan’t if I wish to—”
“You will wish to. The day will come when you will find you can’t
live without her. I can’t imagine what I shall do without her, but I quite
see you can’t have two of us—it’s too darling of you to have me, and
Aunt Elsie must be considered.”
“With your Aunt Elsie I have nothing whatever to do. I owe her no
consideration. I don’t know her—”
“All right, darling, don’t be flurried. She doesn’t want to know you.
She dislikes you quite amazingly.”
“Why should she?” asked Marcus, finding the unreasonableness
of women difficult to understand.
That evening Mr. Maitland offered Pillar Zoo tickets for Sunday.
“No, thank you, sir; I would not deprive another more fitted—”
“There’s a new baby giraffe.” This was an attraction never before
known to fail in its lure.
“Oh, well, sir, at the Zoölogical Gardens one’s mind harks back, as
it were, to children. It’s better not to think of children when you’re in a
house where there are none, and none to come—so to speak.”
The next day Marcus got a letter from the only aunt in the world
and the letter ran as follows:

Dear Mr. Maitland,—I think it should be clearly


understood before we go any further that I have as much
right to my brother’s children as you have to the children
of your sister. I do not wish to stand in Diana’s way and I
am delighted she should have such a chance as you are
giving her, but Shan’t is mine. Her mother did not leave
her in your charge. She left her in mine. She is a most
charming companion, but would be utterly lost upon a
bachelor—as you appear to be—living in London.
If, however, at any time you should agree to lend me
Diana for a week, I will lend you Shan’t. But it must be
quite clearly understood that you do not have both
together, at any time. If the two sisters should wish to be
together, and it is only natural they should, I think their
mother would say the place for them to be together is
here. You are not likely to appreciate the extraordinary
character of Shan’t, and it is quite possible the child would
wear herself out as your slave. With Diana there is no
such danger. You will find her delightful, but the slaving
must be on your side. Shan’t has just returned safely, so
far as I can see none the worse for her adventure. I must
thank you for sending her back in the care of so
respectable and excellent a woman. Shan’t has a name,
by the way: it is Elsie; you must have known it.
Yours truly,
Elsie Carston

“A most disagreeable letter,” said Marcus as he folded it and put it


into his pocket, to re-read later. “A most uncalled-for letter. I sent the
child back at once. Most men would have kept her.”
He began then and there to wonder why he had not kept her. Talk
of dogs! (Miss Carston was devoted to dogs, it seemed.) What dog
had ever attracted him as Shan’t had done? What dog had ever
looked so willing? Not even a retriever was so humbly anxious to do
anything in the world to please. She was such a jolly little thing to
hold—so small—so easily crushed—funny, jolly little thing! Why
should Miss Carston have her? Under the care of Miss Carston she
would grow up a suffragette; would grow up everything a man would
wish a girl not to be; self-opinionated, strong-minded, argumentative;
always right, never wrong. It was a horrible thought. And Pillar had
been perfectly willing that Shan’t should stay. If Pillar didn’t mind,
who should?
It was only right that Diana and Shan’t should not be separated.
Miss Carston could have Dick in the holidays. That should satisfy
her. If anything could satisfy a nature so exacting!
VI

A man may win; the woman keeps the winnings.

S O far Elsie had won—so she thought. She had got Shan’t back,
but Shan’t, with the glamour of London upon her, was restless,
longing to talk, aching to tell all she had seen and heard in London
—“darlin’ old London.” But Aunt Elsie was obdurate. She did not
want to hear anything about Uncle Marcus, and London was Uncle
Marcus just as Uncle Marcus was London. She wanted to know what
Shan’t had remembered of her Bible lesson? What she had
remembered about Zacharias? She had learnt all about him just
before she had gone to London!
“Did I?” asked Shan’t, doubting, but open to conviction.
Before Aunt Elsie, as a prisoner before the judge, she stood. She
made one or two manœuvres, the first to make Aunt Elsie smile; the
next to distract her attention. But Aunt Elsie neither smiled nor
allowed her attention to be distracted. “Tell me what you remember
about Zacharias,” she said.
Shan’t sighed. It was no good. “Zacha-ri-as?” she pondered. She
stood first on one leg, then on the other. What did she remember?
Raising pellucid eyes to Aunt Elsie, and higher still to Heaven, she
began, “Zacharias was—a just man and he stood before the altar of
the Lord—and—an angel came to him and said, ‘Zacharias, you are
goin’ to have a baby,’ and Zacharias said, ‘I am not,’ and the angel
said, ‘I beg your pardon, you are, and what’s more you’ll be dumb till
you get it—’ That’s all,” said Shan’t.
“You know that wasn’t what you learnt, Shan’t.”
“Wasn’t it?” she said surprised; then added, “It’s a pity, isn’t it?”
She looked at her Aunt Elsie, and Aunt Elsie saw with relief Mrs.
Sloane coming towards her. She had never loved her neighbour
better, and she had always loved her well.
As she walked along Mrs. Sloane bowed to those flowers she
knew by sight, recognized and spoke to those she personally knew,
and exclaimed she had never met another. A garden-lover was she
in another woman’s garden. A generous visitor! There was nothing
that grew in her garden better than in Elsie’s. She never said: “Ah,
yes, of course, the same thing exactly, but mine are deeper—richer
in colour; a matter of soil, of course. That only three inches high!
Why, mine grew that in one night—a much better night, of course. It’s
only a question of—”
Mrs. Sloane never said the wrong thing in the gardens of others.
She was dearly loved in consequence, and every gardener felt in her
presence a better gardener than he really was—just as every man
felt a better man. And that, after all, is a good woman’s work in life,
to make men feel better than they are—for by the time they grow
accustomed to the feeling and get over the shyness it entails, they
find it has become a habit and they are better.
It could be truthfully said of Mrs. Sloane, as was said of somebody
by somebody—that whatever her age she didn’t look it. The tribute
savours of the wit and understanding of Sidney Smith, whose
judgment on the matter of babies is almost as well known as
Solomon’s. Mrs. Sloane was triumphantly young, although to Shan’t
she was a very, very old lady; but Shan’t was too young to recognize
youth when she met it in the guise of old age.
Across the lawn, to the rescue of Aunt Elsie, came Mrs. Sloane.
She wore a mushroom hat and gardening gloves and used a spud
as walking-stick. “How goes the war?” she asked.
“You may go, Shan’t,” said Aunt Elsie.
“You got her back, then? With or without difficulty?”
“You may go, Shan’t.”
“I came back with Mrs. Oven,” said Shan’t, swinging her leg,
reluctant to go.
“Shan’t, you may go.”
At that moment Shan’t would rather have turned head over heels.
She would have found it easier.
“Run along, darling.”
“Must I?”
“Must she?” asked Mrs. Sloane.
Shan’t edged nearer, leant up against Mrs. Sloane, who slipped an
arm round her. “Did you have a nice time?” she whispered.
“Diana’s got b-blue silk curtains on her bed.”
“Has she? Is she very happy?”
Shan’t nodded. “I watched her dress. Then I went downstairs—
and Uncle Marcus didn’t know I was comin’—he was surprised—”
“Run along, Shan’t; you must do what I tell you, whatever you did
with your uncle—”
Shan’t walked away backwards, stopped to seize Marcus,
clutched at every excuse to linger—every daisy became a valid
excuse—
“This is what comes of going to London,” said Aunt Elsie; “I knew
what it would be.”
Shan’t walked away trailing her feet as she went, stubbing the toes
of her shoes into the ground—disgusted with life. No one ran after
her—made much of her and begged her to be good when she was
good all the time. She had liked Pillar! He had “amoozed” her. She
had liked Mrs. Oven! London! everything! Moreover, Diana was there
—Diana, whom she adored; life without her was dull. Shan’t wished
it was tea-time.
“Now tell me,” said Mrs. Sloane to Elsie.
“There is nothing to tell. Shan’t went with Diana. It was very wrong
of Diana. The child, of course, wasn’t to blame. I wired for her and he
sent her back at once, in the care of a most excellent woman. She
looked a good cook—you can tell, can’t you?”
“At a glance, just as easily as you can tell a good coachman—or,
for the matter of that, a good clergyman—”
“Talking of clergymen—” And Elsie unburdened her heart about
Shan’t and Zacharias.
“Dear Zacharias!” said Mrs. Sloane; “I wonder if he had a sense of
humour.” This was beside the point, so Elsie brought her back to the
odious uncle, who obviously had none. What should she do? It was
evident he had designs upon the children, he might even kidnap
them. She didn’t trust him a yard. Mrs. Sloane suggested counter-
attractions. Sparks lit in the eyes of the harassed aunt. What
distraction could the country offer that could compare with the
attraction of London?
“There is no reason a dance should not be given when you want
Diana back—a dance in the country is very delightful, so long as it
be sufficiently well done, and the right people come, and the right
band plays, and the bright moon shines.”
“Who would give one?—you wouldn’t?” This was a bow at a
venture.
“And why not in so good a cause?”
“You are an angel.”
“It is not the first time I have been told so when I have but done my
most obvious duty against my neighbour’s enemy.”
“There is no one like you.”
“There is much to be thankful for. By the way, does Mr. Watkins
come and doze these days in your garden?”
Mr. Watkins, the literary recluse, of whom Lady Carston was
afraid, had taken to sitting in Miss Carston’s garden. He found he
could write better, read better, and dream better there than
anywhere. The peace of it all he found wonderfully soothing. The
clatter of the milk-pails at the farm distracted him: the lowing of the
cows depressed him (it made him feel the bitterness of his
loneliness): the squealings of the pigs were too suggestive: the
cackling of hens reminded him of women he had known and would
fain forget.
“He must enjoy these lovely days,” said Mrs. Sloane slyly.
Elsie said he had not been for some time. She supposed he was
busy.
“And Mr. Pease, the curate? His rooms were so stuffy, he said;
didn’t he? Does he come? I suppose so?”
No, Elsie was bound to admit that the curate had not been for
some time. She supposed he, too, was busy.
And Mrs. Sloane went on her way smiling. “Diana! Diana!” she
said to herself, “oh, to be young again! How you must enjoy it all!”
She stopped. “Well, well, my dear! I never expected to see you
rioting like this. Why are you so shy in some gardens? What’s this
about not growing unless you are put in a draughty place?” And she
lifted a trail of Tropæolum and put it on its right way.
Just outside Elsie’s gate Mrs. Sloane met Mr. Watkins. “You are
coming in?”—and she held the gate open.
“Not to-day, I think,” said the weary Mr. Watkins, adding something
about his soul’s solitude,—“not to-day!”
“You should not keep all your beautiful thoughts to yourself,” said
Mrs. Sloane. It was perhaps an unfortunate remark, because Mr.
Watkins hastened to inform her that for two and sixpence, postage
paid, she could read his latest and best—whatever the critics might
choose to say.
“Yes, yes, of course,” said Mrs. Sloane, “but I am sure you have
thoughts that are too beautiful to be put into words, on paper! They
may pass from true friend to true friend—in the quiet of a friend’s
garden. Among the flowers words may be spoken that printer’s ink
would blur.”
Now Mr. Watkins felt that this dear old lady was trying to encroach
upon his garden of thought, to wander down the paths of beautiful
thoughts which were for his feet alone to travel. If any one in
Bestways said beautiful things he surely was the one to do it, so he
thought a moment, waved his hand, and smiling sadly murmured:
“They come and go—lighter than air, finer than gossamer, ephemeral
—butterflies—butterflies of thought, transparent—nebulous—”
“Moonshine!” said Mrs. Sloane, delighted to have found a word. If
she had had less than ten thousand a year Watkins would have
been very deeply pained. But as she was said to have rather more
than that he was amused.
“You may want to sit in the garden—Miss Carston’s garden—again
some day. Don’t let the briars grow over the path, or you may not
find it again.”
“What does she mean?” thought Mr. Watkins, as he went on his
way thinking sadly of Diana, who alone in Bestways had had the
power to inspire him.
A little further on Mrs. Sloane met the curate. “Going to Miss
Carston’s garden?” she asked.
“No, I wasn’t.” He stopped. “Do you think I ought? Would it be
politic?” he asked.
And Mrs. Sloane told him he would be a bishop one day.
“That’s what you meant?” he asked.
“You are brighter than Mr. Watkins.”
“I might be that without setting the Thames on fire, mightn’t I?”
Mrs. Sloane went on her way, and Mr. Pease on his, both thinking
of Diana. What a ripping old lady Mrs. Sloane was! Of course, if he
didn’t go and sit in Miss Carston’s garden when Miss Diana was
away—it would look as if he only went there to see Miss Diana!—
and he felt the ghost-like grip of gaiters on his legs.
VII

Where trespassers are not prosecuted they must


pray to be forgiven; or else change their ways.

O F course Sibyl’s friends were surprised that she should have left
her children, and of course they said so; what are friends for if
they do not say what they think?
Said one: “I should be afraid to love a man so much; he might die.”
Said another: “Is that reason enough for not loving a man?” Another,
a great friend, found it an extraordinary thing leaving her girl, just out.
“You know what the girl says of her mother?” asked another. “She
says she is grande amoureuse!”
“Most extraordinary leaving her,” said yet another, having nothing
more original to say.
It was passed along the dado of dowagers at a ball and most of
them agreed. Only one said a husband came first, but she was a
moderately young dowager with a tilted tiara and memories in her
eyes.
“When he’s young,” suggested another.
“Yes, but Eustace is old enough to look after himself,” several
agreed.
Meanwhile Marcus looked after Diana. She found him curiously
and delightfully old-fashioned—much more so than Aunt Elsie.
She loved to tease him about his collections. “That darling little
Ming thing,” she said, with her head on one side, an invitation to
correction.
He wished she would speak more reverently of the Chinese—“The
Ming thing, as you call it—”
“Darling Ming thing,” interposed Diana, with her head on the other
side.
“—As you call it,” went on Marcus, disapproving her attitude of
irreverence, “is a thing before which experts bow.”
“Worshipping it as its maker worshipped his ancestors.”
“I wish I could educate you, Diana, to speak wisely, at all events.”
“Is ‘darling little Ming thing’ not wise?” she asked. “Well, now,—let
us consider it. If it’s not darling, what is it? You won’t let me call it
dear, and it’s not impatient—obstructive—indifferent—argumentative
—callous—but it is darling, just darling. Soft to the touch—pleasing
to the eye—a very ready-money way of spending. Do you know what
you could do with what you paid for that darling little Ming thing?”
Marcus shook his head.
“You could take a baby from its earliest days, from its cradle—you
could feed it, clothe it. You could teach it to write, to talk (when
spoken to), to spell—talk wisely, write wisely, and spell correctly. You
could send it to school—privately, publicly. You could college it—if it
scholarshipped itself. You could train it in the business way it should
go. It might become a politician, a financier, a collector of Chinese
porcelain—or a useful member of society and a good citizen; and for
all that there stands the darling little Ming thing in a cabinet—
untouched by housemaids.”
“You ridiculous child,” said Marcus, and his thoughts flew to that
girl who had taken in her dogskin-gloved hands a vase less beautiful,
infinitely less valuable, than any in his collection, yet most desirable.
“Aunt Elsie’s got a delicious powder-blue vase,” said Diana.
“Has she?” said Marcus, knowing the kind of blue china women
with country cottages invest in.
Marcus was not so wise as he thought. Diana discovered that
before she had been in his house a week. While she was
discovering him not so very wise, he was finding her delightfully
sympathetic. Discounting her understanding—certain of her
sympathy—he unburdened his soul to her because, he said, she
must have suffered just as he had. Her mother’s absorption in her
father must have grieved her: she must have felt out of it: she and
Dick too—
“You think that? How strange!” said Diana, her chin in her hands,
her eyes looking at him with their habitual expression of
understanding. “Why, Dick and I have often discussed it and we think
quite differently. We are so glad she should have that tremendous
happiness. We love to see her. An ordinary humdrum affection would
never have satisfied her. I believe their love for each other is the kind
of which you read in history—more particularly in French memoirs—
it’s almost terrifying. She’s his inspiration and without her he isn’t
himself. The sympathy between them is amazing. Once when I was
ill—he was away—she tried to keep it from him; she said nothing in
her letters and he telegraphed: ‘What is it? Tell me.’ It’s no use
standing against that, my Uncle Marcus, and we don’t want to. No
one could be more to me than Mummy is, but Dick and I are very
near to one another,—nearer than most brothers and sisters,—and
somehow or other we feel as if we ought to be more understanding
than most children whose parents don’t understand each other at all
—See?”
“Yes—and if you marry—as your mother married?” said Marcus,
still seeking an excuse for the hurt that was within him—even now.
Diana said: “If I did, Dick would be very pleased. Love can’t be
selfish and live—even Shan’t says, ‘Love can’t be shelfish,’ and it
can’t.”
“Then I don’t love,” said Marcus ruefully.
“Yes, my uncle, you do.”
“It’s a devilish selfish kind of love, then.”
“It is that,” agreed Diana softly.
“I can’t,” confessed Marcus, “bear to think of your aunt waiting to
snatch you from me. She’s so violent.”
Diana laughed. “What a delightful description of Aunt Elsie!”
“Tell me—what is she like?”
“She’s devilish unselfish—very charming—and she wears an
elastic to keep her hat on—”
“Don’t!” said Marcus; he had had enough.
There entered into Marcus’s soul a great peace (when he could
forget the aunt); into his house floods of sunshine. The blinds were
pulled up, right up to the top, let go with a bang. The things in his
house that he had accounted beautiful must now court comparison
with a slip of a girl, who to her uncle’s mind was the very first
expression of beauty. Imagine, then, his chagrin when, one night at a
ball, a friend of his, who had bought for him many of his treasures,
who was known to be a judge of beauty, pronounced Diana attractive
and fascinating without being strictly beautiful. If a connoisseur had
found his Charles II chalice a copy he could not have felt more
keenly the affront. If he had been a child he would have said, “Shan’t
play any more,” so deeply was he hurt. Seeing a nice-looking, pretty
woman sitting by herself, with an expression on her face as though
she were singing hymns to her babies in bed, he went up and spoke
to her. He knew her, of course, but did not always find time to speak
to her, for she never gathered a crowd and he hated to be
conspicuous—unless at the same time distinguished.
“I am with my niece,” he said, sitting down.
“And which is your niece?” she asked, turning her kind eyes
towards him. She seemed to hold up her tiara by the force of uplifted
eyebrows. Marcus showed her.
“That lovely thing!” she exclaimed with a generous enthusiasm,
and Marcus felt a tingle all down his spine and an inclination to cry.
How could any man with a pretension to taste have pronounced her
fascinating without being strictly beautiful?
“Yes,” he said; “you admire her?”
“Admire her! Could I do anything else?”
“If you were less beautiful yourself—yes!” said Marcus, with a rush
of gratitude.
To say the little woman was astonished does not express in the
least what she felt, but she was as shaken as was Marcus by the
hysterical outburst. He felt he could never trust himself again.
He had told quite the wrong kind of woman she was beautiful.
He wasn’t happy again until he had drawn Diana’s attention to the
little woman and asked her what she thought of her.
“That dear little Madonna? Why, she’s exactly what Aunt Elsie
goes second-class to Italy to gaze upon—the type exactly. Do go
and tell her she’s beautiful. It’s all she needs.”
“I have,” said Marcus.
“Stout heart!” said Diana, patting his arm.
Marcus found it necessary and expedient to pass the little woman
again to see if she had recovered, and he found her asleep under
her tiara. He would have passed on, but she awoke. “It’s so late, isn’t
it? But they must enjoy themselves, mustn’t they?”
Marcus said it seemed imperative nowadays.
“You are a very lucky uncle,” said the little woman.
Again that curious feeling in the spine, like the running down of
cold water, assailed Marcus. “I am,” he agreed.
“He’s so perfectly charming and delightful—”
“Who?” The feeling of flappiness changed to one of apprehension.
The little woman looked: Marcus’s eyes followed hers, and saw
standing in the doorway a tall man, on whose arm rested the hand of
a great personage. Up the stairs which were straight opposite the
doorway came a figure in white—the radiant figure of a niece. In her
face he thought was all the joy in the world, concentrated into one
look. That look, he feared, was captured and kept by the younger of
the two men. The elder man, with an amused gesture and a look of
kind understanding, walked away.
“Her mother, all over again,” groaned Marcus.
As they drove home together—radiant niece, discomfited uncle—
he said nothing, and she said: “You funny old thing.” Then there was
a pause. She put out one slim foot (she had kicked off her satin
shoe) and rested it on the seat opposite.
“You wouldn’t do that, Diana, if you were driving with a strange
man—would you?” he asked anxiously, handing her the shoe.
“I might—but of course I should have to marry him—according to
your creed. The world of your making, Marcus, must be a very
dangerous place to live in. It must be difficult in your world to avoid
pitfalls. The sins are many. In a world of my making there would be
sins, of course,—lying and cheating, meanness,—they should be
great sins. Greater sins should be jealousy—unkindness to children
—and that’s all for to-day, thank you.”
“My dear Diana, there is a very big sin about which you probably
know nothing and it has its beginnings in what you call—”
Diana laid her hand on his. “Marcus,” she said, “think, wouldn’t the
sin of which you are thinking come under the head possibly of
unkindness to children—?”
“My dear child, your ideas are very curious.”
“Do you think so?”
“Tell me what you think about things. I know so little of young
people.”
“What can I tell? My religion? I am a broad-minded Christian.”
“Yes, yes, I know. Of course, I know that, dear child.”
“Which?”
“Which what?”
“That I am broad-minded or that I am a Christian?”
“A Christian, and it’s as well to be broad-minded, without being too
broad-minded.”
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebooknice.com

You might also like