diff --git a/ycast/my_stations.py b/ycast/my_stations.py index fd0bb2d..ac5dc47 100644 --- a/ycast/my_stations.py +++ b/ycast/my_stations.py @@ -75,7 +75,12 @@ def get_stations_by_category(category): return stations -def get_checksum(feed): +def get_checksum(feed, charlimit=12): hash_feed = feed.encode() - hash_object = hashlib.sha256(hash_feed) - return hash_object.hexdigest() + hash_object = hashlib.md5(hash_feed) + digest = hash_object.digest() + xor_fold = bytearray(digest[:8]) + for i, b in enumerate(digest[8:]): + xor_fold[i] ^= b + digest_xor_fold = ''.join(format(x, '02x') for x in bytes(xor_fold)) + return digest_xor_fold[:charlimit]