-6-
v7.0
Integrity
2. Integrity
The data integrity security ensures the correctness or accuracy of data. The data is protected against unauthorized modification,
deletion, creation, and replication and provides an indication of these unauthorized. Integrity implies that the data is an exact
copy of some original version.
Data integrity is provided by hash functions like Message Digest Algorithm (MD5) or Secure Hash Algorithm (SHA). The following
methods are provided by the Encryption libraries:
•
MD5
algorithm takes as input a message of arbitrary length and produces as output a 128-bit “fingerprint” or “message
digest” of the input message. MD5 is currently a standard, Internet Engineering Task Force (IETF) Request for Comments
(RFC) 1321. In comparison, MD5 is not quite as fast as the MD4 algorithm, but offers much more assurance of data secu-
rity.
•
SHA
is considered to be the successor to MD5. The Federal Information Processing Standard (FIPS 180-2) specifies four
secure hash algorithms: SHA-1, SHA-256, SHA-384, and SHA-512. All algorithms are iterative, one-way hash functions
that can process a message with a maximum length of 2
64
bits to 2
128
bits to produce a 160 to 512-bit condensed repre-
sentation called a message digest. The input message is processed in 512-bit to 1024-bit blocks. The four algorithms
differ most significantly in the number of bits for the message digest length. Each SHA algorithm processes a message
in two stages: preprocessing and hash computation. Preprocessing involves padding a message, parsing the padded
message into 512-bit or 1024-bit blocks, and setting initialization values to be used in the hash computation. The hash
computation generates a message schedule from the padded message and uses that schedule, along with functions,
constants, and word operations to iteratively generate a series of hash values. The final hash value generated by the hash
computation is used to determine the message digest.
2.1. Waspmote Libraries
2.1.1. Waspmote Hash Files
WaspHash.h is the header file of the class, and WaspHash.cpp is the class where the functions and variables are implemented.
It is mandatory to include the Hash library when using it. The following line must be introduced at the beginning of the code:
#include <WaspHash.h>
2.1.2. Constructor
To start using Waspmote Hash library, an object from class ‘WaspHash’ must be created. This object, called ‘
HASH
’, is created
inside the Waspmote Hash library and it is public to all libraries. It is used through the guide to show how the Waspmote Hash
library works.
When creating this constructor, no variables are initialized by default.
2.1.3. Pre-Defined Constants
There are some constants defined in ‘WaspHash.h’ related with the different encryption and padding modes that can be used
to encrypt and decrypt messages.