diff --git a/trame_vtk/modules/vtk/serializers/utils.py b/trame_vtk/modules/vtk/serializers/utils.py index 28a2b11..93a8743 100644 --- a/trame_vtk/modules/vtk/serializers/utils.py +++ b/trame_vtk/modules/vtk/serializers/utils.py @@ -1,5 +1,6 @@ import base64 import hashlib +import sys def rgb_float_to_hex(r, g, b): @@ -48,7 +49,12 @@ def base64_encode(x): def hash_data_array(data_array): - hashed_bit = hashlib.md5(memoryview(data_array), usedforsecurity=False).hexdigest() + if sys.version_info < (3, 9): + hashed_bit = hashlib.md5(memoryview(data_array)).hexdigest() + else: + hashed_bit = hashlib.md5( + memoryview(data_array), usedforsecurity=False + ).hexdigest() type_code = array_types_mapping[data_array.GetDataType()] return "%s_%d%s" % (hashed_bit, data_array.GetSize(), type_code)