100% found this document useful (2 votes)
8 views

Pro Cryptography and Cryptanalysis with C 20 Creating and Programming Advanced Algorithms 1st Edition Marius Iulian Mihailescu pdf download

The document provides information on the book 'Pro Cryptography and Cryptanalysis with C++20' by Marius Iulian Mihailescu and Stefania Loredana Nita, which covers advanced algorithms in cryptography and cryptanalysis. It includes links to download the book and other related titles, as well as a detailed table of contents outlining various chapters on cryptography fundamentals, mathematical background, large integer arithmetic, and secure coding guidelines. The book is published by Apress Media and is available in both print and electronic formats.

Uploaded by

oumaropitie
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
8 views

Pro Cryptography and Cryptanalysis with C 20 Creating and Programming Advanced Algorithms 1st Edition Marius Iulian Mihailescu pdf download

The document provides information on the book 'Pro Cryptography and Cryptanalysis with C++20' by Marius Iulian Mihailescu and Stefania Loredana Nita, which covers advanced algorithms in cryptography and cryptanalysis. It includes links to download the book and other related titles, as well as a detailed table of contents outlining various chapters on cryptography fundamentals, mathematical background, large integer arithmetic, and secure coding guidelines. The book is published by Apress Media and is available in both print and electronic formats.

Uploaded by

oumaropitie
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 82

Pro Cryptography and Cryptanalysis with C 20

Creating and Programming Advanced Algorithms 1st


Edition Marius Iulian Mihailescu install
download
https://ebookmeta.com/product/pro-cryptography-and-cryptanalysis-
with-c-20-creating-and-programming-advanced-algorithms-1st-
edition-marius-iulian-mihailescu-2/

Download more ebook from https://ebookmeta.com


We believe these products will be a great fit for you. Click
the link to download now, or visit ebookmeta.com
to discover even more!

Pro Cryptography and Cryptanalysis with C 20 Creating


and Programming Advanced Algorithms 1st Edition Marius
Iulian Mihailescu

https://ebookmeta.com/product/pro-cryptography-and-cryptanalysis-
with-c-20-creating-and-programming-advanced-algorithms-1st-
edition-marius-iulian-mihailescu-2/

Pro Cryptography and Cryptanalysis with C++23: Creating


and Programming Advanced Algorithms 2nd Edition Marius
Iulian Mihailescu

https://ebookmeta.com/product/pro-cryptography-and-cryptanalysis-
with-c23-creating-and-programming-advanced-algorithms-2nd-
edition-marius-iulian-mihailescu-3/

Pro Cryptography and Cryptanalysis with C++23: Creating


and Programming Advanced Algorithms 2nd Edition Marius
Iulian Mihailescu

https://ebookmeta.com/product/pro-cryptography-and-cryptanalysis-
with-c23-creating-and-programming-advanced-algorithms-2nd-
edition-marius-iulian-mihailescu-2/

Production Presentation and Acceleration of Educational


Research Could Less be More Could Less be More

https://ebookmeta.com/product/production-presentation-and-
acceleration-of-educational-research-could-less-be-more-could-
less-be-more/
The Killer s Christmas List 1 EDITION Edition Chris
Frost

https://ebookmeta.com/product/the-killer-s-christmas-
list-1-edition-edition-chris-frost/

King of Her Dreams 1st Edition Karla Doyle

https://ebookmeta.com/product/king-of-her-dreams-1st-edition-
karla-doyle/

Incomplete 1st Edition Sloan Cheryl

https://ebookmeta.com/product/incomplete-1st-edition-sloan-
cheryl/

Superficial Fungal Infections of the Skin 1st Edition


Archana Singal Chander Grover

https://ebookmeta.com/product/superficial-fungal-infections-of-
the-skin-1st-edition-archana-singal-chander-grover/

Management of Chronic Kidney Disease (2nd Edition)


Mustafa Ar■c■

https://ebookmeta.com/product/management-of-chronic-kidney-
disease-2nd-edition-mustafa-arici/
Nature and Nurture in Mental Disorders A Gene
Environment Model A Gene Environment Model 2nd Edition
Joel M D Paris

https://ebookmeta.com/product/nature-and-nurture-in-mental-
disorders-a-gene-environment-model-a-gene-environment-model-2nd-
edition-joel-m-d-paris-2/
Pro Cryptography
and Cryptanalysis
with C++20
Creating and Programming Advanced
Algorithms

Marius Iulian Mihailescu
Stefania Loredana Nita
Pro Cryptography and
Cryptanalysis with C++20
Creating and Programming
Advanced Algorithms

Marius Iulian Mihailescu


Stefania Loredana Nita
Pro Cryptography and Cryptanalysis with C++20: Creating and Programming
Advanced Algorithms

Marius Iulian Mihailescu Stefania Loredana Nita


Bucharest, Romania Bucharest, Romania

ISBN-13 (pbk): 978-1-4842-6585-7 ISBN-13 (electronic): 978-1-4842-6586-4


https://doi.org/10.1007/978-1-4842-6586-4

Copyright © Marius Iulian Mihailescu and Stefania Loredana Nita 2021, corrected
publication 2021
This work is subject to copyright. All rights are reserved 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.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with
every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an
editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the
trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not
identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to
proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of publication,
neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or
omissions that may be made. The publisher makes no warranty, express or implied, with respect to the
material contained herein.
Managing Director, Apress Media LLC: Welmoed Spahr
Acquisitions Editor: Steve Anglin
Development Editor: Matthew Moodie
Editorial Operations Manager: Mark Powers
Cover designed by eStudioCalamar
Cover image by Devin Avery on Unsplash (www.unsplash.com)
Distributed to the book trade worldwide by Apress Media, LLC, 1 New York Plaza, New York, NY 10004,
U.S.A. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer-sbm.com, or visit
www.springeronline.com. Apress Media, LLC is a California LLC and the sole member (owner) is Springer
Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.
For information on translations, please e-mail booktranslations@springernature.com; for reprint,
paperback, or audio rights, please e-mail bookpermissions@springernature.com.
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook versions and
licenses are also available for most titles. For more information, reference our Print and eBook Bulk Sales
web page at www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this book is available to
readers on GitHub via the book’s product page, located at www.apress.com/9781484265857. For more
detailed information, please visit www.apress.com/source-­code.
Printed on acid-free paper
To our families.
Table of Contents
About the Authors�������������������������������������������������������������������������������������������������� xiii

About the Technical Reviewer���������������������������������������������������������������������������������xv


Acknowledgments�������������������������������������������������������������������������������������������������xvii

Part I: Foundations�������������������������������������������������������������������������������� 1
Chapter 1: Getting Started in Cryptography and Cryptanalysis�������������������������������� 3
Cryptography and Cryptanalysis��������������������������������������������������������������������������������������������������� 4
Book Structure������������������������������������������������������������������������������������������������������������������������������ 5
Internet Resources������������������������������������������������������������������������������������������������������������������������ 9
Forums and Newsgroups������������������������������������������������������������������������������������������������������ 10
Standards������������������������������������������������������������������������������������������������������������������������������������ 11
Conclusion���������������������������������������������������������������������������������������������������������������������������������� 12
References���������������������������������������������������������������������������������������������������������������������������������� 13

Chapter 2: Cryptography Fundamentals����������������������������������������������������������������� 15


Information Security and Cryptography�������������������������������������������������������������������������������������� 16
Cryptography Goals��������������������������������������������������������������������������������������������������������������� 19
Cryptographic Primitives������������������������������������������������������������������������������������������������������� 20
Background of Mathematical Functions������������������������������������������������������������������������������������� 22
Functions: One-to-One, One-Way, Trapdoor One-Way������������������������������������������������������������ 22
Permutations������������������������������������������������������������������������������������������������������������������������� 28
Involutions����������������������������������������������������������������������������������������������������������������������������� 28
Concepts and Basic Terminology������������������������������������������������������������������������������������������������ 29
Domains and Codomains Used for Encryption���������������������������������������������������������������������� 29
Encryption and Decryption Transformations������������������������������������������������������������������������� 30
The Participants in the Communication Process������������������������������������������������������������������� 31

v
Table of Contents

Digital Signatures������������������������������������������������������������������������������������������������������������������������ 32
Signing Process��������������������������������������������������������������������������������������������������������������������� 33
Verification Process��������������������������������������������������������������������������������������������������������������� 33
Public-Key Cryptography������������������������������������������������������������������������������������������������������������ 33
Hash Functions��������������������������������������������������������������������������������������������������������������������������� 36
Case Studies������������������������������������������������������������������������������������������������������������������������������� 53
Caesar Cipher Implementation in C++20������������������������������������������������������������������������������ 53
Vigenére Cipher Implementation in C++20��������������������������������������������������������������������������� 55
Conclusions��������������������������������������������������������������������������������������������������������������������������������� 58
References���������������������������������������������������������������������������������������������������������������������������������� 58

Chapter 3: Mathematical Background and Its Applicability����������������������������������� 65


Preliminaries������������������������������������������������������������������������������������������������������������������������������� 66
Conditional Probability���������������������������������������������������������������������������������������������������������������� 67
Random Variables����������������������������������������������������������������������������������������������������������������������� 68
Birthday Problem������������������������������������������������������������������������������������������������������������������������ 69
Information Theory���������������������������������������������������������������������������������������������������������������������� 70
Entropy���������������������������������������������������������������������������������������������������������������������������������� 70
Number Theory��������������������������������������������������������������������������������������������������������������������������� 71
Integers��������������������������������������������������������������������������������������������������������������������������������� 71
Algorithms in ℤ���������������������������������������������������������������������������������������������������������������������� 72
The Integer Modulo n������������������������������������������������������������������������������������������������������������ 74
Algorithms ℤm������������������������������������������������������������������������������������������������������������������������ 75
The Legendre and Jacobi Symbols���������������������������������������������������������������������������������������� 76
Finite Fields��������������������������������������������������������������������������������������������������������������������������������� 78
Basic Notions������������������������������������������������������������������������������������������������������������������������� 78
Polynomials and the Euclidean Algorithm����������������������������������������������������������������������������� 79
Case Study 1: Computing the Probability of an Event Taking Place�������������������������������������������� 80
Case Study 2: Computing the Probability Distribution���������������������������������������������������������������� 82
Case Study 3: Computing the Mean of the Probability Distribution�������������������������������������������� 84
Case Study 4: Computing the Variance��������������������������������������������������������������������������������������� 85
Case Study 5: Computing the Standard Deviation���������������������������������������������������������������������� 87
vi
Table of Contents

Case Study 6: Birthday Paradox�������������������������������������������������������������������������������������������������� 89


Case Study 7: (Extended) Euclidean Algorithm��������������������������������������������������������������������������� 91
Case Study 8: Computing the Multiplicative Inverse Under Modulo q���������������������������������������� 93
Case Study 9: Chinese Remainder Theorem������������������������������������������������������������������������������� 96
Case Study 10: The Legendre Symbol����������������������������������������������������������������������������������������� 98
Conclusion�������������������������������������������������������������������������������������������������������������������������������� 101
References�������������������������������������������������������������������������������������������������������������������������������� 102

Chapter 4: Large Integer Arithmetic��������������������������������������������������������������������� 105


Big Integers������������������������������������������������������������������������������������������������������������������������������� 106
Big Integer Libraries������������������������������������������������������������������������������������������������������������������ 112
Conclusion�������������������������������������������������������������������������������������������������������������������������������� 114
References�������������������������������������������������������������������������������������������������������������������������������� 114

Chapter 5: Floating-Point Arithmetic�������������������������������������������������������������������� 117


Why Floating-Point Arithmetic?������������������������������������������������������������������������������������������������ 117
Displaying Floating Point Numbers������������������������������������������������������������������������������������������� 118
The Range of Floating Point Numbers�������������������������������������������������������������������������������������� 119
Floating Point Precision������������������������������������������������������������������������������������������������������������ 119
Next Level for Floating-Point Arithmetic����������������������������������������������������������������������������������� 122
Conclusions������������������������������������������������������������������������������������������������������������������������������� 123
References�������������������������������������������������������������������������������������������������������������������������������� 123

Chapter 6: New Features in C++20����������������������������������������������������������������������� 125


Feature Testing������������������������������������������������������������������������������������������������������������������������� 125
carries_dependency������������������������������������������������������������������������������������������������������������ 125
no_unique_address������������������������������������������������������������������������������������������������������������� 127
New Headers in C++20������������������������������������������������������������������������������������������������������������ 128
<concepts> Header������������������������������������������������������������������������������������������������������������ 128
<compare> Header������������������������������������������������������������������������������������������������������������� 131
<format> Header���������������������������������������������������������������������������������������������������������������� 132
Conclusion�������������������������������������������������������������������������������������������������������������������������������� 133
References�������������������������������������������������������������������������������������������������������������������������������� 133
vii
Table of Contents

Chapter 7: Secure Coding Guidelines������������������������������������������������������������������� 135


