Morning Musings

I'm not ready to wake up yet...

Hex to Mnemonics

| Comments

Hex values are the common representation for things like hashes, fingerprints, and uuids. They are great for machines, but clumsy for humans. In this post, you will find two scripts used to convert a hex string to english words. This is useful for memorization or sharing by voice.

The first script comes straight from the Electrum Bitcoin wallet source code. I heard about this idea here. It is used to store the random seed that unlocks a deterministic Bitcoin wallet. Of course, it works nicely for any hex string as well.

(mnemonic.py) download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2011 thomasv@gitorious
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

# List of words from:
# http://en.wiktionary.org/wiki/Wiktionary:Frequency_lists/Contemporary_poetry

words = [
"like", "just", "love", "know", "never", "want", "time", "out", "there", "make", "look", "eye",
"down", "only", "think", "heart", "back", "then", "into", "about", "more", "away", "still", "them",
"take", "thing", "even", "through", "long", "always", "world", "too", "friend", "tell", "try", "hand",
"thought", "over", "here", "other", "need", "smile", "again", "much", "cry", "been", "night", "ever",
"little", "said", "end", "some", "those", "around", "mind", "people", "girl", "leave", "dream", "left",
"turn", "myself", "give", "nothing", "really", "off", "before", "something", "find", "walk", "wish", "good",
"once", "place", "ask", "stop", "keep", "watch", "seem", "everything", "wait", "got", "yet", "made",
"remember", "start", "alone", "run", "hope", "maybe", "believe", "body", "hate", "after", "close", "talk",
"stand", "own", "each", "hurt", "help", "home", "god", "soul", "new", "many", "two", "inside",
"should", "true", "first", "fear", "mean", "better", "play", "another", "gone", "change", "use", "wonder",
"someone", "hair", "cold", "open", "best", "any", "behind", "happen", "water", "dark", "laugh", "stay",
"forever", "name", "work", "show", "sky", "break", "came", "deep", "door", "put", "black", "together",
"upon", "happy", "such", "great", "white", "matter", "fill", "past", "please", "burn", "cause", "enough",
"touch", "moment", "soon", "voice", "scream", "anything", "stare", "sound", "red", "everyone", "hide", "kiss",
"truth", "death", "beautiful", "mine", "blood", "broken", "very", "pass", "next", "forget", "tree", "wrong",
"air", "mother", "understand", "lip", "hit", "wall", "memory", "sleep", "free", "high", "realize", "school",
"might", "skin", "sweet", "perfect", "blue", "kill", "breath", "dance", "against", "fly", "between", "grow",
"strong", "under", "listen", "bring", "sometimes", "speak", "pull", "person", "become", "family", "begin", "ground",
"real", "small", "father", "sure", "feet", "rest", "young", "finally", "land", "across", "today", "different",
"guy", "line", "fire", "reason", "reach", "second", "slowly", "write", "eat", "smell", "mouth", "step",
"learn", "three", "floor", "promise", "breathe", "darkness", "push", "earth", "guess", "save", "song", "above",
"along", "both", "color", "house", "almost", "sorry", "anymore", "brother", "okay", "dear", "game", "fade",
"already", "apart", "warm", "beauty", "heard", "notice", "question", "shine", "began", "piece", "whole", "shadow",
"secret", "street", "within", "finger", "point", "morning", "whisper", "child", "moon", "green", "story", "glass",
"kid", "silence", "since", "soft", "yourself", "empty", "shall", "angel", "answer", "baby", "bright", "dad",
"path", "worry", "hour", "drop", "follow", "power", "war", "half", "flow", "heaven", "act", "chance",
"fact", "least", "tired", "children", "near", "quite", "afraid", "rise", "sea", "taste", "window", "cover",
"nice", "trust", "lot", "sad", "cool", "force", "peace", "return", "blind", "easy", "ready", "roll",
"rose", "drive", "held", "music", "beneath", "hang", "mom", "paint", "emotion", "quiet", "clear", "cloud",
"few", "pretty", "bird", "outside", "paper", "picture", "front", "rock", "simple", "anyone", "meant", "reality",
"road", "sense", "waste", "bit", "leaf", "thank", "happiness", "meet", "men", "smoke", "truly", "decide",
"self", "age", "book", "form", "alive", "carry", "escape", "damn", "instead", "able", "ice", "minute",
"throw", "catch", "leg", "ring", "course", "goodbye", "lead", "poem", "sick", "corner", "desire", "known",
"problem", "remind", "shoulder", "suppose", "toward", "wave", "drink", "jump", "woman", "pretend", "sister", "week",
"human", "joy", "crack", "grey", "pray", "surprise", "dry", "knee", "less", "search", "bleed", "caught",
"clean", "embrace", "future", "king", "son", "sorrow", "chest", "hug", "remain", "sat", "worth", "blow",
"daddy", "final", "parent", "tight", "also", "create", "lonely", "safe", "cross", "dress", "evil", "silent",
"bone", "fate", "perhaps", "anger", "class", "scar", "snow", "tiny", "tonight", "continue", "control", "dog",
"edge", "mirror", "month", "suddenly", "comfort", "given", "loud", "quickly", "gaze", "plan", "rush", "stone",
"town", "battle", "ignore", "spirit", "stood", "stupid", "yours", "brown", "build", "dust", "hey", "kept",
"pay", "phone", "twist", "although", "ball", "beyond", "hidden", "nose", "taken", "fail", "float", "pure",
"somehow", "wash", "wrap", "angry", "cheek", "creature", "forgotten", "heat", "rip", "single", "space", "special",
"weak", "whatever", "yell", "anyway", "blame", "job", "choose", "country", "curse", "drift", "echo", "figure",
"grew", "laughter", "neck", "suffer", "worse", "yeah", "disappear", "foot", "forward", "knife", "mess", "somewhere",
"stomach", "storm", "beg", "idea", "lift", "offer", "breeze", "field", "five", "often", "simply", "stuck",
"win", "allow", "confuse", "enjoy", "except", "flower", "seek", "strength", "calm", "grin", "gun", "heavy",
"hill", "large", "ocean", "shoe", "sigh", "straight", "summer", "tongue", "accept", "crazy", "everyday", "exist",
"grass", "mistake", "sent", "shut", "surround", "table", "ache", "brain", "destroy", "heal", "nature", "shout",
"sign", "stain", "choice", "doubt", "glance", "glow", "mountain", "queen", "stranger", "throat", "tomorrow", "city",
"either", "fish", "flame", "rather", "shape", "spin", "spread", "ash", "distance", "finish", "image", "imagine",
"important", "nobody", "shatter", "warmth", "became", "feed", "flesh", "funny", "lust", "shirt", "trouble", "yellow",
"attention", "bare", "bite", "money", "protect", "amaze", "appear", "born", "choke", "completely", "daughter", "fresh",
"friendship", "gentle", "probably", "six", "deserve", "expect", "grab", "middle", "nightmare", "river", "thousand", "weight",
"worst", "wound", "barely", "bottle", "cream", "regret", "relationship", "stick", "test", "crush", "endless", "fault",
"itself", "rule", "spill", "art", "circle", "join", "kick", "mask", "master", "passion", "quick", "raise",
"smooth", "unless", "wander", "actually", "broke", "chair", "deal", "favorite", "gift", "note", "number", "sweat",
"box", "chill", "clothes", "lady", "mark", "park", "poor", "sadness", "tie", "animal", "belong", "brush",
"consume", "dawn", "forest", "innocent", "pen", "pride", "stream", "thick", "clay", "complete", "count", "draw",
"faith", "press", "silver", "struggle", "surface", "taught", "teach", "wet", "bless", "chase", "climb", "enter",
"letter", "melt", "metal", "movie", "stretch", "swing", "vision", "wife", "beside", "crash", "forgot", "guide",
"haunt", "joke", "knock", "plant", "pour", "prove", "reveal", "steal", "stuff", "trip", "wood", "wrist",
"bother", "bottom", "crawl", "crowd", "fix", "forgive", "frown", "grace", "loose", "lucky", "party", "release",
"surely", "survive", "teacher", "gently", "grip", "speed", "suicide", "travel", "treat", "vein", "written", "cage",
"chain", "conversation", "date", "enemy", "however", "interest", "million", "page", "pink", "proud", "sway", "themselves",
"winter", "church", "cruel", "cup", "demon", "experience", "freedom", "pair", "pop", "purpose", "respect", "shoot",
"softly", "state", "strange", "bar", "birth", "curl", "dirt", "excuse", "lord", "lovely", "monster", "order",
"pack", "pants", "pool", "scene", "seven", "shame", "slide", "ugly", "among", "blade", "blonde", "closet",
"creek", "deny", "drug", "eternity", "gain", "grade", "handle", "key", "linger", "pale", "prepare", "swallow",
"swim", "tremble", "wheel", "won", "cast", "cigarette", "claim", "college", "direction", "dirty", "gather", "ghost",
"hundred", "loss", "lung", "orange", "present", "swear", "swirl", "twice", "wild", "bitter", "blanket", "doctor",
"everywhere", "flash", "grown", "knowledge", "numb", "pressure", "radio", "repeat", "ruin", "spend", "unknown", "buy",
"clock", "devil", "early", "false", "fantasy", "pound", "precious", "refuse", "sheet", "teeth", "welcome", "add",
"ahead", "block", "bury", "caress", "content", "depth", "despite", "distant", "marry", "purple", "threw", "whenever",
"bomb", "dull", "easily", "grasp", "hospital", "innocence", "normal", "receive", "reply", "rhyme", "shade", "someday",
"sword", "toe", "visit", "asleep", "bought", "center", "consider", "flat", "hero", "history", "ink", "insane",
"muscle", "mystery", "pocket", "reflection", "shove", "silently", "smart", "soldier", "spot", "stress", "train", "type",
"view", "whether", "bus", "energy", "explain", "holy", "hunger", "inch", "magic", "mix", "noise", "nowhere",
"prayer", "presence", "shock", "snap", "spider", "study", "thunder", "trail", "admit", "agree", "bag", "bang",
"bound", "butterfly", "cute", "exactly", "explode", "familiar", "fold", "further", "pierce", "reflect", "scent", "selfish",
"sharp", "sink", "spring", "stumble", "universe", "weep", "women", "wonderful", "action", "ancient", "attempt", "avoid",
"birthday", "branch", "chocolate", "core", "depress", "drunk", "especially", "focus", "fruit", "honest", "match", "palm",
"perfectly", "pillow", "pity", "poison", "roar", "shift", "slightly", "thump", "truck", "tune", "twenty", "unable",
"wipe", "wrote", "coat", "constant", "dinner", "drove", "egg", "eternal", "flight", "flood", "frame", "freak",
"gasp", "glad", "hollow", "motion", "peer", "plastic", "root", "screen", "season", "sting", "strike", "team",
"unlike", "victim", "volume", "warn", "weird", "attack", "await", "awake", "built", "charm", "crave", "despair",
"fought", "grant", "grief", "horse", "limit", "message", "ripple", "sanity", "scatter", "serve", "split", "string",
"trick", "annoy", "blur", "boat", "brave", "clearly", "cling", "connect", "fist", "forth", "imagination", "iron",
"jock", "judge", "lesson", "milk", "misery", "nail", "naked", "ourselves", "poet", "possible", "princess", "sail",
"size", "snake", "society", "stroke", "torture", "toss", "trace", "wise", "bloom", "bullet", "cell", "check",
"cost", "darling", "during", "footstep", "fragile", "hallway", "hardly", "horizon", "invisible", "journey", "midnight", "mud",
"nod", "pause", "relax", "shiver", "sudden", "value", "youth", "abuse", "admire", "blink", "breast", "bruise",
"constantly", "couple", "creep", "curve", "difference", "dumb", "emptiness", "gotta", "honor", "plain", "planet", "recall",
"rub", "ship", "slam", "soar", "somebody", "tightly", "weather", "adore", "approach", "bond", "bread", "burst",
"candle", "coffee", "cousin", "crime", "desert", "flutter", "frozen", "grand", "heel", "hello", "language", "level",
"movement", "pleasure", "powerful", "random", "rhythm", "settle", "silly", "slap", "sort", "spoken", "steel", "threaten",
"tumble", "upset", "aside", "awkward", "bee", "blank", "board", "button", "card", "carefully", "complain", "crap",
"deeply", "discover", "drag", "dread", "effort", "entire", "fairy", "giant", "gotten", "greet", "illusion", "jeans",
"leap", "liquid", "march", "mend", "nervous", "nine", "replace", "rope", "spine", "stole", "terror", "accident",
"apple", "balance", "boom", "childhood", "collect", "demand", "depression", "eventually", "faint", "glare", "goal", "group",
"honey", "kitchen", "laid", "limb", "machine", "mere", "mold", "murder", "nerve", "painful", "poetry", "prince",
"rabbit", "shelter", "shore", "shower", "soothe", "stair", "steady", "sunlight", "tangle", "tease", "treasure", "uncle",
"begun", "bliss", "canvas", "cheer", "claw", "clutch", "commit", "crimson", "crystal", "delight", "doll", "existence",
"express", "fog", "football", "gay", "goose", "guard", "hatred", "illuminate", "mass", "math", "mourn", "rich",
"rough", "skip", "stir", "student", "style", "support", "thorn", "tough", "yard", "yearn", "yesterday", "advice",
"appreciate", "autumn", "bank", "beam", "bowl", "capture", "carve", "collapse", "confusion", "creation", "dove", "feather",
"girlfriend", "glory", "government", "harsh", "hop", "inner", "loser", "moonlight", "neighbor", "neither", "peach", "pig",
"praise", "screw", "shield", "shimmer", "sneak", "stab", "subject", "throughout", "thrown", "tower", "twirl", "wow",
"army", "arrive", "bathroom", "bump", "cease", "cookie", "couch", "courage", "dim", "guilt", "howl", "hum",
"husband", "insult", "led", "lunch", "mock", "mostly", "natural", "nearly", "needle", "nerd", "peaceful", "perfection",
"pile", "price", "remove", "roam", "sanctuary", "serious", "shiny", "shook", "sob", "stolen", "tap", "vain",
"void", "warrior", "wrinkle", "affection", "apologize", "blossom", "bounce", "bridge", "cheap", "crumble", "decision", "descend",
"desperately", "dig", "dot", "flip", "frighten", "heartbeat", "huge", "lazy", "lick", "odd", "opinion", "process",
"puzzle", "quietly", "retreat", "score", "sentence", "separate", "situation", "skill", "soak", "square", "stray", "taint",
"task", "tide", "underneath", "veil", "whistle", "anywhere", "bedroom", "bid", "bloody", "burden", "careful", "compare",
"concern", "curtain", "decay", "defeat", "describe", "double", "dreamer", "driver", "dwell", "evening", "flare", "flicker",
"grandma", "guitar", "harm", "horrible", "hungry", "indeed", "lace", "melody", "monkey", "nation", "object", "obviously",
"rainbow", "salt", "scratch", "shown", "shy", "stage", "stun", "third", "tickle", "useless", "weakness", "worship",
"worthless", "afternoon", "beard", "boyfriend", "bubble", "busy", "certain", "chin", "concrete", "desk", "diamond", "doom",
"drawn", "due", "felicity", "freeze", "frost", "garden", "glide", "harmony", "hopefully", "hunt", "jealous", "lightning",
"mama", "mercy", "peel", "physical", "position", "pulse", "punch", "quit", "rant", "respond", "salty", "sane",
"satisfy", "savior", "sheep", "slept", "social", "sport", "tuck", "utter", "valley", "wolf", "aim", "alas",
"alter", "arrow", "awaken", "beaten", "belief", "brand", "ceiling", "cheese", "clue", "confidence", "connection", "daily",
"disguise", "eager", "erase", "essence", "everytime", "expression", "fan", "flag", "flirt", "foul", "fur", "giggle",
"glorious", "ignorance", "law", "lifeless", "measure", "mighty", "muse", "north", "opposite", "paradise", "patience", "patient",
"pencil", "petal", "plate", "ponder", "possibly", "practice", "slice", "spell", "stock", "strife", "strip", "suffocate",
"suit", "tender", "tool", "trade", "velvet", "verse", "waist", "witch", "aunt", "bench", "bold", "cap",
"certainly", "click", "companion", "creator", "dart", "delicate", "determine", "dish", "dragon", "drama", "drum", "dude",
"everybody", "feast", "forehead", "former", "fright", "fully", "gas", "hook", "hurl", "invite", "juice", "manage",
"moral", "possess", "raw", "rebel", "royal", "scale", "scary", "several", "slight", "stubborn", "swell", "talent",
"tea", "terrible", "thread", "torment", "trickle", "usually", "vast", "violence", "weave", "acid", "agony", "ashamed",
"awe", "belly", "blend", "blush", "character", "cheat", "common", "company", "coward", "creak", "danger", "deadly",
"defense", "define", "depend", "desperate", "destination", "dew", "duck", "dusty", "embarrass", "engine", "example", "explore",
"foe", "freely", "frustrate", "generation", "glove", "guilty", "health", "hurry", "idiot", "impossible", "inhale", "jaw",
"kingdom", "mention", "mist", "moan", "mumble", "mutter", "observe", "ode", "pathetic", "pattern", "pie", "prefer",
"puff", "rape", "rare", "revenge", "rude", "scrape", "spiral", "squeeze", "strain", "sunset", "suspend", "sympathy",
"thigh", "throne", "total", "unseen", "weapon", "weary"
]

