SecureKeys stores nothing: it recalculates the same password from your passphrase every time. This page describes exactly how, so that you can always get your passwords back, with or without the app.
| Input | Values |
|---|---|
| Passphrase | Any text. Ordinary spaces are ignored and capitals count as lowercase, so Correct Horse and correcthorse give the same password. Which lowercase letter a capital becomes depends on the phone's language in a few cases. |
| Length | 5 to 25 characters in the app. |
| Mixed case | On or off. |
| Special characters | On or off. |
| Numbers | On or off. |
| Phone language | Only matters for Turkish, Azerbaijani and Lithuanian, and only for some capitals. |
i from 0 to length − 1:
i, in decimal, to the cleaned phrase.i characters: move the first i characters to the end. If the text is shorter than i, first double it (append it to itself) until it is at least i characters long: 3 characters at i = 7 become 12, not 9.p = i + 1, checking in this order: digits if Numbers is on and p is a multiple of 3; capitals if Mixed case is on and p is a multiple of 4; symbols if Special is on and p is a multiple of 5; otherwise lowercase letters.pool[seed mod pool length].a), find the remainder after dividing it by the length, and rotate the whole password left by that many characters.The pools, exactly as the app uses them (the symbols pool really does contain - twice):
lowercase abcdefghijklmnopqrstuvwxyz
capitals ABCDEFGHIJKLMNOPQRSTUVWXYZ
digits 1234567890
symbols ()-.?[]_~!#$^*-+=|{}
The 2014 app (version 3.0) and SecureKeys 4.0.2 onwards lowercase the passphrase using the phone's language. Almost all languages give the same result. These differ; apply the rules below, and Unicode's default rules to everything else:
| Phone language | What changes |
|---|---|
| Turkish, Azerbaijani |
|
| Lithuanian |
|
“Followed by” looks at the combining marks after the letter, skipping any whose Unicode canonical combining class is neither 0 nor 230 (a dot below, for example). For Turkish and Azerbaijani, the first mark not skipped must be U+0307. For Lithuanian, an “accent above” means the first character not skipped has class 230.
To rebuild such a password, add --language=tr, --language=az or --language=lt to the reference program, as the last argument.
Versions 4.0 and 4.0.1 ignored the phone's language. For a password made with one of them, leave the option out. On a Turkish, Azerbaijani or Lithuanian phone, updating to 4.0.2 changes the password for passphrases with the capitals above; the reference program without the option still gives the old one.
Passphrase correct horse, length 12, with mixed case, special characters and numbers, gives D3~o5sl3Y!7i.
A short Python 3 program, using only the standard library, that follows the steps above. It reproduces all 13,992 test vectors, which were captured from the original SecureKeys library. None of them covers the Lithuanian rules or I followed by a combining dot: for those, the program follows the description above.
python3 securekeys.py "correct horse" 12 --mixed-case --special --numbers
python3 securekeys.py --check golden_extended.tsv
python3 securekeys.py --check golden_locale_tr.tsv --language=tr
| File | What it is |
|---|---|
| securekeys.py | Reference implementation (MIT licence) |
| golden.tsv | 192 vectors: 6 phrases, lengths 5, 8, 16 and 25, every option combination |
| golden_extended.tsv | 9,000 vectors: 45 phrases (including accents, emoji and other scripts), lengths 1 to 25, every option combination |
| golden_locale_en.tsv | 1,600 vectors: 8 phrases with dotted and dotless I on an English phone, lengths 1 to 25, every option combination |
| golden_locale_tr.tsv | The same 1,600 inputs on a Turkish phone (check with --language=tr) |
| golden_locale_az.tsv | The same 1,600 inputs on an Azerbaijani phone (check with --language=az) |
Each line is tab-separated: passphrase, length, mixed case, special, numbers, expected password. In passphrases, a tab, a newline and a backslash are written as \t, \n and \\.
?. The reference program does the same. This only matters for passphrases with emoji or other rare characters.