2.3.7.3 Binary Document XOR Data Transformation Method 1
Data transformed by Binary Document XOR Data Transformation Method 1 for encryption MUST be as specified in the EncryptData_Method1 procedure. This procedure takes the following parameters:
Password: An ASCII string that specifies the password to be used to encrypt the data.
Data: An array of unsigned 8-bit integers that specifies the data to be encrypted.
XorArrayIndex: An unsigned integer that specifies the initial index into the XOR obfuscation array to be used.
FUNCTION EncryptData_Method1 PARAMETERS Password, Data, XorArrayIndex DECLARE XorArray as array of 8-bit unsigned integers SET XorArray TO CreateXorArray_Method1(Password) FOR Index FROM 0 TO Data.Length SET Value TO Data[Index] SET Value TO (Value rotate left 5 bits) SET Value TO Value BITWISE XOR XorArray[XorArrayIndex] SET DATA[Index] TO Value INCREMENT XorArrayIndex SET XorArrayIndex TO XorArrayIndex MODULO 16 END FOR END FUNCTION
Data transformed by the Binary Document XOR Data Transformation Method 1 for decryption MUST be as specified in the DecryptData_Method1 procedure. This procedure takes the following parameters:
Password: An ASCII string that specifies the password to be used to decrypt the data.
Data: An array of unsigned 8-bit integers that specifies the data to be decrypted.
XorArrayIndex: An unsigned integer that specifies the initial index into the XOR obfuscation array to be used.
FUNCTION DecryptData_Method1 PARAMETERS Password, Data, XorArrayIndex DECLARE XorArray as array of 8-bit unsigned integers SET XorArray TO CreateXorArray_Method1(Password) FOR Index FROM 0 to Data.Length SET Value TO Data[Index] SET Value TO Value BITWISE XOR XorArray[XorArrayIndex] SET Value TO (Value rotate right 5 bits) SET Data[Index] TO Value INCREMENT XorArrayIndex SET XorArrayIndex TO XorArrayIndex MODULO 16 END FOR END FUNCTION