100/180MM DISTRIBUTED GRAPHIC RECORDER: USER GUIDE
HA029324
Issue 11 Oct 14
User Guide
Page 268
(Continued)
8.2.4 SECURITY (Cont.)
The following C++ code is intended for use in creating a suitable 16-bit encrypted register using an IP address
and password:
/*---------------------------------------------------------------------------
FUNCTION
:
MB_Driver::encrypt
DESCRIPTION : Create an encrypted value from a password string
ARGUMENTS : pswd : Pointer to password from network
fi
le
eKey : Pointer to eKey, usually I.P. address (must be 4 bytes)
RETURN : result : A 16 bit value representing the encryption result
NOTES
:
None
---------------------------------------------------------------------------*/
Ushort MB_Driver::encrypt(cchar *pswd, cchar *ipAddr)
{
Uchar key1;
Uchar key2;
Ushort dataLen;
Uchar ibyte;
Ushort byteResult = 0;
Uchar *encryptedData = NULL;
Uchar eKeys[4];
Ulong ipAddress;
/* Convert ip address to an unsigned long value so that we can manipulate
each of the 4 bytes, to be used as our private keys */
ipAddress = inet_addr(ipAddr);
// Now split the bytes up by copying the IP address into a byte array
memcpy(eKeys, &ipAddress, sizeof(Ulong));
// From the 4 bytes of the IP address create two exclusive keys
key1 = eKeys[0] ^ eKeys[3];
key2 = eKeys[1] ^ eKeys[2];
// Calculate the length of the string to be encrypted
dataLen = strlen(pswd);
// Create some memory to store the new encrypted password
encryptedData = (Uchar*) malloc(sizeof(Uchar)*dataLen);
/* Copy the unencrypted password into a byte array, so we can use the
character code as each byte value */
memcpy(encryptedData, pswd, dataLen);
/* Perform EXOR comparison between keys and raw data.
Perform the operation on each byte using alternate key values
starting at byte 1 with key 1 */
for(ibyte=0; ibyte < dataLen;)
Summary of Contents for 6100
Page 2: ......
Page 4: ...EUROT H ERM ...
Page 377: ...100 180 MM DISTRIBUTED GRAPHIC RECORDER USER GUIDE This page is de ...
Page 396: ......