diff options
author | Tomasz Kramkowski <tomasz@kramkow.ski> | 2023-03-15 19:57:23 +0000 |
---|---|---|
committer | Tomasz Kramkowski <tomasz@kramkow.ski> | 2023-03-24 20:25:01 +0000 |
commit | c2b2177ff358258a44edf895e05a7c9a982aab80 (patch) | |
tree | 48e237c8be84da9105bed1da721773eda407605f | |
parent | a74d1baf0c3b290497936179cba79709f50e9c71 (diff) | |
download | paste-c2b2177ff358258a44edf895e05a7c9a982aab80.tar.gz paste-c2b2177ff358258a44edf895e05a7c9a982aab80.tar.xz paste-c2b2177ff358258a44edf895e05a7c9a982aab80.zip |
Use blake2b instead of sha256 as the data hash
With a digest size of 32 so it takes up the same amount of space
-rw-r--r-- | paste/db.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/paste/db.py b/paste/db.py index f1071e8..6671a12 100644 --- a/paste/db.py +++ b/paste/db.py @@ -1,7 +1,7 @@ import sqlite3 from collections.abc import Iterator from contextlib import contextmanager -from hashlib import blake2b, sha256 +from hashlib import blake2b from itertools import count from typing import Optional, Union @@ -41,7 +41,7 @@ def _sha256_udf(b: Union[bytes, str]) -> bytes: def _data_hash_udf(b: Union[bytes, str]) -> bytes: if isinstance(b, str): b = b.encode() - return sha256(b).digest() + return blake2b(b, digest_size=32).digest() def get_version(conn: sqlite3.Connection) -> int: |