Secure Coding Checklist����������������������������������������������������������������������������������������������������������� 136
CERT Coding Standards������������������������������������������������������������������������������������������������������������ 140
Identifiers���������������������������������������������������������������������������������������������������������������������������� 141
Noncompliant Code Examples and Compliant Solutions����������������������������������������������������� 141
Exceptions��������������������������������������������������������������������������������������������������������������������������� 141
Risk Assessment����������������������������������������������������������������������������������������������������������������� 142
Automated Detection����������������������������������������������������������������������������������������������������������� 143
Related Guidelines��������������������������������������������������������������������������������������������������������������� 143
Rules����������������������������������������������������������������������������������������������������������������������������������������� 144
Rule 1 - Declarations and Initializations (DCL)�������������������������������������������������������������������� 144
Rule 2 - Expressions (EXP)�������������������������������������������������������������������������������������������������� 145
Rule 3 - Integers (INT)��������������������������������������������������������������������������������������������������������� 146
Rule 5 - Characters and Strings (STR)��������������������������������������������������������������������������������� 146
Rule 6 - Memory Management (MEM)��������������������������������������������������������������������������������� 147
Rule 7 - Input/Output (FIO)��������������������������������������������������������������������������������������������������� 148
Conclusion�������������������������������������������������������������������������������������������������������������������������������� 148
References�������������������������������������������������������������������������������������������������������������������������������� 149

Chapter 8: Cryptography Libraries in C/C++20���������������������������������������������������� 151


Overview of Cryptography Libraries������������������������������������������������������������������������������������������ 151
Hash Functions�������������������������������������������������������������������������������������������������������������������� 152
Public Key Cryptography����������������������������������������������������������������������������������������������������� 153
Elliptic-Curve Cryptography (ECC)��������������������������������������������������������������������������������������� 155
OpenSSL����������������������������������������������������������������������������������������������������������������������������������� 158
Configuration and Installing OpenSSL��������������������������������������������������������������������������������� 158
Botan����������������������������������������������������������������������������������������������������������������������������������������� 177
CrypTool������������������������������������������������������������������������������������������������������������������������������������ 177
Conclusion�������������������������������������������������������������������������������������������������������������������������������� 185
References�������������������������������������������������������������������������������������������������������������������������������� 186

viii
Table of Contents

Part II: Pro Cryptography������������������������������������������������������������������� 187


Chapter 9: Elliptic-Curve Cryptography���������������������������������������������������������������� 189
Theoretical Fundamentals�������������������������������������������������������������������������������������������������������� 190
Weierstrass Equation����������������������������������������������������������������������������������������������������������� 192
Group Law��������������������������������������������������������������������������������������������������������������������������� 194
Practical Implementation���������������������������������������������������������������������������������������������������������� 195
Conclusion�������������������������������������������������������������������������������������������������������������������������������� 222
References�������������������������������������������������������������������������������������������������������������������������������� 223

Chapter 10: Lattice-Based Cryptography������������������������������������������������������������� 225


Mathematical Background�������������������������������������������������������������������������������������������������������� 225
Example������������������������������������������������������������������������������������������������������������������������������������ 227
Conclusion�������������������������������������������������������������������������������������������������������������������������������� 237
References�������������������������������������������������������������������������������������������������������������������������������� 237

Chapter 11: Searchable Encryption���������������������������������������������������������������������� 239


Components������������������������������������������������������������������������������������������������������������������������������ 240
Entities��������������������������������������������������������������������������������������������������������������������������������� 240
Types����������������������������������������������������������������������������������������������������������������������������������� 241
Security Characteristics������������������������������������������������������������������������������������������������������ 243
An Example������������������������������������������������������������������������������������������������������������������������������� 244
Conclusion�������������������������������������������������������������������������������������������������������������������������������� 255
References�������������������������������������������������������������������������������������������������������������������������������� 256

Chapter 12: Homomorphic Encryption����������������������������������������������������������������� 259


Fully Homomorphic Encryption������������������������������������������������������������������������������������������������� 261
Practical Example of Using FHE������������������������������������������������������������������������������������������������ 263
Conclusion�������������������������������������������������������������������������������������������������������������������������������� 283
References�������������������������������������������������������������������������������������������������������������������������������� 283

ix
Table of Contents

Chapter 13: Ring Learning with Errors Cryptography������������������������������������������ 287


Mathematical Background�������������������������������������������������������������������������������������������������������� 288
Learning with Errors������������������������������������������������������������������������������������������������������������ 288
Ring Learning With Errors���������������������������������������������������������������������������������������������������� 290
Practical Implementation���������������������������������������������������������������������������������������������������������� 291
Conclusion�������������������������������������������������������������������������������������������������������������������������������� 299
References�������������������������������������������������������������������������������������������������������������������������������� 299

Chapter 14: Chaos-Based Cryptography��������������������������������������������������������������� 303


Security Analysis����������������������������������������������������������������������������������������������������������������������� 306
Chaotic Maps for Plaintexts and Images Encryption����������������������������������������������������������������� 307
Rössler Attractor����������������������������������������������������������������������������������������������������������������������� 308
Complex Numbers – Short Overview���������������������������������������������������������������������������������������� 309
Practical Implementation���������������������������������������������������������������������������������������������������������� 310
Secure Random Number Generator Using a Chaos Rössler Attractor��������������������������������� 312
Cipher Using Chaos and Fractals����������������������������������������������������������������������������������������� 319
Conclusion�������������������������������������������������������������������������������������������������������������������������������� 334
References�������������������������������������������������������������������������������������������������������������������������������� 334

Chapter 15: Big Data Cryptography���������������������������������������������������������������������� 337


Verifiable Computation�������������������������������������������������������������������������������������������������������������� 341
Conclusion�������������������������������������������������������������������������������������������������������������������������������� 348
References�������������������������������������������������������������������������������������������������������������������������������� 349

Chapter 16: Cloud Computing Cryptography�������������������������������������������������������� 353


A Practical Example������������������������������������������������������������������������������������������������������������������ 354
Conclusion�������������������������������������������������������������������������������������������������������������������������������� 360
References�������������������������������������������������������������������������������������������������������������������������������� 361

Part III: Pro Cryptanalysis����������������������������������������������������������������� 363


Chapter 17: Getting Started with Cryptanalysis��������������������������������������������������� 365
Third Part Structure������������������������������������������������������������������������������������������������������������������ 367
Cryptanalysis Terms������������������������������������������������������������������������������������������������������������������ 367

x
Table of Contents

A Little Bit of Cryptanalysis History������������������������������������������������������������������������������������������� 369


Penetration Tools and Frameworks������������������������������������������������������������������������������������������� 371
Conclusion�������������������������������������������������������������������������������������������������������������������������������� 373
References�������������������������������������������������������������������������������������������������������������������������������� 374

Chapter 18: Cryptanalysis Attacks and Techniques��������������������������������������������� 377


Standards���������������������������������������������������������������������������������������������������������������������������������� 377
FIPS 140-2, FIPS 140-3, and ISO 15408������������������������������������������������������������������������������ 378
Validation of Cryptographic Systems���������������������������������������������������������������������������������������� 378
Cryptanalysis Operations���������������������������������������������������������������������������������������������������������� 380
Classification of Cryptanalytics Attacks������������������������������������������������������������������������������������ 381
Attacks on Cipher Algorithms���������������������������������������������������������������������������������������������� 381
Attacks on Cryptographic Keys������������������������������������������������������������������������������������������� 383
Attacks on Authentication Protocols������������������������������������������������������������������������������������ 384
Conclusion�������������������������������������������������������������������������������������������������������������������������������� 385
References�������������������������������������������������������������������������������������������������������������������������������� 385

Chapter 19: Linear and Differential Cryptanalysis������������������������������������������������ 387


Differential Cryptanalysis���������������������������������������������������������������������������������������������������������� 388
Linear Cryptanalysis����������������������������������������������������������������������������������������������������������������� 396
Performing Linear Cryptanalysis����������������������������������������������������������������������������������������� 396
S-Boxes������������������������������������������������������������������������������������������������������������������������������� 397
Linear Approximation of S-Box�������������������������������������������������������������������������������������������� 399
Concatenation of Linear Approximations����������������������������������������������������������������������������� 399
Assembling Two Variables��������������������������������������������������������������������������������������������������� 399
Conclusion�������������������������������������������������������������������������������������������������������������������������������� 408
References�������������������������������������������������������������������������������������������������������������������������������� 408

Chapter 20: Integral Cryptanalysis����������������������������������������������������������������������� 411


Basic Notions���������������������������������������������������������������������������������������������������������������������������� 411
Practical Approach�������������������������������������������������������������������������������������������������������������������� 413
Conclusion�������������������������������������������������������������������������������������������������������������������������������� 422
References�������������������������������������������������������������������������������������������������������������������������������� 422

xi
Table of Contents

Chapter 21: Brute Force and Buffer Overflow Attacks����������������������������������������� 423


Brute Force Attack�������������������������������������������������������������������������������������������������������������������� 424
Buffer Overflow Attack�������������������������������������������������������������������������������������������������������������� 432
Conclusion�������������������������������������������������������������������������������������������������������������������������������� 434
References�������������������������������������������������������������������������������������������������������������������������������� 434

Chapter 22: Text Characterization������������������������������������������������������������������������ 435


The Chi-Squared Statistic��������������������������������������������������������������������������������������������������������� 435
Cryptanalysis Using Monogram, Bigram, and Trigram Frequency Counts�������������������������������� 439
Counting Monograms���������������������������������������������������������������������������������������������������������� 439
Counting Bigrams���������������������������������������������������������������������������������������������������������������� 440
Counting Trigrams��������������������������������������������������������������������������������������������������������������� 443
Conclusion�������������������������������������������������������������������������������������������������������������������������������� 446
References�������������������������������������������������������������������������������������������������������������������������������� 446

Chapter 23: Implementation and Practical Approach of


Cryptanalysis Methods����������������������������������������������������������������������������������������� 447
Ciphertext-Only Attack�������������������������������������������������������������������������������������������������������������� 450
Known-Plaintext Attack������������������������������������������������������������������������������������������������������������� 450
Chosen-Plaintext Attack������������������������������������������������������������������������������������������������������������ 451
Chosen-Ciphertext Attack��������������������������������������������������������������������������������������������������������� 459
Conclusion�������������������������������������������������������������������������������������������������������������������������������� 460
References�������������������������������������������������������������������������������������������������������������������������������� 461

Correction to: Pro Cryptography and Cryptanalysis with C++20��������������������������� C1

Index��������������������������������������������������������������������������������������������������������������������� 463

