diff options
author | jaseg <git@jaseg.net> | 2018-11-12 13:19:26 +0900 |
---|---|---|
committer | jaseg <git@jaseg.net> | 2018-11-12 13:19:26 +0900 |
commit | d2c9b00b36faf8d38a2f0fb32f1464528f4e96bd (patch) | |
tree | bc3d87ccb7d3be0880f00464129edbf62f1849d8 /hexnoise.py | |
parent | 70d8dcb6f6eaffd0c5717ffdca24ebc25a3b8de2 (diff) | |
download | secure-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-x | hexnoise.py | 4 |
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 ])) |