Using a hardware-based encryption on a USB flash drive will inherently protect against the automatic execution of malicious software when inserted into a computer system.
Hardware-based encryption protects the data stored on the USB flash drive through encryption, which requires a form of authentication to decrypt the data. However, it does not prevent the automatic execution of malicious software if the system to which the flash drive is connected is configured to automatically run software from USB drives. This is because the malicious software can be designed to execute before the user provides any authentication necessary for accessing the encrypted data.