2.3.7.1 Binary Document Password Verifier Derivation Method 1

The CreatePasswordVerifier_Method1 procedure specifies how a 16-bit password verifier is obtained from an ASCII password string. The password verifier is used in XOR obfuscation as well as for document write protection.

The CreatePasswordVerifier_Method1 procedure takes the following parameter:

  • Password: An ASCII string that specifies the password to be used when generating the verifier.

     FUNCTION CreatePasswordVerifier_Method1
         PARAMETERS Password
         RETURNS 16-bit unsigned integer
      
         DECLARE Verifier AS 16-bit unsigned integer
         DECLARE PasswordArray AS array of 8-bit unsigned integers
      
         SET Verifier TO 0x0000
         SET PasswordArray TO (empty array of bytes)
         SET PasswordArray[0] TO Password.Length
         APPEND Password TO PasswordArray 
      
         FOR EACH PasswordByte IN PasswordArray IN REVERSE ORDER
            IF (Verifier BITWISE AND 0x4000) is 0x0000
               SET Intermediate1 TO 0
            ELSE
               SET Intermediate1 TO 1
            ENDIF
      
            SET Intermediate2 TO Verifier MULTIPLED BY 2
            SET most significant bit of Intermediate2 TO 0
      
            SET Intermediate3 TO Intermediate1 BITWISE OR Intermediate2
            SET Verifier TO Intermediate3 BITWISE XOR PasswordByte
         ENDFOR
      
         RETURN Verifier BITWISE XOR 0xCE4B
     END FUNCTION
    

For more information, see section 4.