N = len(words)

# Note about US patent no 5892470:
# Here each word does not represent a given digit.
# Instead, the digit represented by a word is variable, it depends on the previous word.

def encode(message):
    out = []
    for i in range(len(message) / 8):
        word = message[8 * i:8 * i + 8]
        x = int(word, 16)
        w1 = (x % N)
        w2 = ((x / N) + w1) % N
        w3 = ((x / N / N) + w2) % N
        out += [ words[w1], words[w2], words[w3] ]
    return out

def decode(wlist):
    out = ''
    for i in range(len(wlist) / 3):
        word1, word2, word3 = wlist[3 * i:3 * i + 3]
        w1 = words.index(word1)
        w2 = (words.index(word2)) % N
        w3 = (words.index(word3)) % N
        x = w1 + N * ((w2 - w1) % N) + N * N * ((w3 - w2) % N)
        out += '%08x' % x
    return out


if __name__ == '__main__':
    import sys
    if len(sys.argv) == 1:
        print 'I need arguments: a hex string to encode, or a list of words to decode'
    elif len(sys.argv) == 2:
        print ' '.join(encode(sys.argv[1]))
    else:
        print decode(sys.argv[1:])

The script supports encoding and decoding. Run it like this:

./mnemonic.py a1b2c3d4
shield doom swallow

