Cryptography Reference
In-Depth Information
Example A.1 We write a text string to a file called "testfile" in the current
directory and then we read the text string from the file:
Some of the previous functions are combined in the next function,
messagetobytes , which converts a message to a list of bytes, where the
message can be either an even-length hexadecimal (byte) string, an ordinary text
string, or a file. These conversions are useful to process the messages prior to
encryption or authentication in some schemes. The first input parameter of the
function corresponds to the message string or a string that is the name of a file in
the current directory and the second parameter is a name that tells the function the
type of message; the possible values for this parameter are file , text or hex (of
course, hex strings are also text strings except that we use a different method to
convert them to lists of bytes). The output of the function is a list of bytes given as
integers in the 0..255 range and we often use this format to perform on the message
the operations required by several cryptographic primitives.
 
Search WWH ::




Custom Search