From 77c9a1197e39b09fab727bd125d5766ad51d8b61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Wed, 21 Jun 2023 00:49:27 +0200 Subject: feat: SecurityLabels: Add get_label_hash() --- nbxmpp/modules/security_labels.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nbxmpp/modules/security_labels.py b/nbxmpp/modules/security_labels.py index adcfe0e..a07d7ea 100644 --- a/nbxmpp/modules/security_labels.py +++ b/nbxmpp/modules/security_labels.py @@ -18,6 +18,7 @@ from typing import Dict from dataclasses import dataclass +import hashlib from nbxmpp.protocol import Iq from nbxmpp.simplexml import Node @@ -150,6 +151,10 @@ class SecurityLabel: return cls(displaymarking=displaymarking, label=label) + def get_label_hash(self) -> str: + sha = hashlib.sha512() + sha.update(str(self.label).encode()) + return sha.hexdigest() @dataclass class Catalog: -- cgit v1.2.3