From f7b54ccc11e6242d7f2eda840b4decf74250b15e Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Wed, 18 Nov 2026 14:07:56 +0100 Subject: [PATCH] Added prettynamehash convenience function --- RNS/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/RNS/__init__.py b/RNS/__init__.py index 723d3084..6c04f641 100755 --- a/RNS/__init__.py +++ b/RNS/__init__.py @@ -180,6 +180,14 @@ def prettyhexrep(data): hexrep = "<"+delimiter.join("{:02x}".format(c) for c in data)+">" return hexrep +__namehash_resolver = None +def prettynamehash(name_hash): + global __namehash_resolver + if not __namehash_resolver: + import RNS.Transport + __namehash_resolver = RNS.Transport.destination_type_name + return f"<{__namehash_resolver(name_hash)}>" + def prettycost(value): if value == None: return "n" elif not type(value) in (float, int): return "n"