From 534492fe4557467a4c30e1396e179c9d6d9d2698 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Wed, 11 Mar 2020 01:48:04 +0100 Subject: [PATCH] Simplify fp_from_ik method, remove codec import MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reuse changes from python-omemo, explicitly the following PR under CC0: https://github.com/Syndace/python-omemo/pull/28 Signed-off-by: Maxime “pep” Buquet --- slixmpp_omemo/__init__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/slixmpp_omemo/__init__.py b/slixmpp_omemo/__init__.py index 0c62e1d..100a72f 100644 --- a/slixmpp_omemo/__init__.py +++ b/slixmpp_omemo/__init__.py @@ -16,7 +16,6 @@ from typing import Any, Dict, List, Optional, Set, Tuple, Union import os import json import base64 -import codecs import asyncio from slixmpp.plugins.xep_0060.stanza import Items, EventItems from slixmpp.plugins.xep_0004 import Form @@ -83,7 +82,7 @@ def _load_device_id(data_dir: str) -> int: def fp_from_ik(identity_key: bytes) -> str: """Convert identityKey to a string representation (fingerprint)""" - return codecs.getencoder("hex")(identity_key)[0].decode("US-ASCII").upper() + return ":".join("{:02X}".format(octet) for octet in identity_key) def _parse_bundle(backend: Backend, bundle: Bundle) -> ExtendedPublicBundle: