From d2c9b00b36faf8d38a2f0fb32f1464528f4e96bd Mon Sep 17 00:00:00 2001 From: jaseg Date: Mon, 12 Nov 2018 13:19:26 +0900 Subject: Pairing confirmation: ignore special chars and "and" --- hexnoise.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'hexnoise.py') 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 ])) -- cgit