A self-destruct mechanism was a defensive system installed in some craft that allowed it to destroy itself in an attempt to protect information it was carrying. This was installed in Imperial probe droids, which allowed them to self-destruct if confronted after they accomplished their tasks.
In case their Star Destroyers were taken over by enemies, Imperial officers were taught three methods of self-destruct. The "automatic self-destruct" could only be set by combining the codes given to the three top officers on board. It gave the longest time to detonation, allowing more troops to reach the escape pods in time. However, if the ship had been thoroughly infiltrated by enemy fighters, there was no guarantee that the three top officers would all be alive to use their codes, and the extra time to detonation would also give the invaders a greater chance to escape. The "core engine method" required to have access to the ship's reactor, which could prove difficult during intraship combat. The "captain's-word method" consisted in having the captain signal for all personnel to abandon ship before sealing himself or herself in the bridge, providing cover for escape pods, and then piloting the vessel into the nearest planet, star, or singularity.