mirror of
https://github.com/3b1b/manim.git
synced 2025-07-28 20:43:56 +08:00
Make the default size for hash_string an option
This commit is contained in:
@ -96,7 +96,6 @@ def binary_search(function: Callable[[float], float],
|
|||||||
return mh
|
return mh
|
||||||
|
|
||||||
|
|
||||||
def hash_string(string: str) -> str:
|
def hash_string(string: str, n_bytes=16) -> str:
|
||||||
# Truncating at 16 bytes for cleanliness
|
|
||||||
hasher = hashlib.sha256(string.encode())
|
hasher = hashlib.sha256(string.encode())
|
||||||
return hasher.hexdigest()[:16]
|
return hasher.hexdigest()[:n_bytes]
|
||||||
|
Reference in New Issue
Block a user