summaryrefslogtreecommitdiff
path: root/hexnoise.py
diff options
context:
space:
mode:
authorjaseg <git@jaseg.net>2018-11-12 13:19:26 +0900
committerjaseg <git@jaseg.net>2018-11-12 13:19:26 +0900
commitd2c9b00b36faf8d38a2f0fb32f1464528f4e96bd (patch)
treebc3d87ccb7d3be0880f00464129edbf62f1849d8 /hexnoise.py
parent70d8dcb6f6eaffd0c5717ffdca24ebc25a3b8de2 (diff)
downloadsecure-hid-d2c9b00b36faf8d38a2f0fb32f1464528f4e96bd.tar.gz
secure-hid-d2c9b00b36faf8d38a2f0fb32f1464528f4e96bd.tar.bz2
secure-hid-d2c9b00b36faf8d38a2f0fb32f1464528f4e96bd.zip
Pairing confirmation: ignore special chars and "and"
Diffstat (limited to 'hexnoise.py')
-rwxr-xr-xhexnoise.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/hexnoise.py b/hexnoise.py
index d5bce09..6b0aad8 100755
--- a/hexnoise.py
+++ b/hexnoise.py
@@ -121,7 +121,9 @@ if __name__ == '__main__':
from nouns import NOUNS
from adjectives import ADJECTIVES
def map_bytes_to_incantation(data):
- return " ".join(f'{ADJECTIVES[a]:>16} {NOUNS[b]:<16}' for a, b in zip(data[0::2], data[1::2]))
+ elems = [ f'{ADJECTIVES[a]} {NOUNS[b]}' for a, b in zip(data[0::2], data[1::2]) ]
+ nfirst = ", ".join(elems[:-1])
+ return f'{nfirst} and {elems[-1]}'
print('Handshake channel binding incantation:')
hhash = proto.get_handshake_hash()
print(' ' + map_bytes_to_incantation(hhash[:8 ]))