You may not be able to reduce the time required to decrypt the archive, but assuming that the password is not completely random (as it may be), you can get the correct password even faster if you order letters while reducing the likelihood of use .
For example, in the Linux Journal, a column of script analyzed several large texts to determine that e, t, a, o, n, i, s, r, h, and d are the most common letters in these texts (and, presumably, this is close to English in general). So, changing the second line: Alphabets = "ETAONIBSRHDCFGJKLMPQUVWXYZ" can cause your algorithm to reach a password with fewer iterations.
Edit: Second thoughts If the password, as indicated by someone, is "cat", the initial order will require 3 passes through the external loop, while the new version will require 11 passes, so in this case it will not solve it faster. Therefore, perhaps you need to optimize the list for the outer loop, trying to predict the most likely first letter.
source share