xii
About the Authors
Marius Iulian Mihailescu, PhD is the CEO of Dapyx Solution Ltd., a company based in
Bucharest, Romania. He is involved in information security- and cryptography-related
research projects. He is a lead guest editor for applied cryptography journals and a
reviewer for multiple publications on information security and cryptography profiles.
He has authored and co-authored more than 30 articles for conference proceedings, 25
articles for journals, and four books. For more than six years he has served as a lecturer
at well-known national and international universities (University of Bucharest, Titu
Maiorescu University, Spiru Haret University of Bucharest, and Kadir Has University,
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 worked for three years as an IT Officer
at Royal Caribbean Cruises Ltd. where he dealt with IT infrastructure, data security,
and satellite communications systems. He received his PhD in 2014 and his thesis is
on applied cryptography over biometrics data. He holds MSc degrees in information
security and software engineering.

Stefania Loredana Nita, PhD is a software developer and researcher at the Institute for
Computers of the Romanian Academy. Her PhD thesis is on advanced cryptographic
schemes using searchable encryption and homomorphic encryption. At the Institute for
Computers, she works on research and development projects that involve searchable
encryption, homomorphic encryption, cloud computing security, Internet of Things, and
big data. She worked for more than two years as an assistant lecturer at the University of
Bucharest where she taught courses on advanced programming techniques, simulation
methods, and operating systems. She has authored and co-authored more than 25
workpapers for conferences and journals, and has co-authored four books. She is a
lead guest editor for special issues on information security and cryptography such as
Advanced Cryptography and Its Future: Searchable and Homomorphic Encryption. She
has an MSc degree in software engineering and BSc degrees in computer science and
mathematics.

xiii
About the Technical Reviewer
Doug Holland is a Software Engineer and Architect at Microsoft Corporation. He holds
a Master’s degree in software engineering from the University of Oxford. Before joining
Microsoft, he was awarded the Microsoft MVP and Intel Black Belt Developer awards.

xv
Acknowledgments
We would like to thank our editors for their support, our technical reviewer for his
constructive comments and suggestions, the entire team that makes publishing this
book possible, and last but not least, our families for their unconditional support and
encouragement.

xvii
PART I

Foundations
CHAPTER 1

Getting Started in
Cryptography and
Cryptanalysis
Knowledge is one of the most important aspects to consider when designing and
implementing complex systems, such as companies, organizations, military operations,
and so on. Information falling into the wrong hands can be a tragedy and can result
in a huge loss of business or disastrous outcomes. To guarantee the security of
communications, cryptography can be used to encode information in such a way that
nobody will be able to decode it without having the legal right. Many ciphers have been
broken when a flaw has been found in their design or enough computing power has
been applied to break an encoded message. Cryptology, as you will see later, consists of
cryptography and cryptanalysis.
With the rapid evolution of electronic communication, the number of issues raised
by information security significantly increases every day. Messages that are shared over
publicly accessible computer networks around the world must be secured and preserved
and must get the proper security mechanisms to protect against abuse. The business
requirement in the field of electronic devices and their communication consists of
having digital signatures that can be recognized by law. Modern cryptography provides
solutions to all these problems.
The idea for this book started from experiences in several directions: (1)
cryptography courses for students (at the graduate and undergraduate levels) in
computer science at the University of Bucharest and Titu Maiorescu University; (2)
industry experience achieved at national and international companies; (3) ethical
hacking best practices; and (4) security audits. The goal of this book is to present
the most advanced cryptography and cryptanalysis techniques together with their

3
© Marius Iulian Mihailescu and Stefania Loredana Nita 2021
M. I. Mihailescu and S. L. Nita, Pro Cryptography and Cryptanalysis with C++20,
https://doi.org/10.1007/978-1-4842-6586-4_1
Chapter 1 Getting Started in Cryptography and Cryptanalysis

implementations using C++20. This book will offer a practical perspective, giving the
readers the necessary tools to design cryptography and cryptanalysis techniques in
terms of practice. Most of the implementations are in C++20 using the latest features
and improvements of the programming language (see Chapter 6). The book is an
advanced and exhaustive work, offering a comprehensive view of 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 many professionals, such as security
experts with their audits, military experts and personnel, ethical hackers, teachers in
academia, researchers, software developers, software engineers when security and
cryptographic solutions must be implemented in a real business software environment,
professors teaching student courses (undergraduate and graduate level, master’s degree,
professional and academic doctoral degree), business analysts, and many more.

C
 ryptography and Cryptanalysis
It is very important to understand the meanings of the main concepts involved in a
secure communication process and to know their boundaries.

• Cryptology is the science or art of secret writings. The main goal is to


protect and defend the secrecy and confidentiality of the 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.
Cryptography is a special kind of art, the art of protecting information
by transforming it into an unreadable format called ciphertext.

• Cryptanalysis is the offensive side of cryptology. Its main objective


is to study the cryptographic systems to provide the necessary
characteristics to fulfill the function for which they have been
designed. Cryptanalysis can analyze the cryptographic systems of
third parties through cryptograms to break them in order to obtain
useful information for business purposes. Cryptanalysts, code
breakers, and ethical hackers are the people who deal with the field
of cryptanalysis.

4
Chapter 1 Getting Started in Cryptography and Cryptanalysis

• A cryptographic primitive represents a well-established or low-­


level cryptographic algorithm that is used to build cryptographic
protocols. Examples of such routines include hash functions or
encryption functions.

The book provides a deep examination of all three aspects from a practical point
of view with references to the theoretical background by illustrating how a theoretical
algorithm should be analyzed for implementation.

B
 ook Structure
The book is divided into 23 chapters in three parts (see Table 1-1): Part I: Foundations
(Chapters 1-8), Part II: Pro Cryptography (Chapters 9-16), and Part III: Pro Cryptanalysis
(Chapters 17-23). Figure 1-1 shows how to read the book and what chapters depend on
each other.
The Part I: Foundations (Chapters 1-8) covers, from a beginner to advanced
level and from theoretical to practical, the basic concepts of cryptography (Chapter 2).
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 the cryptography
and cryptanalysis algorithms.
Chapters 4 and Chapter 5 focus on integer arithmetic and floating-point arithmetic
processing. These chapters are vital because other chapters and algorithms depend on
the content of these chapters. Number representations and working with them via the
memory of the computer can be a difficult task.
In Chapter 6, we discuss the newest features and enhancements of C++20. We
give a presentation on how the new features and enhancements play an important
role in developing cryptography and cryptanalysis algorithms and methods. We cover
three-way comparisons, lambdas in unevaluated contexts, string literals, atomic smart
pointers, <version> headers, ranges, coroutines, modules, and more.
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. We cover important topics such as securing
state data, security and user input, security-neutral code, and library codes that expose
the protected resources.

5
Chapter 1 Getting Started in Cryptography and Cryptanalysis

Chapter 8 introduces the cryptography model and services that are used by C++.
We cover important topics like C++ basic implementations, object inheritance, how
cryptography algorithms are implemented, stream design, configuring cryptography
classes, how to choose cryptography algorithms, generating the keys for encryption
and decryption, storing asymmetric keys in a key container, cryptographic signatures,
ensuring data integrity using hash codes and functions, creating and designing
cryptographic schemes, encryption of XML elements with symmetric keys, assuring and
guaranteeing interoperability of the applications between different platforms, such as
Windows, MacOS, UNIX/Linux, and more.
Part II: Pro Cryptography (Chapters 9-16) contains the most important modern
cryptographic primitives. Chapters 9-16 discuss the 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 Cryptography Next Generation (CNG), which is used in the
implementation of the Elliptic Curve Diffie-Hellman (ECDH) algorithm, and how to
realize the necessary cryptographic operations.
Chapter 10 provides an introduction to the Lattice Cryptography Library and how it
works, pointing out the importance of post-quantum cryptography. Implementations of
key exchange protocols proposed by Alkim, Ducas, Poppelmann, and Schwabe [1] are
discussed. We continue our discussion with an instantiation of Chris Peikert’s key exchange
protocol [2]. We point out that 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 an implementation using C++20 and showing the advantages and disadvantages
by removing the most common patterns from encrypted data. In Chapter 12, we discuss
how to use the SEAL library for fully homomorphic encryption. The implementation is
discussed based on the proposal of Shai Halevi and Victor Shoup in [3].
Chapter 13 covers the issues that are generated during the implementation of (ring)
learning with errors cryptography mechanisms. We give as an example an implementation
of the lattice-based key exchange protocol, a library that is used only for experiments.
Chapter 14 is based on the new concepts behind chaos-based cryptography and how
they can be translated into practice. The chapter generates some new outputs and its
contribution is important for the advancement of cryptography as it is a new topic that
hasn’t received proper attention until now.
6
Chapter 1 Getting Started in Cryptography and Cryptanalysis

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 multi-party computation.
Chapter 16 points out the security issues raised by applications that run in a cloud
environment and how they can be resolved during the designing and implementation
phase.
In Part III: Pro Cryptanalysis (Chapters 17-23), we deal with advanced cryptanalysis
topics and we show how to pass the barrier between theory and practice, and how to think
of 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.
Starting with Chapter 17 we provide an introduction to cryptanalysis by presenting
the most important characteristics of cryptanalysis.
Chapter 18 shows the important criteria and standards used in cryptanalysis, how
the tests of cryptographic systems are made, the process of selecting cryptographic
modules, cryptanalysis operations, and classifications of cryptanalysis attacks.
In Chapter 19 and Chapter 20, we show how to implement and design linear and
differential and integral cryptanalysis. We focus on techniques and strategies where the
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++20. You study the behavior of software applications when
they are exposed to different attacks and you exploit the source code. We also discuss
software obfuscation and show why this is a critical aspect that needs to be taken into
consideration by the personnel involved in implementing the process of the software.
Also, we show how this analysis can lead to machine learning and artificial intelligence
algorithms that can be used to predict future attacks against software applications that
are running in a distributed or cloud environment.
In Chapter 22, we go through the text characterization methods and
implementations. We discuss 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 the
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.
7
Chapter 1 Getting Started in Cryptography and Cryptanalysis

Table 1-1. Book Structure


Part Chapter # Chapter Title

Part I 1 Getting Started in Cryptography and Cryptanalysis


Foundations (Foundational 2 Cryptography Fundamentals
Topics)
3 Mathematical Background and Its Applicability
4 Large Integer Arithmetic
5 Floating-Point Arithmetic
6 New Features in C++20
7 Secure Coding Guidelines
8 Cryptography Libraries in C/C++20
Part II 9 Elliptic-Curve Cryptography
Pro Cryptography 10 Lattice-Based Cryptography
11 Searchable Encryption
12 Homomorphic Encryption
13 Ring Learning with Errors Cryptography
14 Chaos-Based Cryptography
15 Big Data Cryptography
16 Cloud Computing Cryptography
Part III 17 Getting Started with Cryptanalysis
Pro Cryptanalysis 18 Cryptanalysis Attacks and Techniques
19 Linear and Differential Cryptanalysis
20 Integral Cryptanalysis
21 Brute Force and Buffer Overflow Attacks
22 Text Characterization
23 Implementation and Practical Approach of
Cryptanalysis Methods

8
Chapter 1 Getting Started in Cryptography and Cryptanalysis

Figure 1-1. A roadmap for readers and professionals

I nternet Resources
The Internet offers a significant amount of resources that are very useful regarding the
topics in this book. These resources will help you keep up with progress in the fields:

• Bill’s Security Site, https://asecuritysite.com/, contains various


implementations of cryptographic algorithms. The website is
created and updated by Bill Buchanan, a professor at the School of
Computing at Edinburgh Napier University.

• Books by William Stallings [4] such as Cryptography and Network


Security, (http://williamstallings.com/Cryptography/). His
website contains an important set of tools and resources that he
regularly updates, keeping in step with the most important advances
in the field of cryptography.

9
Chapter 1 Getting Started in Cryptography and Cryptanalysis

• Schneier on Security, www.schneier.com/, contains sections on


books, essays, accurate news, talks, and academic resources.

F orums and Newsgroups


Many USENET (quite deprecated but still very useful) newsgroups are dedicated to the
important aspects of cryptography and network security. The most important are as
follows:

• sci.crypt.research is one of the best groups for information about


research ideas. It is a moderated newsgroup and its main purpose
is to deal with research topics. Most of the topics are related to the
technical aspects of cryptology.

• sci.crypt offers general discussions about cryptology and related


topics.

• sci.crypt.random-numbers offers discussions about random


number generators.

• alt.security offers general discussions on security topics.

• comp.security.misc offers general discussions on computer security


topics.

• comp.security.firewalls offers discussions about firewalls and


other related products.

• comp.security.announce covers CERT news and announcements.

• comp.risks offers discussions about the public risks from computers


and users.

• comp.virus offers moderated discussions about computer viruses.

Also, there are many forums that deal with cryptography topics and news. The most
important are as follows:

• Reddit: Cryptography News and Discussions [5]: The forum group


contains general information and news about different topics related
to cryptography and information security.

10
Chapter 1 Getting Started in Cryptography and Cryptanalysis

• Security forums [6]: They cover vast topics and discussions about
computer security and cryptography.
• TechGenix: Security [7]: One of the most updated forums with
news related to cryptography and information security. The group is
maintained by world-leading security professionals.
• Wilders Security Forums [8]: The forum contains discussions and
news about the vulnerabilities of software applications due to bad
implementations of cryptographic solutions.
• Security Focus [9]: The forum contains a series of discussions about
vulnerabilities raised by the implementations of cryptographic
algorithms.
• Security InfoWatch [10]: The discussions are related to data and
information loss.
• TechRepublic: Security [11]: The forum contains discussions about
practical aspects and methodologies that can be used when software
applications are designed and implemented.
• Information Security Forum [12]: A world-leading forum in the
field of information security and cryptography. The forum contains
conferences plus hands-on and practical tutorials for solving
solutions for security and cryptographic issues.

S
 tandards
Many of the cryptographic techniques and implementations described in this book
follow the below standards. These standards have been developed and designed to
cover the management practices and the entire architecture of security mechanisms,
strategies, and services.
The most important standards covered by this book are as follows:

• National Institute of Standards and Technology (NIST): NIST is the


US federal agency that deals with standards, science, and technologies
related to the US government. Excepting the national goal, the NIST
Federal Information Processing Standards (FIPS) and the Special
Publications (SP) have a very important worldwide impact.
11
Chapter 1 Getting Started in Cryptography and Cryptanalysis

• Internet Society: ISOC is one of the most important professional


membership societies, with organizational and individual members
worldwide. The society provides leadership on the issues that
confront the future perspective of the Internet and applications that
are developed using security and cryptographic mechanisms, with
respect for the responsible groups, such as the Internet Engineering
Task Force (IETF) and the Internet Architecture Board (IAB).

• ITU-T: The International Telecommunication Union (ITU) is one of the


most powerful organizations within the United Nations system. It works
with governments and the private sector to coordinate and administer
the global telecom networks and services. ITU-T represents one of the
three sectors of ITU. The mission of ITU-T consists of the production
of the standards that cover all fields of telecommunications. The
standards proposed by ITU-T are known as recommendations.

• ISO: The International Organizations for Standardization is a


worldwide federation that contains national standards bodies from
over 140 countries. The ISO is a nongovernmental organization
that promotes the development of standardization and activities
to facilitate the international exchange of services to develop
cooperation with intellectual, scientific, and technological activities.
The results of the ISO are international agreements published as
international standards.

Conclusion
The era in which we are living is one of unimaginable evolution and incredible
technologies that enable the instant flow of information at any time and any place.
The secret consists of the convergence of the computer with networks; this forces the
evolution and development of these incredible technologies from behind.
In this first chapter, we discussed the objectives of the book and its benefits.
We explained the mission of the book, which is to address the practical aspects of
cryptography and information security and its main intention in using the current work.
The systems built upon advanced information technologies have a deep impact on our
lives every day. These technologies are proving to be pervasive and ubiquitous.

12
Chapter 1 Getting Started in Cryptography and Cryptanalysis

The book represents the first practical step of translating the most important
theoretical cryptography algorithms and mechanisms into practice through one of the
most powerful programming languages, C++20.
In this chapter, you learned the following:

• The differences between cryptography, cryptanalysis, and cryptology.

• The structure of the book in order to help you follow the content
easier. A roadmap was introduced in order to show the dependencies
of each chapter. Each chapter was presented in detail, pointing out
the main objective.

• A list of newsgroups, websites, and USENETs resources was covered


in order provide sources for the latest news about cryptography and
information security.

• The most significant standards for cryptography and information


security were presented. You will get used to the workflow of each
standard.

R
 eferences
[1] E. Alkim, L. Ducas, T. Pöppelmann, and P. Schwabe, “Post-
quantum key exchange—a new hope” in 25th {USENIX} Security
Symposium ({USENIX} Security 16) (pp. 327-343). 2016.
[2] C. Peikert, “Lattice cryptography for the internet” in International
workshop on post-quantum cryptography (pp. 197-219). Springer,
Cham. October, 2014.

[3] S. Halevi and V. Shoup, Design and implementation of a


homomorphic-encryption library. IBM Research (Manuscript), 6,
12-15. 2013.

[4] W. Stallings, Cryptography and Network Security - Principles and


Practice, fifth edition. 2010: Pearson. 744.

[5] Reddit. Cryptography News and Discussions. Available from:


www.reddit.com/r/crypto/.

13
Chapter 1 Getting Started in Cryptography and Cryptanalysis

[6] Forums, Security. Available online: www.security-­forums.com/


index.php?sid=acc302c71bb3ea3a7d631a357223e261.

[7] TechGenix, Security. Available online: http://techgenix.com/


security/.

[8] Wilders Security Forums. Available online: www.wilderssecurity.


com/.

[9] Security Focus. Available online: www.securityfocus.com/.

[10] Security InfoWatch. Available online: https://forums.


securityinfowatch.com/.

[11] TechRepublic – Security. Available online: www.techrepublic.


com/forums/security/.

[12] Information Security Forum. Available online:


www.securityforum.org/.

14
CHAPTER 2

Cryptography
Fundamentals
Cryptographic history is incredibly long and fascinating. A great and comprehensive
reference is The Code Book: The Secrets Behind Codebreaking [1] published in 2003,
which provides a non-technical history of cryptography. In the book, the story of
cryptography begins around 2000 BC, when the Egyptians used it for the first (known)
time, and ends with our era. It presents the main aspects of cryptography and hiding
information for each period that is covered and describes cryptography’s great
contribution to both World Wars. Often, the art of cryptography is correlated with
diplomacy, the military, and governments because its purpose is to keep safe sensitive
data such as strategies or secrets regarding national security.
A crucial development in modern cryptography is the workpaper New Directions
in Cryptography [2] proposed by Diffie and Hellman in 1976. The paper introduced a
notion that changed how cryptography was seen: public-key cryptography. Another
important contribution in this paper was the innovative way of exchanging keys; the
security of the presented technique was 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. Although the authors did not propose a practical
implementation for their public-key encryption scheme, the idea was presented very
clearly and started to get attention from 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,
known nowadays as RSA [3]. The hardness assumption in RSA is the factoring of large
integers. By looking in parallel at integer factorization for RSA and Shor’s algorithm,
note that Shor’s Algorithm will run in polynomial time for quantum computers. This
represents a significant challenge for any cryptographer who is using the hardness

15
© Marius Iulian Mihailescu and Stefania Loredana Nita 2021
M. I. Mihailescu and S. L. Nita, Pro Cryptography and Cryptanalysis with C++20,
https://doi.org/10.1007/978-1-4842-6586-4_2
Chapter 2 Cryptography Fundamentals

assumption for factoring large integers. The increasing applications and interest in the
factoring problem led to new factoring techniques. Important advances in this area
were made in 1980, but none of the proposed techniques brought improvements to the
security of RSA. Another important class of practical public-key encryption schemes
was designed by ElGamal [4] in 1985. It was based on the hardness assumption of the
discrete logarithm problem.
Another crucial contribution to public-key cryptography was the digital signature,
which was adopted by the international standard ISO/IEC 9796 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.
Nowadays, the trends in cryptography include designing and developing new public-­
key schemes, adding improvements to the existing cryptographic mechanisms, and
elaborating on security proofs.
The objective of this book 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. We will focus on the practical and applied
aspects of cryptography. You will be warned about difficult subjects and those that
present issues. You will be guided to a proper references where you will find best
practices and solutions. Most of the aspects presented in the book will be followed by
implementations. This objective is to not obscure the real nature of cryptography. The
book offers strong material for both implementers and researchers. The book describes
algorithms and software systems with their interactions.

Information Security and Cryptography


In this book, we refer to the term and concept of information as to quantity. To go
through the introduction to cryptography and to show its applicability in presenting
algorithms and implementation technologies (such as C++), first you need to have a
background in the issues that occur often in information security. When a particular
transaction occurs, all parties involved in that transaction must be sure (or ensured)
that specific objectives related to information security are met. A list of these security
objectives is given in Table 2-1.
To define the issues regarding information security when the information is
sent in a physical format (for example, documents), several protocols and security

16
Chapter 2 Cryptography Fundamentals

mechanisms have been proposed. The objectives regarding information security may be
accomplished by applying mathematical algorithms or work protocols on information
that needs to be protected and additionally by following specific procedures and laws.
An example of physical document protection is a sealed envelope (the mechanism of
protection) that covers 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 without the right to so may be punished. There
are situations in which the physical paper itself, which contains the information that
needs to be protected, may have special characteristics that certify the originality of the
data/information. For example, to refrain from the forging of bank notes, paper currency
has special ink and matter.

Table 2-1. Security Objectives


Security Objective Description

Privacy/confidentiality The information is kept secret against 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 to be something, in order to
send the information between the sender and the receiver
Message The process/characteristic through which the origin of the data is
authentication 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 authentication/ The action of validating the identity of an entity, which may be a computer,
identification person, credit card, etc.
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 that stamps the time of creation or the existence of information
(continued)

17
Chapter 2 Cryptography Fundamentals

Table 2-1. (continued)

Security Objective Description

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 to 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
Non-repudiation The process of restraining the negation of other previous commitments or
actions
Anonymity The action of making anonymous an entity's identity that is involved in a
particular action/process

From a conceptual point of view, how the information is manipulated did not change
overmuch. We are considering here 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 non-repudiation, data origin
authentication, identification, and witnessing.
To achieve the security of information in electronic communication, the
requirements introduced by the legal and technical skills should be followed. On the
other hand, it is not guaranteed that the above objectives of protection are fulfilled
accordingly. The technical part of the information security is assured by cryptography.
Cryptography is 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 the authentication. Cryptography not only
provides the security of the information but also a specific set of techniques.

18
Chapter 2 Cryptography Fundamentals

C
 ryptography Goals
From the security objectives presented in Table 2-1, the following represent a basis from
which can be derived the others:

• Privacy/confidentiality (Definitions 2.5 and 2.8)

• Data integrity (Definition 2.9)

• Authentication (Definition 2.7)

• Non-repudiation (Definition 2.6)

We will explain each of the four objectives in detail:

• Confidentiality is a service that is used to protect the content


of the information from unauthorized entities and access. The
confidentiality is assured through different techniques, from the use
of mathematical algorithms to physical protection, which scramble
the data into an incomprehensible form.

• Data integrity is a service that prevents unauthorized alteration of


the information. Authorized entities should have the capability to
discover and identify unauthorized manipulation of data.

• Authentication is a service that has an important role when data


or application is authenticated. 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 should 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, such as its origin, content, the time of creation/
sending, etc. From this point of view, cryptography branches the
authentication into two categories: authentication of the entity and
authentication of the data origin. The data origin authentication
leads to data integrity.

19
Chapter 2 Cryptography Fundamentals

• Non-repudiation is a service that prevents denials of previous actions


made by an entity. When a conflict occurs because an entity denies
its previous actions, it will be resolved by an existing trusted third
party that will show the actions made over data.

One of the main goals of cryptography is to fulfill the four objectives described above
on both sides, theory and practice.

C
 ryptographic Primitives
During the book, we will present 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 shows a schematic description of these primitives and the relation between
them. We will use many of the cryptographic primitives during the book, and we will
provide practical implementations every time we use them. Before using them in real-­
life applications, the primitives should be subjected to an evaluation process in order to
check if the below 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 made in
order 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


the primitives are combined. You need to be sure that they work
properly.

• Operation methods: When the 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
functionality that will depend on the mode of operation.

• Performance: This concept is related to the efficiency that a


primitive can achieve in a specific and particular mode of operation.

• Ease of implementation: This concept is more a process than a


criterion, and it refers to the primitive be used in practice.

20
Chapter 2 Cryptography Fundamentals

Figure 2-1. Cryptographic primitives taxonomy

The application and the available resources give importance to each of the above
criteria.
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 suffered
21
Chapter 2 Cryptography Fundamentals

the transition from art to science and discipline. Nowadays, there are dedicated
conferences and events in many fields of cryptography and information security.
There are also international professional associations, such as the International
Association for Cryptologic Research (IACR), whose aim is to promote the best results
of research in the area.
This book is about cryptography and cryptanalysis, implementing algorithms and
mechanisms using C++ with respect to standards.

Background of Mathematical Functions


This goal of the book IS NOT to be a monograph on abstract mathematics. However,
getting familiar with some of the fundamental mathematical concepts is necessary and
will prove to be very useful in practical implementations. One of the most important
concepts that is fundamental to cryptography is the function in the mathematical sense.
A function is also known in the literature as transformation or mapping.

Functions: One-to-One, One-Way, Trapdoor One-Way


Let’s consider as a concept a set, which is a distinct set of objects, which are known
as elements of that specific set. The following example represents set A, which has the
elements a, b, c, this being denoted as A = {a, b, c}.
Definition 2.1 [18]. Cryptography is defined as the study of the mathematical
techniques that are related to the aspects of the information security such as
confidentiality, integrity (data), authentication (entity), and authentication of the data
origin.
Definition 2.2 [18]. Let’s consider that two sets A and B and rule f are defining a
function. The rule f will assign to each element in A an element in B. The set A is known
as 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 noted 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 we
have 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, noted as Im(   f ).
Example 2.3. ( function) Let’s consider sets A = {a, b, c} and B = {1, 2, 3, 4}, and the
rule f from A to B as being defined as f(a) = 2, f(b) = 4, f(c) = 1. Figure 2-2 shows the

22
Chapter 2 Cryptography Fundamentals

representation of the two sets A, B and the function f. The preimage of element 2 is a.
The image of f is {1, 2, 4}.
Example 2.4. ( function) Let’s 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 being
divided by 11.

f (1) = 1 f ( 6 ) = 3

f ( 2) = 3 f (7 ) = 5

f ( 3) = 9 f ( 8 ) = 9

f ( 4) = 5 f (9) = 4

f ( 5 ) = 3 f (10 ) = 1

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}.

23
Chapter 2 Cryptography Fundamentals

The scheme represents the main fundamental tool for thinking of a function (you
can find it the literature as the functional diagram) as depicted in Figure 2-2, and each
element from the domain A has precisely one arrow originated from it. For each element
from codomain B we can have any number of arrows as being 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 the 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. This being said, the function is completely defined by the
domain and the mathematical description that characterize the rule f.

O
 ne-to-One Functions
Definition 2.6 [18]. We will consider a function or transformation as 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, function f : A → B is known as being
onto if Im(f) = B.
Definition 2.8 [18]. Let’s consider a function f : A → B to be considered 1 − 1 and
Im(f) = B. Then the 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 incidental with it. The functions in Examples 2.3 and 2.4
do not represent bijections. As you can see in Example 2.3, element 3 doesn’t 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 inverse function of f and it
denoted as g = f −1.

24
Chapter 2 Cryptography Fundamentals

Figure 2-3. Representation of bijection f and its inverse, g = f −1

Example 2.11. (inverse function) Let’s consider sets A = {a, b, c, d, e} and


Y = {1, 2, 3, 4, 5}, and consider the rule f which is given and represented by the lines from

25
Chapter 2 Cryptography Fundamentals

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, 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 transformations to be bijections.

O
 ne-Way Functions
In cryptography there are a certain types of functions that play an important role. Due to
the rigor, 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 be computed 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 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.

1. For the terms easy and computationally infeasible, a rigorous


definition is necessary but it will distract attention from the
general idea that is being agreed upon. For the goal of this chapter,
the simple and intuitive meaning is sufficient.

2. 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 way
that b = f(a). As an example, one may compute b = f(a) for a small
number of a values and then for these, 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 way
that f(a) = b.

The following examples will show the concept behind a one-way function.
Example 2.14. (one-way function) Consider A = {1, 2, 3, …, 16} and let’s define f(a) = ra
for all the elements a ∈ A where ra represents the remainder when 3x will be divided
with 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

26
Chapter 2 Cryptography Fundamentals

Let’s assume that we have a number situated between 1 and 16. We can see that
is very easy to find the image of it 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 that you are given is 3,
then is quite easy to see that a = 1 is what you actually need.
Remember that this example is focused on very small numbers. The key thing here is
that the amount of effort to measure f(a) is different than the amount of work in finding
a given f(a). Also 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 bigger than 1 and its positive integers divisors are 1 and
itself. Let’s take into consideration primes p = 50633 and q = 58411, compute
n = pq = 50633 · 58411 = 2957524163, and consider A = {1, 2, 3, …, n − 1}. We will
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 thing to be
done, but reversing the procedure is quite difficult.

Trapdoor One-Way Functions


Definitions 2.16 [18]. A trapdoor one-way function is represented as a one-way function
f : A → B with an extra property that by having information (also known as trapdoor
information) it will be much more feasible to have an identification for any given
b ∈ Im (f), with an a ∈ A in such 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. We should be able to identify the factors very easily with the
help of a computer program. For example, if we have very big, distinct prime numbers
(each number has about 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 quantum computers.
This is the well-known factorization problem known as integer factorization problem.
One-way and one-way trapdoor functions form the fundamental basis for public-key
cryptography. These principles are very important, and they will become much clearer later
when you explore the implementation of cryptographic techniques. It is vital and important
to understand these concepts from this section because they are the main methods and the
primary foundation for the cryptography algorithms implemented later in this chapter.

27
Chapter 2 Cryptography Fundamentals

P
 ermutations
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

p (1) = 2, p ( 2 ) = 5, p ( 3) = 4, p ( 4 ) = 2, p ( 5 ) = 1

A permutation can be described in different ways. It can be written as above or as an


array as in

æ1 2 3 4 5ö
p=ç ÷,
è 3 5 4 21 ø

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.
Since the permutations are bijections, they have inverses. If the permutation is
written as an away (second form), its inverse can be easily found by interchanging the
rows in the array and reordering the elements from the new top row and the bottom row
accordingly. In this case, the inverse of p is defined as follows:

æ1 2 3 4 5ö
p -1 = ç ÷
è 5 4 13 2 ø

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 need to suppose also 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 being the inverse perumutation. The inverse permutation is
computationally infeasible by the computers of today, unless p and q are known.

I nvolutions
Involutions are known as functions having their own inverses.

28
Chapter 2 Cryptography Fundamentals

Definition 2.20 [18]. Let’s consider a finite set S and f defined as a bijection S to S,
noted as f : S → S. In this case, the function f will be noted as an 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 shows
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 an set S with five elements

Concepts and Basic Terminology


It is very difficult to understand how cryptography was built using hard and abstract
definitions when dealing with the scientific side of the field. In the following sections, we
will list the most important terms and key concepts used in this chapter.

Domains and Codomains Used for Encryption


•  is shown as a finite set known as the alphabet of definition. We
will consider as an example  = {0,1} , which represents the binary
alphabet, an alphabet frequently used as definition.

•  is a set known as the message space. The message space has the
strings of symbols from an alphabet,  . As an example,  may
have binary strings, English text, French text, etc.

29
Chapter 2 Cryptography Fundamentals

•  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 a ciphertext.

Encryption and Decryption Transformations


• The set  is called key space. The elements of  are called keys.

• For each e Î  , there is a unique transformation Ee, representing a


bijection from  to  (i.e., Ee : M ® C ). 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 d Î  , there is a transformation Dd, representing


a bijection from  to  (i.e., Dd : C ® M ). Dd is called a
decryption function or decryption transformation.

• The process of encrypting the message m Î  or the encryption of m


consists of applying the transformation Ee over m.
• The process of decrypting the ciphertext c Î  or the decryption of c
consists of applying the transformation Dd over c.
• An encryption scheme has two important sets: {Ee : e Î } , which
represents the set of the encryption transformations, and {Dd : d Î } ,
which represents the set of the decryption transformations. The
relationship between the elements of the two sets is the following:
for each e Î  exists a unique key d Î  in such that Dd = Ee-1 ; in
other words, we have the relationship Dd(Ee(m)) = m for all m Î  .
Another term for encryption schemes is cipher.

• In the above definition, the encryption key e and the decryption key d
form a pair, usually noted as (e, d). In symmetric encryption schemes,
e and d are the same, while in asymmetric (or public-key) encryption
schemes they are different.

30
Chapter 2 Cryptography Fundamentals

• To construct an encryption scheme, the following components are


needed: the messages (or plain-texts) space  , the cipher-space  ,
the keys space  , the set of encryption transformations {Ee : e Î } ,
and the set of decryption transformations {Dd : d Î } .

The Participants in the Communication Process


The components involved in the communication process are the following (Figure 2-5):

• The entity (party) is that component that works with the information:
sending, receiving, manipulating it. The entities/parties from
Figure 2-5 are Alice, Bob, and Oscar. However, in real applications,
the entities are not necessarily people; they may be authorities or
computers, for example.

• The sender is one of the entities of a two-party communication and


it initiates the transmission of the data. The sender from Figure 2-5
is Alice.

• The receiver is the other entity of a two-party communication and


it is the intended recipient of the information. The receiver from
Figure 2-­5 is Bob.

• The communication channel is the component through which the


sender and the receiver communicate.

• The adversary is an unauthorized entity in a two-party


communication and it is different from the sender and the receiver.
Its objective is to break the security on the communication channel
in order to access the information. Other terms for the adversary
are1: enemy, attacker, opponent, eavesdropper, intruder, and
interloper. It has different types (passive and active) and will behave
differently according to aspects regarding the encryption scheme or
its intentions. Often, the attacker clones and acts like the legitimate
sender or the legitimate receiver.

1
Alice and Bob. Available online: https://en.wikipedia.org/wiki/Alice_and_Bob

31
Discovering Diverse Content Through
Random Scribd Documents
"Neither justice nor post-office employee. Say no more on that
point, uncle."

"Don't insist, Clodio," said the lawyer bitterly. "He wants to be


nothing, nothing but a downright idler, to spend his life scribbling
rhymes. Neither more nor less. The money must be handed out for
the Institute, the University, the shirt-front, the frock coat, the
polished boots, and then, when one thinks they are ready to do for
themselves, back they come, to be a burden to one, to smoke and
to eat at one's expense. I have three sons to spend my money, to
squeeze me dry, and not one to give me any help. That is all these
young gentlemen are good for."

Segundo stopped, twisting the end of his mustache, with a frown


on his face. They all stood still at the corner of the little plaza, as
people are wont to do when a conversation changes to a dispute.

"I don't know what puts that into your head, father," declared the
poet. "Do you suppose that I propose to myself never to be anything
more than Segundo García, the lawyer's son? If you do, you are
greatly mistaken. You may be very anxious to be rid of the burden of
supporting me, but you are not half as anxious as I am to relieve
you of it."

"Well, then, what are you waiting for? Your uncle is proposing a
variety of things to you and none of them suits you. Do you want to
begin by being Minister?"

The poet began to twist his mustache anew.

"There is no use in being impatient, father. I would make a very


bad post-office clerk and a still worse justice. I don't want to tie
myself down to any fixed career, in which everything is arranged
beforehand and moves by routine. In that case I should be a lawyer
like you or a notary like Uncle Genday. If we really find Don
Victoriano disposed to do anything for me, ask some position—no
matter what—without fixed duties, that will enable me to reside in
Madrid. I will take care of the rest."

"You will take care of the rest. Yes, yes, you say well. You will
draw upon me for little sums, eh? like your brother in the Philippine
Islands. Let me tell you for your guidance, then, that you needn't do
so. I didn't steal what I have, and I don't coin money."

"I am not asking anything from you!" cried Segundo, in a burst of


savage anger. "Am I in your way? I will get out of it, then; I will go
to America. That ends it."

"No," said the lawyer, calming down. "Provided you exact no more
sacrifices from me."

"Not one! not if I were starving!"

The lawyer's door opened; old Aunt Gáspara in her petticoat,


looking like a fright, had come to let them in. Tied around her head
was a cotton handkerchief which came so far over her face as
almost to conceal her sour features. Segundo drew back at this
picture of domestic life.

"Aren't you coming in?" asked his father.

"I am going with Uncle Genday."

"Are you coming back soon?"

"Directly."

Walking down the square he communicated his plans to Genday.


The latter, a short man, with a fiery temper, signified his approbation
by movements quick and restless as those of a lizard. His nephew's
ideas were not displeasing to him. His active, scheming mind, the
mind of an electoral agent and a clever notary, accepted vast
projects more readily than the methodical mind of the lawyer García.
Uncle and nephew were much of the same way of thinking as to the
best manner of profiting by Don Victoriano's influence; conversing in
this way they reached Genday's house, and the servant of the latter
—a fresh-looking girl—opened the door for her master with all the
flattering obsequiousness of a confirmed old bachelor's maid-
servant. Instead of returning home Segundo, preoccupied and
excited, walked down the plaza to the highroad, stopped at the first
clump of chestnut trees he came to, and seating himself on the step
of a wooden cross which the Jesuits had erected there during the
last mission, gave himself up to the harmless diversion of
contemplating the evening star, the constellations, and all the
splendors of the heavenly bodies.
IV.
During the tiresome siestas of Vilamorta, while the visitors to the
springs digested their glasses of mineral water and compensated
themselves for the loss of their morning sleep by a restorative nap,
the amateur musicians of the popular band practiced by themselves
the pieces they were shortly to execute together. From the
shoemaker's shop came the melancholy notes of a flute; in the
baker's resounded the lively and martial strains of the horn; in the
tobacconist's moaned a clarionet; in the cloth-shop, the suppressed
sighs of an ophicleide filled the air. Those who thus devoted
themselves to the worship of Euterpe were clerks in shops, younger
sons, the youthful element of Vilamorta. These snatches of melody
rose with piercing sonorousness on the drowsy warm atmosphere.
When the news spread that Don Victoriano Andres de la Comba and
his family were expected to arrive within twenty-four hours in the
town, to leave it again immediately for Las Vides, the brass band
was tuned to the highest pitch and ready to deafen, with any
number of waltzes, dances, and quicksteps, the ears of the
illustrious statesman.

In the town an unusual animation was noticeable. Agonde's house


was opened, ventilated, and swept, clouds of dust issuing through
the windows, at one of which, later on, appeared Agonde's sister,
with a fringe of hair over her forehead and wearing a pearl-shell
necklace. The housekeeper of the parish priest of Cebre, a famous
cook, went busily about the kitchen, and the pounding of the mortar
and the sizzling of oil could be heard. Two hours before the time of
the arrival of the stage-coach from Orense, that is to say at three
o'clock in the afternoon, the committee of the notabilities of the
Combista-radical party were already crossing the plaza, and Agonde
stood waiting on the threshold of his shop, having sacrificed to the
solemnity of the occasion his classic cap and velvet slippers, and
wearing patent-leather boots and a frock coat which made him look
more bull-necked and pot-bellied than ever. The coach from Orense
was entering the town from the side next the wood, and, at the
tinkling of the bells, the clatter of the hoofs of its eight mules and
ponies, the creaking of its unwieldy bulk, the inhabitants of
Vilamorta looked out of their windows and came to their doors; the
reactionary shop only remained closed and hostile. When the
cumbrous vehicle turned into the square the excitement increased;
barefooted children climbed on the coach steps, begging an ochavo
in whining accents; the fruit-women sitting in the arches
straightened themselves up to obtain a better view, and only Cansin,
the clothier, his hands in his trousers' pockets, his feet thrust into
slippers, continued walking up and down his shop with an Olympic
air of indifference. The overseer reined in the team, saying in
soothing accents to a rebellious mule:

"E-e-e-e-e-e-h! There, there, Canóniga."

The brass band, drawn up before the town-hall, burst into a


deafening prelude, and the first rocket whizzed into the air sending
forth a shower of sparks. The crowd rushed en masse toward the
door of the coach, to offer their hands, their arms, anything, and a
stout lady and a priest, with a cotton checked handkerchief tied
around his temples, alighted from it. Agonde, more amused than
angry, made signs to the musicians and the rocket-throwers to desist
from their task.

"He is not coming yet! he is not coming yet!" he shouted. In


effect, there were no other passengers in the omnibus. The overseer
hastened to explain:

"They are just behind, not two steps off, as one might say. In
Count de Vilar's carriage, in the barouche. On the Señora's account.
The luggage is here. And they paid for the seats as if they had
occupied them."
It was not long before the measured trot of Count de Vilar's pair
of horses was heard and the open carriage, of an old-fashioned
style, rolled majestically into the plaza. Reclining on the back seat
was a man enveloped, notwithstanding the heat, in a cloth cloak; at
his side sat a lady in a gray linen duster, the fanciful brim of her
traveling-hat standing out sharply against the pure blue of the sky.
In the front seat sat a little girl of some ten years and a
mademoiselle, a sort of transpyrenean nursery governess. Segundo,
who had kept in the background at the arrival of the diligence, this
time was less stubborn and the hand which, covered with a long
Suède glove, was stretched out in quest of a support, met with the
energetic and nervous pressure of another hand. The Minister's lady
looked with surprise at the gallant, gave him a reserved salutation
and, taking the arm Agonde offered her, walked quickly into the
apothecary's.

The statesman was slower in alighting. His adherents looked at


him with surprise. He had changed greatly since his last visit to
Vilamorta—then in the midst of the revolution—some eight or ten
years before. His iron-gray hair, whiter on the temples, heightened
the yellow hue of his complexion; the whites of his eyes, too, were
yellow and streaked with little red veins; and his furrowed and
withered countenance bore unmistakable traces of the anxieties of
the struggle for social position, the vicissitudes of the political bench,
and the sedentary labors of the forum. His frame hung loosely
together, being wanting in the erectness which is the sign of physical
vigor. When the handshakings began, however, and the "Delighted
to see you——" "At last——" "After an age——" resounded around
him, the dying gladiator revived, straightened himself up, and an
amiable smile parted his thin lips, lending a pleasing expression to
the now stern mouth. He even opened his arms to Genday, who
squirmed in them like an eel, and he clapped the Alcalde on the
back. García, the lawyer, tried to attract attention to himself, to
distinguish himself among the others, saying in the serious tone of
one who expresses an opinion in a very delicate matter:
"There, upstairs, upstairs now, to rest and to take some
refreshment."

At last the commotion calmed down, the great man entering the
apothecary's, followed by García, Genday, the Alcalde, and Segundo.

They seated themselves in Agonde's little parlor, respectfully


leaving to Don Victoriano the red rep sofa, around which they drew
their chairs in a semi-circle. Shortly afterward the ladies made their
appearance, and, now without her hat, it could be seen that Señora
de Comba was young and beautiful, seeming rather the elder sister
than the mother of the little girl. The latter, with her luxuriant hair
falling down her back and her precocious womanly seriousness, had
the aspect of a sickly plant, while her mother, a smiling blonde,
seemed overflowing with health. They spoke of the journey, of the
fertile borders of the Avieiro, of the weather, of the road; the
conversation was beginning to languish, when Agonde's sister
entered opportunely, preceded by the housekeeper of the priest,
carrying two enormous trays filled with smoking cups of chocolate,
for supper was a meal unknown to the hosts. When the trays were
set on the table and the chocolate handed around, the company
grew more animated. The Vilamortans, finding a congenial subject
on which to exercise their oratorical powers, began to press the
strangers, to eulogize the excellence of the viands, and calling
Señora de la Comba by her baptismal name, and adding an
affectionate diminutive to that of the little girl, they launched forth
into exclamations and questions.

"Is the chocolate to your taste, Nieves?"

"Do you like it thin or thick?"

"Nieves, take that morsel of cake for my sake; you will find it
excellent; only we have the secret of making it."

"Come, Victoriniña, don't be bashful; that fresh butter goes very


well with the hot bread."
"A morsel of toasted sponge-cake. Ah-ha! You don't have cake
like that in Madrid, eh?"

"No," answered the girl, in a clear and affected voice. "In Madrid
we eat crullers and doughnuts with our chocolate."

"It is the fashion here to take sponge-cake with it, not crullers.
Take that one on the top, that brown one. That's nothing, a bird
could eat it."

Don Victoriano joined in the conversation, praising the bread,


saying he could not eat it, as it had been absolutely prohibited to
him, for his malady required that he should abstain from starch and
gluten in every form—indeed, he had bread sent him from France,
bread prepared ad hoc without those elements—and as he spoke, he
turned toward Agonde, who nodded with an air of intelligence,
showing that he understood the Latin phrase. And Don Victoriano
regretted doubly the prohibition now, for there was no bread to be
compared to the Vilamorta bread—which was better of its kind than
cake, yes indeed. The Vilamortans smiled, highly flattered, but
García, with an eloquent shake of the head, said that the bread was
deteriorating, that it was not now what it had formerly been, and
that only Pellejo, the baker of the plaza, made it conscientiously,
having the patience to select the wheat, grain by grain, not letting a
single wormeaten one pass. It was for this reason that his loaves
turned out so sweet and substantial. Then a discussion arose as to
whether bread should be porous or the contrary, and as to whether
hot bread was wholesome.

Don Victoriano, reanimated by these homely details, talked of his


childhood, of the slices of bread spread with butter or molasses
which he used to eat between meals, and when he added that his
uncle, the priest, occasionally administered a sound drubbing to him,
a smile once more softened the deep lines of his face. This
expansion of feeling gave a sweeter expression to his countenance,
effacing from it the traces left by years of strife, the scars of the
wounds received in the battle of life, illuminating it with a reflection
from his vanished youth. How he longed to see again a grapevine in
Las Vides from which he had robbed grapes a hundred times when
he was a child.

"And you will rob them again now," exclaimed Clodio Genday
gayly. "We must tell the master of Las Vides to put a guard over the
vine of Jaen."

The jest was received with demonstrations of hilarity, and the girl
laughed with her shrill laugh at the idea of her papa robbing a
grapevine. Segundo only smiled. His eyes were fixed on Don
Victoriano, and he was thinking of what his life had been. He went
over in his mind the history of the great man: At Segundo's age Don
Victoriano, too, was an obscure lawyer, buried in Vilamorta, eager to
break from the shell. He had gone to Madrid, where a celebrated
jurisconsult had taken him as his assistant. The jurisconsult was a
politician, and Victoriano followed in his footsteps. How did he begin
to prosper? This period was shrouded in obscurity. Some said one
thing, some another. Vilamorta found him, when it least expected, its
candidate and representative. Once in Congress Don Victoriano's
importance grew steadily, and when the Revolution of September
came it found him in a sufficiently exalted position to be improvised
a minister. The brief ministry gave him neither time to wear out his
popularity nor to give proof of special gifts, and, with his prestige
almost intact, the Restoration admitted him as a member of a
fusionist cabinet. He had just laid down the portfolio and come to re-
establish his shattered health in his native place, where his influence
was strong and incontestible, thanks to his alliance with the
illustrious house of Mendez de las Vides. Segundo asked himself if a
lot like Don Victoriano's would satisfy his aspirations. Don Victoriano
had wealth—stocks in banks and shares in railways among whose
directors the name of the able jurisconsult figured. Our versifier
raised his eyebrows disdainfully and glanced at the Minister's wife;
that graceful beauty certainly did not love her lord. She was the
daughter of a younger son of the house of Las Vides—a magistrate;
she had probably married her husband, allured by his position. No;
most assuredly the poet did not envy the politician. Why had this
man risen to the eminent position he occupied? What extraordinary
gifts did he possess? A diffuse parliamentary orator, a passive
minister, with some forensic ability—sum total, a mediocrity.

While these reflections were passing through Segundo's mind,


Señora de Comba amused herself by examining minutely the dress
and the appearance of everyone present. She took in every detail,
under her half-closed lids, of the toilet of Carmen Agonde, who was
arrayed in a tight-fitting deep blue bodice that sent the blood to her
plethoric cheeks. She next lowered her mocking glance to the
patent-leather boots of the pharmacist, and then raised them again
to Clodio Genday's fingers, stained by the cigar, and the purple and
white checked velvet waistcoat of the lawyer García. Finally, her
glance fell on Segundo, in critical examination of his attire. But
another glance, steady and ardent, cast it back like a shield.
V.
Agonde rose early on the following morning, and descended
shortly afterward to his shop, leaving his guests wrapped in their
slumbers, and Carmen charged, the moment they should stir, to
pour the chocolate into their mouths. The apothecary desired to
enjoy the effect produced in the town by Don Victoriano's sojourn in
his house. He was reclining in his leather-covered easy-chair when
he saw Tropiezo riding past on his gray mule, and called out to him:

"Hello! Hello! Where are you bound for so early?"

"For Doas, man. I have not a minute to spare." And saying this
the doctor alighted from his mule, which he tied to an iron ring
fastened in the wall.

"Is the case so urgent?"

"Urgent? That it is. The old woman, the grandmother of Ramon,


the confectioner. It appears she has already received the last
sacrament."

"And it is only now they have sent for you?"

"No; I went to see her yesterday, and I applied two dozen


leeches, that drew their fill of blood from her. She looked like a dying
kid; she was very weak, and as thin as a wafer. Perhaps if I had
given her something that I thought of, instead of applying leeches
——"

"Ah! a trip," interrupted Agonde maliciously.

"Life is a series of trips," responded the doctor, shrugging his


shoulders. "And upstairs?" he added, raising his eyes interrogatively
to the ceiling.

"Snoring like princes."

"And he—how does he look?" asked Don Fermin, lowering his


voice and dwelling on every word.

"He?" repeated Agonde, following his example. "So-so. Oldish.


And very gray."

"But what is the matter with him? Let us hear. For as to being
sick, he is that."

"He has—a new disease—a very strange one, one of the latest
fashion." And Agonde smiled maliciously.

"New?"

Agonde half-closed his eyes, bent toward Tropiezo, and whispered


something in his ear.

Tropiezo burst into a laugh; suddenly he looked very serious, and


tapping his nose repeatedly with his forefinger:

"I know, I know," he said emphatically. "And the waters here, and
some others in France, are the only cure for that disease. If he
drinks a few glasses from the spring, he will be himself again."

Tropiezo emitted his dictamen leaning on the counter, forgetful of


the mule that was stamping impatiently at the door.

"And the Señora—what does she say of her husband's state of


health?" he suddenly asked, with a wink.

"What should she say of it, man? Probably she does not know
that it is serious."

A look of derision lighted up the inexpressive features of the


physician; he glanced at Agonde and smothering another burst of
laughter, began:

"The Señora—"

"Chut!" interrupted the apothecary furiously. The whole Comba


family were making an irruption into the shop through the small
door of the porch. Mother and daughter formed a charming group,
both wearing wide-brimmed hats of coarse straw adorned with
enormous bows of flame-colored bunting. Their écru cotton gowns
embroidered with red braid completed the rustic character of their
costumes, reminding one of a bunch of poppies and straw. The girl's
luxuriant dark hair hung loose over her shoulders, and the fair locks
of the mother curled in a tangled mass under the shade of her
broad-brimmed hat. Nieves did not wear gloves nor was there visible
on her face a trace of powder, or of any other of the cosmetics
whose use is imputed unjustly by the women of the provinces to the
Madridlenians; on the contrary, her rosy ears and neck showed signs
of energetic friction with the towel and cold water. As for Don
Victoriano, the ravages made in his countenance by care and
sickness were still more apparent in the morning light; it was not, as
Agonde had said, age that was visible there; it was virility, but
tortured, exhausted, wounded to death.

"Why! Have you had chocolate already?" asked Agonde, in


confusion.

"No, friend Saturnino, nor shall we take it, with your permission,
until we return. Don't trouble yourself on our account. Victoriniña
has ransacked your pantry—your closets——"

The child half opened a handkerchief which she held by the four
corners, disclosing a provision of bread, cake, and the cheese of the
country.

"At least let me bring you a whole cheese. I will go see if there is
not some fresh bread, just out of the oven——"
Don Victoriano objected—let him not be deprived of the pleasure
of going to breakfast in the poplar-grove near the spring, just as he
had done when a boy. Agonde remarked that those articles of food
were not wholesome for him, to which Tropiezo, scratching the tip of
his ear, responded sceptically:

"Bah! bah! bah! Those are new-fangled notions. What is


wholesome for the body—can't they understand that—is what the
body craves. If the gentleman likes bread—and for your malady,
Señor Don Victoriano, there is nothing like the waters here. I don't
know why people go to give their money to those French when we
have better things at home than any they can give us."

The Minister looked at Tropiezo with keen interest depicted on his


countenance. He called to mind his last visit to Sanchez del Abrojo
and the contraction of the lips with which the learned practitioner
had said to him:

"I would send you to Carlsbad or to Vichy, but those waters are
not always beneficial. At times they hasten the natural course of a
disease. Rest for a time, and diet yourself—we will see how you are
when you return in the autumn." And what a look Sanchez del
Abrojo put on when he said this! An impenetrable, sphinx-like
expression. The positive assertion of Tropiezo awoke tumultuous
hopes in Don Victoriano's breast. This village practitioner must know
a great deal from experience, more perhaps than the pompous
doctors of the capital.

"Come, papa," said the child impatiently, pulling him by the


sleeve.

They took the path toward the grove. Vilamorta, naturally given
to early rising, was more full of activity at this hour than in the
afternoon. The shops were open, the baskets of the fruit-venders
were already filled with fruit. Cansin walked up and down his
establishment with his hands in his pockets, affecting to have
noticed nothing, so as not to be obliged to bid good-morning to
Agonde and acknowledge his triumph. Pellejo, covered with flour,
was haggling with three shopkeepers from Cebre, who wanted to
buy some of his best wheat. Ramon, the confectioner, was dividing
chocolate into squares on a large board placed on the counter and
rapidly stamping them with a hot iron before they should have time
to cool.

The morning was cloudless and the sun was already unusually
hot. The party, augmented by García and Genday, walked through
orchards and cornfields until they reached the entrance to the walk.
Don Victoriano uttered an exclamation of joy. It was the same
double row of elms bordering the river, the foaming and joyous
Avieiro, that ran on sparkling in gentle cascades, washing with a
pleasant murmur the rocks, worn smooth by the action of the
current. He recognized the thick osier plantations; he remembered
all his longings of the day before and leaned, full of emotion, on the
parapet of the walk. The scene was almost deserted; half a dozen
melancholy and bilious-looking individuals, visitors to the springs,
were walking slowly up and down, discussing their ailments in low
tones, and eructating the bicarbonate of the waters. Nieves, leaning
back on a stone bench, gazed at the river. The child touched her on
the shoulder, saying:

"Mamma, the young man we saw yesterday."

On the opposite bank Segundo García was standing on a rock,


absorbed in meditation, his straw hat pushed far back on his head,
his hand resting on his hip, doubtless with the purpose of preserving
his equilibrium in so dangerous a position. Nieves reproved the little
girl, saying:

"Don't be silly, child. You startled me. Salute the gentleman."

"He is not looking this way. Ah! now he is looking. Salute him,
you, mamma. He is taking off his hat, he is going to fall! There! now
he is safe."
Don Victoriano descended the stone steps leading to the spring.
The abode of the naiad was a humble grotto—a shed supported on
rough posts, a small basin overflowing with the water from the
spring, some wretched hovels for the bathers, and a strong and
sickening odor of rotten eggs, caused by the stagnation of the
sulphur water, were all that the fastidious tourist found there.
Notwithstanding this, Don Victoriano's soul was filled with the purest
joy. In this naiad he beheld his youth, his lost youth—the age of
illusions, of hopes blooming as the banks of the Avieiro. How many
mornings had he come to drink from the fountain, for a jest, to wash
his face with the water, which enjoyed throughout the country the
reputation of possessing extraordinary curative virtue for the eyes.
Don Victoriano stretched out his hands, plunged them into the warm
current, feeling it slip through his fingers with delight, and playing
with it and caressing it as one caresses a loved being. But the
undulating form of the naiad escaped from him as youth escapes
from us—without the possibility of detaining it. Then the ex-Minister
felt a thirst awaken in him to drink the waters. Beside him on the
edge of the basin was a glass; and the keeper, a poor old man in his
dotage, presented it to him with an idiotic smile. Don Victoriano
drank, closing his eyes, with indescribable pleasure, enjoying the
mysterious water, charmed by the magic arts of memory. When he
had drained the glass he drew himself up and ascended the stairs
with a firm and elastic step. Victoriniña, who was breakfasting on
bread and cheese in the avenue, was astonished when her father
took a piece of bread from her lap, saying gayly:

"We are all God's creatures."


VI.
Almost as much as by Don Victoriano's arrival was Vilamorta
excited by the arrival of Señor de las Vides, accompanied by his
steward, Primo Genday. This event happened on the afternoon of
the memorable day on which Don Victoriano had infringed the
commands of science by eating half a pound of fresh bread. At three
o'clock, under a blazing sun, Genday the elder and Mendez entered
the plaza, the latter mounted on a powerful mule, the former on an
ordinary nag.

Señor de las Vides was a little old man as dry as a vine branch.
His carefully shaven cheeks, his thin lips and aristocratically pointed
nose and chin, his shrewd, kind eyes, surrounded by innumerable
crows' feet, his intellectual profile, his beardless face, called loudly
for the curled wig, the embroidered coat and the gold snuff-box of
the Campomanes and Arandas. With his delicate and expressive
countenance the countenance of Primo Genday contrasted strongly.
The steward's complexion was white and red, he had the fine and
transparent skin, showing the full veins underneath, of those who
are predisposed to hemiplegy. His eyes were of a greenish color, one
of them being attached, as it were, to the lax and drooping lid, while
the other rolled around with mischievous vivacity. His silvery curls
gave him a distant resemblance to Louis Philippe, as he is
represented on the coins which bear his effigy.

By a combination not unusual in small towns Primo Genday and


his brother Clodio served under opposite political banners, both
being in reality of one mind and both pursuing the same end; Clodio
ranged himself on the side of the radicals, Primo was the support of
the Carlist party, and in cases of emergency, in the electoral
contests, they clasped hands over the fence. When the hoofs of
Primo Genday's nag resounded on the paving-stones, the windows
of the reactionary shop were opened and two or three hands were
waved in friendly welcome. Primo paused, and Mendez continued on
his way to Agonde's door, where he dismounted.

He was received in Don Victoriano's arms, and then disappeared


among the shadows of the staircase. The mule remained fastened to
the ring, stamping impatiently, while the onlookers on the plaza
contemplated with respect the nobleman's old-fashioned harness of
embossed leather, ornamented with silver, bright with use. One after
another other mules and horses were brought to join the first comer.
And the crowd assigned them their riders with considerable
judgment. The chestnut nag of the alguazil, a fine animal, with a
saddle and a silk headstall, was no doubt for the Minister. The black
donkey with the side-saddle—who could doubt that it was for the
Señora? The other gentle white donkey they would give to the little
girl. The Alcalde's ass was for the maid. Agonde would ride the mare
he always rode, the Morena, that had more malanders on her head
than hairs in her tail. During this time the radicals, García, Clodio,
Genday, and Ramon, were discussing the respective merits of the
animals and the condition of their trappings and calculating the
probabilities of their being able to reach Las Vides before nightfall.
The lawyer shook his head, saying emphatically and sententiously:

"They are taking their time about it if they expect to do that."

"And they are bringing the alguazil's horse for Don Victoriano!"
exclaimed the tobacconist. "Tricky as the very devil! There will be a
scene. When you rode him, Segundo, did he play you no trick?"

"Me, no. But he is lively."

"You shall see, you shall see."

The travelers were now coming out of the house, and the
cavalcade began to form. The ladies seated themselves in their side-
saddles and the men settled their feet in their stirrups. Then the
scene predicted by the tobacconist took place, to the great scandal
and the further delay of the party. As soon as the alguazil's nag
became aware of the presence of a female of his race he began to
snuff the air excitedly, neighing fiercely. Don Victoriano gathered up
the reins, but, before the animal had felt the iron in his mouth, he
became so unmanageable, first rearing, then kicking violently, and
finally turning his head around to try to bite his rider's legs, that Don
Victoriano, somewhat pale, thought it prudent to dismount. Agonde,
furious, dismounted also.

"What an infernal animal!" he cried. "Here, brutes—who told you


to bring the alguazil's horse? One would suppose you didn't know it
was a wild beast. You—Alcalde, or you, García—quick, go for
Requinto's mule; it is only two steps from here. Señor Don
Victoriano, take my mule. And that tiger, to the stable with him!"

"No," interrupted Segundo, "I will ride him as he is already


saddled. I will go with you as far as the cross."

And Segundo, providing himself with a strong switch, caught the


nag by the mane and at a bound was in the saddle. Instead of
leaning his weight on the stirrup he pressed the animal's sides
between his legs, raining a shower of blows at the same time on his
head. The animal, which was already beginning to curvet and prance
again, gave a snort of pain, and now, quivering and subdued,
obeyed his rider's touch. The cavalcade put itself in motion as soon
as Requinto's mule was brought, after handshakings, waving of hats,
and even a timid viva, from what quarter no one knew. The cortége
proceeded along the highway, the mare and the mules heading the
procession, the donkeys following behind, and at their side the nag,
kept in order by dint of switching. The sun was sinking in the west,
turning the dust of the road into gold; the chestnut trees cast
lengthened shadows on the ground, and from the osier-brake came
a pleasant breeze laden with moisture from the river.

Segundo rode along in silence; Victoriniña, delighted to be riding


on a donkey, smiled, making fruitless efforts to hide with her frock
her sharp knee-bones, which the shape of the saddle compelled her
to raise and uncover. Nieves, leaning back in her saddle, opened her
rose-lined écru lace parasol, and, as they started, drew from her
bosom a diminutive watch, which she consulted for the hour. A few
moments of embarrassed silence followed. At last Segundo felt that
it was necessary to say something:

"How are you doing, Victoriniña?" he said to the child. "Are you
comfortable?"

"Yes, quite comfortable."

"I warrant you would rather ride on my horse. If you are not
afraid I will take you before me."

The girl, whose embarrassment had now reached its height,


lowered her eyes without answering; her mother, smiling graciously,
however, now joined in the conversation.

"And tell me, García, why don't you address the child as thou?
You treat her with so much ceremony! You will make her fancy she is
a young lady already."

"I should not dare to do so without her permission."

"Come, Victoriniña, tell this gentleman he has your permission."

The child took refuge in that invincible muteness of growing girls


whom an exquisite and precocious sensibility renders painfully shy. A
smile parted her lips, and at the same time her eyes filled with tears.
Mademoiselle said something gently to her in French; meanwhile
Nieves and Segundo, laughing confidentially at the incident, found
the way smoothed for them to begin a conversation.

"When do you think we shall arrive at Las Vides? Is it a pretty


place? Shall we be comfortable there? How will it agree with
Victoriano? What sort of a life shall we lead? Shall we have many
visitors? Is there a garden?"
"Las Vides is a beautiful place," said Segundo. "It has an air of
antiquity—a lordly air, as it were. I like the escutcheon, and a
magnificent grapevine that covers the courtyard, and the camellias
and lemon trees in the orchards, that look like good-sized chestnut
trees, and the view of the river, and, above all, a pine grove that
talks and even sings—don't laugh—that sings; yes, Señora, and
better than most professional singers. Don't you believe it? Well, you
shall see for yourself presently."

Nieves looked with lively curiosity at the young man and then
hastily turned her glance aside, remembering the quick and nervous
hand-pressure of the day before, when she was alighting from the
carriage. For the second time in the space of a few hours this young
man had surprised her. Nieves led an extremely regular life in Madrid
—the life of the middle classes, in which all the incidents are
commonplace. She went to mass and shopped in the morning; in the
afternoon she went to the Retiro, or made visits; in the evening she
went to her parents' house or to the theater with her husband; on
rare occasions to some ball or banquet at the house of the Duke of
Puenteanchas, a client of Don Victoriano's. When the latter received
the portfolio it made little change in Nieves' way of life. She received
a few more salutations than before in the Retiro; the clerks in the
shops were more attentive to her; the Duchess of Puenteanchas said
some flattering things to her, calling her "pet," and here ended for
Nieves the pleasure of the ministry. The trip to Vilamorta, the
picturesque country of which she had so often heard her father
speak, was a novel incident in her monotonous life. Segundo
seemed to her a curious detail of the journey. He looked at her and
spoke to her in so odd a way. Bah, fancies! Between this young man
and herself there was nothing in common. A passing acquaintance,
like so many others to be met here at every step. So the pines sang,
did they? A misfortune for Gayarre! And Nieves smiled graciously,
dissembling her strange thoughts and went on asking questions, to
which Segundo responded in expressive phrases. Night was
beginning to fall. Suddenly, the cavalcade, leaving the highroad,
turned into a path that led among pine groves and woods. At a turn
of the path could be seen the picturesque dark stone cross, whose
steps invited to prayer or to sentimental reverie. Agonde stopped
here and took his leave of the party, and Segundo followed his
example.

As the tinkling of the donkeys' bells grew fainter in the distance


Segundo felt an inexplicable sensation of loneliness and
abandonment steal over him, as if he had just parted forever from
persons who were dear to him or who played an important part in
his life. "A pretty fool I am!" said the poet to himself. "What have I
to do with these people or they with me? Nieves has invited me to
spend a few days at Las Vides, en famille. When Nieves returns to
Madrid this winter she will speak of me as 'That lawyer's son, that
we met at Vilamorta.' Who am I? What position should I occupy in
her house? An altogether secondary one. That of a boy who is
treated with consideration because his father disposes of votes."

While Segundo was thus caviling, the apothecary overtook him,


and horse and mule pursued their way side by side. In the twilight
the poet could distinguish the placid smile of Agonde, his red
cheeks, looking redder in contrast to the lustrous black mustache,
his expression of sensual amiability and epicurean beatitude. An
enviable lot was the apothecary's. This man was happy in his
comfortable and well-ordered shop, with his circle of friends, his cap
and his embroidered slippers, taking life as one takes a glass of
cordial, sipping it with enjoyment, in peace and harmony, along with
the other guests at the banquet of life. Why should not Segundo be
satisfied with what satisfied Agonde perfectly? Whence came this
longing for something that was not precisely money, nor pleasure,
nor fame, nor love—which partook of all these, which embraced
them all and which perhaps nothing would satisfy?

"Segundo."

"Eh?" he answered, turning his head toward Agonde.

"How silent you are, my boy! What do you think of the Minister?"
"What would you have me think of him?"

"And the Señora? Come, you have noticed her, I warrant. She
wears black silk stockings, like the priests. When she was mounting
the donkey——"

"I am going to take a gallop as far as Vilamorta. Do you care to


join me, Saturnino?"

"Gallop with this mule? I should arrive there with my stomach in


my mouth. Gallop you, if you have a fancy for doing so."

The nag galloped for half a league or so, urged by his rider's
whip. As they drew near the canebrake by the river, Segundo
slackened his horse's gallop to a very slow walk. It was now almost
dark and the cool mists rose, moist and clinging, from the bosom of
the Avieiro. Segundo remembered that it was two or three days
since he had put his foot in Leocadia's house. No doubt the
schoolmistress was now fretting herself to death, weeping and
watching for him. This thought brought sudden balm to Segundo's
wounded spirit. How tenderly Leocadia loved him! With what joy did
she welcome him! How deeply his poetry, his words, moved her! And
he—why was it that he did not share her ardor? Of this exclusive,
this absolute, boundless love, Segundo had never deigned to accept
even the half; and of all the tender terms of endearment invented by
the muse he chose for Leocadia the least poetical, the least
romantic; as we separate the gold and silver in our purse from the
baser coin, setting aside for the beggar the meanest copper, so did
Segundo dispense with niggard hand the treasures of his love. A
hundred times had it happened to him, in his walks through the
country, to fill his hat with violets, with hyacinths and branches of
blackberry blossoms, only to throw them all into the river on
reaching the village, in order not to carry them to Leocadia.
VII.
While she distributed their tasks among the children, saying to
one, "Take care to make this hem straight," to another, "Make this
seam even, the stitch smaller," to a third, "Use your handkerchief
instead of your dress," and to still another, "Sit still, child, don't
move your feet," Leocadia cast a glance from time to time toward
the plaza in the hope of seeing Segundo pass by. But no Segundo
was to be seen. The flies settled themselves to sleep, buzzing, on
the ceiling; the heat abated; the afternoon came, and the children
went away. Leocadia felt a profound sadness take possession of her
and, without waiting to put the house in order, she went to her room
and threw herself on the bed.

The glass door was pushed gently open, and some one entered
softly.

"Mamma," said the intruder, in a low voice.

The schoolmistress did not answer.

"Mamma, mamma," repeated the hunchback, in a louder voice.


"Mamma!" he shouted at last.

"Is that you? What do you want?"

"Are you ill?"

"No, child."

"As you went to bed——'

"I have a slight headache. There, leave me in peace."


Minguitos turned round and walked in silence toward the door. As
her eyes fell on the protuberance of his back, a sharp pang pierced
the heart of the schoolmistress. How many tears that hump had cost
her in other days. She raised herself on her elbow.

"Minguitos!" she called.

"What is it, mamma?"

"Don't go away. How do you feel to-day? Have you any pain?"

"I feel pretty well, mamma. Only my chest hurts me."

"Let me see; come here."

Leocadia sat up in the bed and, taking the child's head between
her hands, looked at him with a mother's hungry look. Minguitos'
face was long and of a melancholy cast; the prominent lower jaw
was in keeping with the twisted and misshapen body that reminded
one of a building shaken out of shape by an earthquake or a tree
twisted by a hurricane. Minguitos' deformity was not congenital. He
had always been sickly, indeed, and it had always been remarked
that his head seemed too heavy for his body, and that his legs
seemed too frail to support him. Leocadia recalled one by one the
incidents of his childhood. At five years old the boy had met with an
accident—a fall down the stairs; from that day he lost all his
liveliness; he walked little and never ran. He contracted a habit of
sitting Turkish fashion, playing marbles for hours at a time. If he
rose his legs soon warned him to sit down again. When he stood, his
movements were vacillating and awkward. When he was quiet he
felt no pain, but when he turned any part of his body, he
experienced slight pains in the spinal column. The trouble increased
with time; the boy complained of a feeling as if an iron band were
compressing his chest. Then his mother, now thoroughly alarmed,
consulted a famous physician, the best in Orense. He prescribed
frictions with iodine, large doses of phosphates of lime, and sea-
bathing. Leocadia hastened with the boy to a little sea-port. After
taking two or three baths, the trouble increased; he could not bend
his body; his spinal column was rigid and it was only when he was in
a horizontal position that he felt any relief from his now severe
pains. Sores appeared on his skin, and one morning when Leocadia
begged him with tears to straighten himself, and tried to lift him up
by the arms, he uttered a horrible cry.

"I am broken in two, mamma—I am broken in two," he repeated


with anguish, while his mother, with trembling fingers sought to find
what had caused his cry.

It was true! The backbone had bent outward, forming an angle


on a level with his shoulderblades, the softened vertebræ had sunk
and cifosis, the hump, the indelible mark of irremediable calamity,
was to deform henceforth this child who was dearer to her than her
life. The schoolmistress had had a moment of animal and sublime
anguish, the anguish of the wild beast that sees its young mutilated.
She had uttered shriek after shriek, cursing the doctor, cursing
herself, tearing her hair and digging her nails into her flesh.
Afterward tears had come and she had showered kisses, delirious,
but soothing and sweet, on the boy, and her grief took a resigned
form. During nine years Leocadia had had no other thought than to
watch over her little cripple by night and by day, sheltering him in
her love, amusing with ingenious inventions the idle hours of his
sedentary childhood. A thousand incidents of this time recurred to
Leocadia's memory. The boy suffered from obstinate dyspnœa, due
to the pressure of the sunken vertebræ on the respiratory organs,
and his mother would get up in the middle of the night and go in her
bare feet to listen to his breathing and to raise his pillows. As these
recollections came to her mind Leocadia felt her heart melt and
something stir within her like the remains of a great love, the warm
ashes of an immense fire, and she experienced the unconscious
reaction of maternity, the irresistible impulse which makes a mother
see in her grown-up son only the infant she has nursed and
protected, to whom she would have given her blood, if it had been
necessary, instead of milk. And uttering a cry of love, pressing her
feverish lips passionately to the pallid temples of the hunchback, she
said, falling back naturally into the caressing expressions of the
dialect:

"Malpocadiño. Who loves you? say, who loves you dearly? Who?"

"You don't love me, mamma. You don't love me," the boy
returned, half-smiling, leaning his head with delight on the bosom
that had sheltered his sad childhood. The mother, meantime, wildly
kissed his hair, his neck, his eyes—as if to make up for lost time—
lavishing upon him the honeyed words with which infants are
beguiled, words profaned in hours of passion, which overflowed in
the pure channel of maternal love.

"My treasure—my king—my glory."

At last the hunchback felt a tear fall on his cheek. Delicious


assuagement! At first, the tears were large and round, scorching
almost, but soon they came in a gentle shower and then ceased
altogether, and there remained where they had fallen only a grateful
sense of coolness. Passionate phrases rushed simultaneously from
the lips of mother and son.

"Do you love me dearly, dearly, dearly? As much as your whole


life?"

"As much, my life, my treasure."

"Will you always love me?"

"Always, always, my joy."

"Will you do something to please me, mamma? I want to ask you


——"

"What?"

"A favor. Don't turn your face away!"


The hunchback observed that his mother's form suddenly grew
stiff and rigid as a bar of iron. He no longer felt the sweet warmth of
her moist eyelids, and the gentle contact of her wet lashes on his
cheek. In a voice that had a metallic sound Leocadia asked her son:

"And what is the favor you want? Let me hear it."

Minguitos murmured without bitterness, with resignation:

"Nothing, mamma, nothing. I was only in jest."

"But what was the favor you were going to ask me?"

"Nothing, nothing, indeed."

"No, you wanted to ask something," persisted the schoolmistress,


seizing the pretext to give vent to her anger. "Otherwise you are
very deceitful and very sly. You keep everything hidden in your
breast. Those are the lessons Flores teaches you; do you think I
don't notice it?"

Saying this, she pushed the boy away from her, and sprang from
the bed. In the hall outside almost at the same moment was heard a
firm and youthful step. Leocadia trembled, and turning to Minguitos,
stammered:

"Go, go to Flores. Leave me alone. I do not feel well, and you


make me worse,"

Segundo's brow was clouded, and as soon as the joy of seeing


him had subsided Leocadia was seized with the desire to restore him
to good humor. She waited patiently for a fitting opportunity,
however, and when this came, throwing her arms around his neck,
she began with the complaint: Where had he kept himself? Why had
he stayed away so long? The poet unburdened himself of his
grievances. It was intolerable to follow in the train of a great man.
And allowing himself to be carried away by the pleasure of speaking
of what occupied his mind he described Don Victoriano and the
radicals, he satirized Agonde's reception of his guests, his manner of
entertaining them, spoke of the hopes he founded in the protection
of the ex-Minister, giving them as a reason for the necessity of
paying court to Don Victoriano. Leocadia fixed her dog-like look on
Segundo's countenance.

"And the Señora and the girl—what are they like?"

Segundo half-closed his eyes the better to contemplate an


attractive and charming image that presented itself to his mental
vision, and to reflect that in the existence of Nieves he played no
part whatsoever, it being manifest folly for him to think of Señora de
Comba, who did not think of him. This reflection, natural and simple
enough, aroused his anger. There was awakened within him a keen
longing for the unattainable, that insensate and unbridled desire
with which the likeness of a beautiful woman dead for centuries may
inspire some dreamer in a museum.

"But answer me—are those ladies handsome?" the schoolmistress


asked again.

"The mother, yes"—answered Segundo, speaking with the


careless frankness of one who is secure of his auditor. "Her hair is
fair, and her eyes are blue—a light blue that makes one think of the
verses of Becquer." And he began to recite:

"'Tu pupila es azul, y cuando ries


Su claridad suave me recuerda——'"

Leocadia listened to him at first with eyes cast down; afterward


with her face turned away from him. When he had finished the
poem she said in an altered voice, with feigned calmness.

"They will invite you to go there."

"Where?"
"To Las Vides, of course. I hear they intend to have a great deal
of company."

"Yes; they have given me a pressing invitation, but I shall not go.
Uncle Clodio insists upon it that I ought to cultivate the friendship of
Don Victoriano so that he may be of use to me in Madrid and help
me to get a position there. But, child, to go and play a sorry part is
not to my liking. This suit is the best I have, and it is in last year's
fashion. If they play tresillo or give tips to the servants—and it is
impossible to make my father understand this—and I shall not try to
do so: God forbid. So that they shall not catch a sight of me in Las
Vides."

When she heard what his intentions were, Leocadia's


countenance cleared up, and rising, radiant with happiness, she ran
to the kitchen. Flores was washing plates and cups and saucers by
the light of a lamp, knocking them angrily together and rubbing
savagely.

"The coffee-pot—did you clean it?"

"Presently, presently," responded the old woman. "Anyone would


think that one was made of wood, that one is never to get tired—
that one can do things flying."

"Give it to me, I will clean it. Put more wood on the fire; it is
going out and the beefsteak will be spoiled." And so saying Leocadia
washed the coffee-pot, cleaning the filter with a knitting-needle, and
put some fresh water down to boil in a new saucepan, throwing
more wood on the fire.

"Yes, heap on wood," growled Flores, "as we get it for nothing!"

Leocadia, who was slicing some potatoes for the beefsteak, paid
no attention to her. When she had cut up as many as she judged
necessary, she washed her hands hastily in the jar of the drain, full
of dirty water, on whose surface floated large patches of grease. She
then hurried to the parlor where Segundo was waiting for her, and
soon afterward Flores brought in the supper, which they ate, seated
at a small side-table. By the time they had got to the coffee
Segundo began to be more communicative. This coffee was what
Leocadia most prided herself on. She had bought a set of English
china, an imitation lacquer-box, a vermeil sugar-tongs and two small
silver spoons, and she always placed on the table with the coffee a
liquor-stand, supplied with cumin, rum, and anisette. At the third
glass, of cumin, seeing the poet amiable and propitious, Leocadia
put her arm around his neck. He drew back brusquely, noticing with
strong repulsion the odor of cooking and of parsley with which the
garments of the schoolmistress were impregnated.

At this moment precisely Minguitos, after letting his shoes drop on


the floor, was drawing the coverlet around him with a sigh. Flores,
seated on a low chair, began to recite the rosary. The sick child
required, to put him to sleep, the monotonous murmur of the husky
voice which had lulled him to rest, ever since his mother had ceased
to keep him company at bedtime. The Ave Marias and Gloria Patris,
mumbled rather than pronounced, little by little dulled thought and,
by the time the litany was reached, sleep had stolen over him, and,
half-unconscious, it was with difficulty he made the responses to the
barbarous phrases of the old woman: "Juana celi—Ora pro nobis—
Sal-es-enfermorun—nobis—Refajos pecadorum—bis—Consolate
flitorum—sss——"

The only response was the labored, restless, uneven breathing


that came through the sleeping boy's half-closed lips. Flores softly
put out the tallow candle, took off her shoes, in order to make no
noise, and stole out gently, feeling her way along the dining-room
wall. From the moment in which Minguitos fell asleep there was no
more rattling of dishes in the kitchen.

You might also like