# Passphrases, Dictionary attacks and 'bit shift'

How much better would a passphrase be if you swapped the first letters of each word with a shift to the left:

"correct battery horse staple" becomes "borrect hattery sorse ctaple"

This would be simple to remember because you know all the words but how much harder would this be for an attacker?

Further, we could try this with the first and last letters of each word producing:
(This at least reduces the chances that swapping the first letters will still result in normal English words, like 'hattery' in the first example)

How much harder would this make it to crack, is it worth the extra effort to remember?
Do dictionary attacks consider things like this?

If you ask a computer to pick a sequence of four words out of 10 000 (with replacement) uniformly at random, there are about $2^{53}$ possibilities; an attacker can expect to guess $2^{52}$ of them before getting the right one. (For scale comparison, the Bitcoin network guesses and tries thousands of times more possible inputs than that to a hash every second.)

If you ask a computer to pick a sequence of four words out of 10 000, and one of the 24 permutations of four elements from the symmetric group $S_4$, then there are about $2^{53} * 24 \approx 2^{57}$ possibilities, although the number of distinct outcomes will dwindle once you account for alliteration.

If you ask a computer to pick a sequence of five words out of 10 000, there are $2^{66}$ possibilities, all distinct.

Which would you rather memorize: a permutation in $S_4$ causing words to be spelled differently, or another word? I'd take the other word—in fact, I'd take six other words and invent a mnemonic for myself, to raise the number of possibilities above $2^{128}$ so an attacker has no hope of ever trying anywhere near enough passwords to guess correctly even in an offline parallel attack.

But whatever you do, don't try to pick the words and permutations yourself in your head. Your mind is a terrible source of entropy.

• Also note that any mind-executable scheme is worthless the second it is documented (well in theory at least), like in the question, because now attackers can implement it and execute it much faster than the human... – SEJPM Jul 26 '17 at 20:31
• Thanks for the answer, it covers exactly what I wrote down and the math is really helpful. I forgot to make it more clear though whether doing something like this would actually make a dictionary attack useless. The purpose was a small rule that is easy to apply and remember but perhaps a dictionary attack would not be able to pick up on it. While your math shows that it wouldn't be beneficial if the attack expects the small change, if they didn't it would ruin the whole dictionary attack right? – JustWanderingWondering Jul 26 '17 at 23:22
• In cryptography, we design systems so that their security does not depend on keeping the methods secret. This is Kerckhoffs' principle. Maybe you would get a brief advantage over John the Ripper this way, until other people started using your method and someone taught JtR about it, or until the three-letter agency trying to decrypt your disk read your crypto.SE posts. Instead, we make the security rely on secrecy of a short key—and we worry about how hard it is to use. Extra word, or permutation of letters: which is easier to remember? – Squeamish Ossifrage Jul 26 '17 at 23:53
• Yeah I see what you mean. I was never intending that the permutation would outperform an extra word, I was wondering if maybe in a situation where you're restricted to a length, something like this that maybe only you know may just make it take that bit extra longer by at least making sure a dictionary attack would fail and then having to brute force all unchecked combinations. Thanks for an explanation of Kerckhoff's principle. – JustWanderingWondering Jul 27 '17 at 0:11
• What if instead of just shifting the first letters from the other words in the phrase, you used letters from another random word (I'm sure just appending that word would be better but say we can't). – JustWanderingWondering Jul 27 '17 at 0:58