Cryptography Reference
In-Depth Information
Appendix A
Some Maple Conversion Functions
Here we give some auxiliary Maple conversion functions that are used in many of
the implementations of schemes and algorithms in the text. Although the alphabet
of choice when discussing the theoretical aspects of cryptography is the binary
alphabet f 0 ; 1 g , when implementing a cryptosystem we usually prefer to work
with the alphabet formed by the base-256 digits, which correspond to the integers
in the 0..255 range and which we refer to as bytes. Each of the 256 bytes can be
represented in several ways and we try to use whichever is most convenient. For
example, they can be represented as decimal numbers in the set f 0 ; 1 ; ... ; 255 g ,or
as hexadecimal numbers in the set f 00 ; 01 ; ... ; ff g , where each of these numbers is
represented by two hexadecimal digits, with the rightmost one being the least
significant. It is customary and convenient to use two hexadecimal digits—even
for numbers less than 16, for which the left digit will be a 0—because this makes it
possible to group several bytes in an even-length hexadecimal string (also called a
byte string or an octet string) and go back to the list of bytes without ambiguity. Of
course, one byte can also be represented in binary as a string (or as a list) of 8 bits.
In general, we use the
big-endian notation in which the most significant digit is
written to the left.
The use of bytes for the basic alphabet is convenient because our example
messages are usually English text strings which are easily converted to and from
lists or strings of bytes. The preferred format for the messages, keys, etc., is either
even-length hexadecimal strings or lists of bytes given as decimal numbers. Of
course, the conversion between these two formats is easy and fast. Moreover,
working at the byte level is also useful from an efficiency point of view. For
example, in Chap. 2 the bitwise Xor is implemented at the byte level by con-
structing a table where the result of computing the Xor of any two bytes (viewed as
8-bit strings) is stored. This table is quickly built and uses only a little memory.
When computing the bitwise Xor of two long bit strings we only have to make a
table look-up for each pair of 8-bit substrings to be Xor-ed. Combining this with
the use of Maple's function convert/bytes to convert between ASCII-8 text
messages (where each character corresponds to one byte) and lists of bytes, we can
 
Search WWH ::




Custom Search