Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/python-nbxmpp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Hörist <philipp@hoerist.com>2023-06-21 01:49:27 +0300
committerPhilipp Hörist <philipp@hoerist.com>2023-06-21 01:49:27 +0300
commit77c9a1197e39b09fab727bd125d5766ad51d8b61 (patch)
treee798eab9abc054ae0a35b40aba759d6392935121
parent3d000af416021a22d962ec40f2ac6a0e9b6d8835 (diff)
feat: SecurityLabels: Add get_label_hash()
-rw-r--r--nbxmpp/modules/security_labels.py5
1 files changed, 5 insertions, 0 deletions
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: