def load(self, filename):
        """
        Load AEAD from a file.

        @param filename: File to read AEAD from
        @type filename: string
        """
        aead_f = open(filename, "rb")
        buf = aead_f.read(1024)
        if buf.startswith(YHSM_AEAD_CRLF_File_Marker):
            buf = YHSM_AEAD_File_Marker + buf[len(YHSM_AEAD_CRLF_File_Marker):]
        if buf.startswith(YHSM_AEAD_File_Marker):
            if buf[len(YHSM_AEAD_File_Marker)] == chr(1):
                # version 1 format
                fmt = (pyhsm.defines.YSM_AEAD_NONCE_SIZE) % "< I %is"
                self.key_handle, self.nonce = struct.unpack_from(fmt, buf, len(YHSM_AEAD_File_Marker) + 1)
                self.data = buf[len(YHSM_AEAD_File_Marker) + 1 + struct.calcsize(fmt):]
            else:
                raise pyhsm.exception.YHSM_Error('Unknown AEAD file format')
        else:
            # version 0 format, just AEAD data
            self.data = buf[:pyhsm.defines.YSM_MAX_KEY_SIZE + pyhsm.defines.YSM_BLOCK_SIZE]
        aead_f.close()
dataset/ETHPy150Open Yubico/python-pyhsm/pyhsm/aead_cmd.py/YHSM_GeneratedAEAD.load/swapped operands of `%`