2.3.7.5 Binary Document XOR Array Initialization Method 2

The CreateXorArray_Method2 procedure specifies how a 16-byte XOR obfuscation array is initialized. The procedure takes the following parameter:

  • Password: A string of single-byte characters that specifies the password to be used to encrypt the data. Password MUST NOT be longer than 15 characters. Password MUST be transformed from Unicode to single-byte characters by using the method specified in section 2.3.7.4, which results in the password verifier matching.

     FUNCTION CreateXorArray_Method2
         PARAMETERS Password
         RETURNS array of 8-bit unsigned integers
         
         DECLARE Verifier as 32-bit unsigned integer
         DECLARE VerifierHighWord as 16-bit unsigned integer
         DECLARE KeyHigh as 8-bit unsigned integer
         DECLARE KeyLow as 8-bit unsigned integer
      
         SET Verifier TO CreatePasswordVerifier_Method2(Password)
         SET VerifierHighWord TO 16 most significant bits of Verifier
         SET KeyHigh TO 8 most significant bits of VerifierHighWord
         SET KeyLow TO 8 least significant bits of VerifierHighWord
      
         SET PadArray TO (0xBB, 0xFF, 0xFF, 0xBA, 0xFF, 0xFF, 0xB9, 0x80,
                          0x00, 0xBE, 0x0F, 0x00, 0xBF, 0x0F, 0x00)
         SET ObfuscationArray TO (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                                  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)
      
         SET Index TO 0
         WHILE Index IS LESS THAN Password.Length
             SET ObfuscationArray[Index] TO Password[Index]
             INCREMENT Index
         END WHILE
         WHILE Index IS LESS THAN 16
             SET ObfuscationArray[Index] TO PadArray[Index MINUS Password.Length]
             INCREMENT Index
         END WHILE
      
         SET Index TO 0
         WHILE Index IS LESS THAN 16
             SET Temp1 TO ObfuscationArray[Index] BITWISE XOR KeyLow
             SET ObfuscationArray[Index] TO Ror(Temp1)
      
             INCREMENT Index
      
             SET Temp1 TO ObfuscationArray[Index] BITWISE XOR KeyHigh
             SET ObfuscationArray[Index] TO Ror(Temp1)
      
             INCREMENT Index
         END WHILE
      
         RETURN ObfuscationArray
     END FUNCTION