./mnemonic.py shield doom swallow
a1b2c3d4

The second script generates words using the official PGP Wordlist and all of its rules. This is commonly used to communicate a PGP key fingerprint over a voice channel, and is set up such that even bytes are two syllable words, while odd bytes are three syllable words. Again, this can be used for more than just PGP keys.

(pgp-words.py) download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#!/usr/bin/env python

# pgp-words.py
# Copyright (C) 2015 Joe Ruether jrruethe@gmail.com
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import sys
conv = {
'00': ['aardvark', 'adroitness'], '01': ['absurd', 'adviser'],
'02': ['accrue', 'aftermath'], '03': ['acme', 'aggregate'],
'04': ['adrift', 'alkali'], '05': ['adult', 'almighty'],
'06': ['afflict', 'amulet'], '07': ['ahead', 'amusement'],
'08': ['aimless', 'antenna'], '09': ['algol', 'applicant'],
'0a': ['allow', 'apollo'], '0b': ['alone', 'armistice'],
'0c': ['ammo', 'article'], '0d': ['ancient', 'asteroid'],
'0e': ['apple', 'atlantic'], '0f': ['artist', 'atmosphere'],
'10': ['assume', 'autopsy'], '11': ['athens', 'babylon'],
'12': ['atlas', 'backwater'], '13': ['aztec', 'barbecue'],
'14': ['baboon', 'belowground'], '15': ['backfield', 'bifocals'],
'16': ['backward', 'bodyguard'], '17': ['banjo', 'bookseller'],
'18': ['beaming', 'borderline'], '19': ['bedlamp', 'bottomless'],
'1a': ['beehive', 'bradbury'], '1b': ['beeswax', 'bravado'],
'1c': ['befriend', 'brazilian'], '1d': ['belfast', 'breakaway'],
'1e': ['berserk', 'burlington'], '1f': ['billiard', 'businessman'],
'20': ['bison', 'butterfat'], '21': ['blackjack', 'camelot'],
'22': ['blockade', 'candidate'], '23': ['blowtorch', 'cannonball'],
'24': ['bluebird', 'capricorn'], '25': ['bombast', 'caravan'],
'26': ['bookshelf', 'caretaker'], '27': ['brackish', 'celebrate'],
'28': ['breadline', 'cellulose'], '29': ['breakup', 'certify'],
'2a': ['brickyard', 'chambermaid'], '2b': ['briefcase', 'cherokee'],
'2c': ['burbank', 'chicago'], '2d': ['button', 'clergyman'],
'2e': ['buzzard', 'coherence'], '2f': ['cement', 'combustion'],
'30': ['chairlift', 'commando'], '31': ['chatter', 'company'],
'32': ['checkup', 'component'], '33': ['chisel', 'concurrent'],
'34': ['choking', 'confidence'], '35': ['chopper', 'conformist'],
'36': ['christmas', 'congregate'], '37': ['clamshell', 'consensus'],
'38': ['classic', 'consulting'], '39': ['classroom', 'corporate'],
'3a': ['cleanup', 'corrosion'], '3b': ['clockwork', 'councilman'],
'3c': ['cobra', 'crossover'], '3d': ['commence', 'crucifix'],
'3e': ['concert', 'cumbersome'], '3f': ['cowbell', 'customer'],
'40': ['crackdown', 'dakota'], '41': ['cranky', 'decadence'],
'42': ['crowfoot', 'december'], '43': ['crucial', 'decimal'],
'44': ['crumpled', 'designing'], '45': ['crusade', 'detector'],
'46': ['cubic', 'detergent'], '47': ['dashboard', 'determine'],
'48': ['deadbolt', 'dictator'], '49': ['deckhand', 'dinosaur'],
'4a': ['dogsled', 'direction'], '4b': ['dragnet', 'disable'],
'4c': ['drainage', 'disbelief'], '4d': ['dreadful', 'disruptive'],
'4e': ['drifter', 'distortion'], '4f': ['dropper', 'document'],
'50': ['drumbeat', 'embezzle'], '51': ['drunken', 'enchanting'],
'52': ['dupont', 'enrollment'], '53': ['dwelling', 'enterprise'],
'54': ['eating', 'equation'], '55': ['edict', 'equipment'],
'56': ['egghead', 'escapade'], '57': ['eightball', 'eskimo'],
'58': ['endorse', 'everyday'], '59': ['endow', 'examine'],
'5a': ['enlist', 'existence'], '5b': ['erase', 'exodus'],
'5c': ['escape', 'fascinate'], '5d': ['exceed', 'filament'],
'5e': ['eyeglass', 'finicky'], '5f': ['eyetooth', 'forever'],
'60': ['facial', 'fortitude'], '61': ['fallout', 'frequency'],
'62': ['flagpole', 'gadgetry'], '63': ['flatfoot', 'galveston'],
'64': ['flytrap', 'getaway'], '65': ['fracture', 'glossary'],
'66': ['framework', 'gossamer'], '67': ['freedom', 'graduate'],
'68': ['frighten', 'gravity'], '69': ['gazelle', 'guitarist'],
'6a': ['geiger', 'hamburger'], '6b': ['glitter', 'hamilton'],
'6c': ['glucose', 'handiwork'], '6d': ['goggles', 'hazardous'],
'6e': ['goldfish', 'headwaters'], '6f': ['gremlin', 'hemisphere'],
'70': ['guidance', 'hesitate'], '71': ['hamlet', 'hideaway'],
'72': ['highchair', 'holiness'], '73': ['hockey', 'hurricane'],
'74': ['indoors', 'hydraulic'], '75': ['indulge', 'impartial'],
'76': ['inverse', 'impetus'], '77': ['involve', 'inception'],
'78': ['island', 'indigo'], '79': ['jawbone', 'inertia'],
'7a': ['keyboard', 'infancy'], '7b': ['kickoff', 'inferno'],
'7c': ['kiwi', 'informant'], '7d': ['klaxon', 'insincere'],
'7e': ['locale', 'insurgent'], '7f': ['lockup', 'integrate'],
'80': ['merit', 'intention'], '81': ['minnow', 'inventive'],
'82': ['miser', 'istanbul'], '83': ['mohawk', 'jamaica'],
'84': ['mural', 'jupiter'], '85': ['music', 'leprosy'],
'86': ['necklace', 'letterhead'], '87': ['neptune', 'liberty'],
'88': ['newborn', 'maritime'], '89': ['nightbird', 'matchmaker'],
'8a': ['oakland', 'maverick'], '8b': ['obtuse', 'medusa'],
'8c': ['offload', 'megaton'], '8d': ['optic', 'microscope'],
'8e': ['orca', 'microwave'], '8f': ['payday', 'midsummer'],
'90': ['peachy', 'millionaire'], '91': ['pheasant', 'miracle'],
'92': ['physique', 'misnomer'], '93': ['playhouse', 'molasses'],
'94': ['pluto', 'molecule'], '95': ['preclude', 'montana'],
'96': ['prefer', 'monument'], '97': ['preshrunk', 'mosquito'],
'98': ['printer', 'narrative'], '99': ['prowler', 'nebula'],
'9a': ['pupil', 'newsletter'], '9b': ['puppy', 'norwegian'],
'9c': ['python', 'october'], '9d': ['quadrant', 'ohio'],
'9e': ['quiver', 'onlooker'], '9f': ['quota', 'opulent'],
'a0': ['ragtime', 'orlando'], 'a1': ['ratchet', 'outfielder'],
'a2': ['rebirth', 'pacific'], 'a3': ['reform', 'pandemic'],
'a4': ['regain', 'pandora'], 'a5': ['reindeer', 'paperweight'],
'a6': ['rematch', 'paragon'], 'a7': ['repay', 'paragraph'],
'a8': ['retouch', 'paramount'], 'a9': ['revenge', 'passenger'],
'aa': ['reward', 'pedigree'], 'ab': ['rhythm', 'pegasus'],
'ac': ['ribcage', 'penetrate'], 'ad': ['ringbolt', 'perceptive'],
'ae': ['robust', 'performance'], 'af': ['rocker', 'pharmacy'],
'b0': ['ruffled', 'phonetic'], 'b1': ['sailboat', 'photograph'],
'b2': ['sawdust', 'pioneer'], 'b3': ['scallion', 'pocketful'],
'b4': ['scenic', 'politeness'], 'b5': ['scorecard', 'positive'],
'b6': ['scotland', 'potato'], 'b7': ['seabird', 'processor'],
'b8': ['select', 'provincial'], 'b9': ['sentence', 'proximate'],
'ba': ['shadow', 'puberty'], 'bb': ['shamrock', 'publisher'],
'bc': ['showgirl', 'pyramid'], 'bd': ['skullcap', 'quantity'],
'be': ['skydive', 'racketeer'], 'bf': ['slingshot', 'rebellion'],
'c0': ['slowdown', 'recipe'], 'c1': ['snapline', 'recover'],
'c2': ['snapshot', 'repellent'], 'c3': ['snowcap', 'replica'],
'c4': ['snowslide', 'reproduce'], 'c5': ['solo', 'resistor'],
'c6': ['southward', 'responsive'], 'c7': ['soybean', 'retraction'],
'c8': ['spaniel', 'retrieval'], 'c9': ['spearhead', 'retrospect'],
'ca': ['spellbind', 'revenue'], 'cb': ['spheroid', 'revival'],
'cc': ['spigot', 'revolver'], 'cd': ['spindle', 'sandalwood'],
'ce': ['spyglass', 'sardonic'], 'cf': ['stagehand', 'saturday'],
'd0': ['stagnate', 'savagery'], 'd1': ['stairway', 'scavenger'],
'd2': ['standard', 'sensation'], 'd3': ['stapler', 'sociable'],
'd4': ['steamship', 'souvenir'], 'd5': ['sterling', 'specialist'],
'd6': ['stockman', 'speculate'], 'd7': ['stopwatch', 'stethoscope'],
'd8': ['stormy', 'stupendous'], 'd9': ['sugar', 'supportive'],
'da': ['surmount', 'surrender'], 'db': ['suspense', 'suspicious'],
'dc': ['sweatband', 'sympathy'], 'dd': ['swelter', 'tambourine'],
'de': ['tactics', 'telephone'], 'df': ['talon', 'therapist'],
'e0': ['tapeworm', 'tobacco'], 'e1': ['tempest', 'tolerance'],
'e2': ['tiger', 'tomorrow'], 'e3': ['tissue', 'torpedo'],
'e4': ['tonic', 'tradition'], 'e5': ['topmost', 'travesty'],
'e6': ['tracker', 'trombonist'], 'e7': ['transit', 'truncated'],
'e8': ['trauma', 'typewriter'], 'e9': ['treadmill', 'ultimate'],
'ea': ['trojan', 'undaunted'], 'eb': ['trouble', 'underfoot'],
'ec': ['tumor', 'unicorn'], 'ed': ['tunnel', 'unify'],
'ee': ['tycoon', 'universe'], 'ef': ['uncut', 'unravel'],
'f0': ['unearth', 'upcoming'], 'f1': ['unwind', 'vacancy'],
'f2': ['uproot', 'vagabond'], 'f3': ['upset', 'vertigo'],
'f4': ['upshot', 'virginia'], 'f5': ['vapor', 'visitor'],
'f6': ['village', 'vocalist'], 'f7': ['virus', 'voyager'],
'f8': ['vulcan', 'warranty'], 'f9': ['waffle', 'waterloo'],
'fa': ['wallet', 'whimsical'], 'fb': ['watchword', 'wichita'],
'fc': ['wayside', 'wilmington'], 'fd': ['willow', 'wyoming'],
'fe': ['woodlark', 'yesteryear'], 'ff': ['zulu', 'yucatan'],
}

fingerprint = sys.argv[1].lower().replace(' ', '')
segments = [fingerprint[i:i+2] for i in range(0, len(fingerprint), 2)]
for c,i in enumerate(segments):
  print conv[i][c%2]

This script only supports encoding. Typically, this method is used for verification purposes, as opposed to transferring data or memorization, as PGP key fingerprints are designed to be public. Both sides would generate the words from the fingerprint, then a voice channel is used to verify that the words match.

Run it like this:

./pgp-words.py a1b2c3d4
ratchet
pioneer
snowcap
souvenir

Comments