diff --git a/copyparty/ico.py b/copyparty/ico.py index f403e4b5..721f17a1 100644 --- a/copyparty/ico.py +++ b/copyparty/ico.py @@ -15,7 +15,7 @@ class Ico(object): def get(self, ext: str, as_thumb: bool) -> tuple[str, bytes]: """placeholder to make thumbnails not break""" - zb = hashlib.md5(ext.encode("utf-8")).digest()[:2] + zb = hashlib.sha1(ext.encode("utf-8")).digest()[2:4] if PY2: zb = [ord(x) for x in zb] diff --git a/scripts/make-pypi-release.sh b/scripts/make-pypi-release.sh index 7e723d4b..24876246 100755 --- a/scripts/make-pypi-release.sh +++ b/scripts/make-pypi-release.sh @@ -14,10 +14,6 @@ gtar=$(command -v gtar || command -v gnutar) || true realpath() { grealpath "$@"; } } -which md5sum 2>/dev/null >/dev/null && - md5sum=md5sum || - md5sum="md5 -r" - mode="$1" [ -z "$mode" ] && diff --git a/scripts/make-sfx.sh b/scripts/make-sfx.sh index aa47858f..4de04727 100755 --- a/scripts/make-sfx.sh +++ b/scripts/make-sfx.sh @@ -402,8 +402,8 @@ sed -r 's/(.*)\.(.*)/\2 \1/' | LC_ALL=C sort | sed -r 's/([^ ]*) (.*)/\2.\1/' | grep -vE '/list1?$' > list1 for n in {1..50}; do - (grep -vE '\.(gz|br)$' list1; grep -E '\.(gz|br)$' list1 | shuf) >list || true - s=$(md5sum list | cut -c-16) + (grep -vE '\.(gz|br)$' list1; grep -E '\.(gz|br)$' list1 | (shuf||gshuf) ) >list || true + s=$( (sha1sum||shasum) < list | cut -c-16) grep -q $s "$zdir/h" && continue echo $s >> "$zdir/h" break diff --git a/scripts/sfx.py b/scripts/sfx.py index 400b4c2d..71f3ffbb 100644 --- a/scripts/sfx.py +++ b/scripts/sfx.py @@ -213,11 +213,11 @@ def yieldfile(fn): def hashfile(fn): - h = hashlib.md5() + h = hashlib.sha1() for block in yieldfile(fn): h.update(block) - return h.hexdigest() + return h.hexdigest()[:24] def unpack():