# 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:
"torrecb yatterh eorss etaplc"
(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?

## 2 Answers

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

This is not a good passphrase generation method. It fails Kerckhoffs' principle, a system should be secure even if everything about it is known except the secret key. In this case you should assume the password generation method is known simply not it's specific output. Adding a simple transformation therefor doesn't help at all. Optionally adding one of a small set of possible transformation helps only a bit, by a multiple of the size of the considered set of transformations. Obviously if you start off with a strong pasaphrase, for instance one made up from 4 or 5 random words then adding such a transformation won't reduce it's security. It was secure to begin with and that didn't change it simply became harder to remember. The beauty of the xkcd method is that it produces strong memorable passwords. https://xkcd.com/936/ If you want to add something to it it needs to be added from a significant group. You may also want to add a personal ellement. You can add an original personal detail, which is essentially part of the secret or a non original element such as birthday or phone number. The non original parts could still be useful against untargeted attacks. Obviously you should be using a password manager with truely random difficult passwords. The password you remember should only be the one protecting the password manager or perhaps for a boot password with full disk encryption.
As for dictionary attacks, they currently do various common transformations on dictionary words. If your proposed method ever became common all crackers will quickly adopt it. I have seen attacks on large families of variations on dictionary words for example anything in edit distance 2 would cover your proposal.

• Thanks for the response. I am interested in the dictionary attacks that cover the variations on dictionary words if you could lead me to any examples. What exactly would an edit distance 2 consist of? The idea of course was to prevent a dictionary attack from working in the first place with a little rule easily remembered, if the changes to one word stem from another then how would the attack predict this? – JustWanderingWondering Jul 26 '17 at 23:27
• I have never seen an attack which changes several words together. I saw single word variations, coverring all small 1 or 2 chars changes/deletions/additions to a word. This attack won't scale well with many words. But as I said adding more rsndom words quickly adds security much faster then such a change as you propose. Your change adds complexity without adding security. – Meir Maor Jul 27 '17 at 4:08