From afe64aaadaad4202f9f119feb1768d8ed6d81475 Mon Sep 17 00:00:00 2001 From: JJJHolscher Date: Tue, 10 Oct 2023 19:10:09 +0200 Subject: [PATCH] hash string function --- src/string.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 src/string.py diff --git a/src/string.py b/src/string.py new file mode 100644 index 0000000..8c73a78 --- /dev/null +++ b/src/string.py @@ -0,0 +1,8 @@ +#! /usr/bin/env python3 +# vim:fenc=utf-8 +from hashlib import sha256 + +def hash_string(string: str) -> str: + return sha256(string.encode('utf-8'), + usedforsecurity=False).hexdigest() +