diff options
author | Philipp Hörist <philipp@hoerist.com> | 2023-06-21 01:49:27 +0300 |
---|---|---|
committer | Philipp Hörist <philipp@hoerist.com> | 2023-06-21 01:49:27 +0300 |
commit | 77c9a1197e39b09fab727bd125d5766ad51d8b61 (patch) | |
tree | e798eab9abc054ae0a35b40aba759d6392935121 | |
parent | 3d000af416021a22d962ec40f2ac6a0e9b6d8835 (diff) |
feat: SecurityLabels: Add get_label_hash()
-rw-r--r-- | nbxmpp/modules/security_labels.py | 5 |
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: |