Mass.sha256

Mass.sha256(as_string=False)[source]

Compute a hash of the data for comparison during version control using the sha256 algorithm.

Parameters:
as_stringbool, optional

If True, return the digest in hexadecimal format rather than as bytes.

Returns:
bytes | str

Examples

>>> from compas.datastructures import Mesh
>>> mesh = Mesh.from_obj(compas.get("faces.obj"))
>>> v1 = mesh.sha256()
>>> v2 = mesh.sha256()
>>> mesh.vertex_attribute(mesh.vertex_sample(1)[0], "z", 1)
>>> v3 = mesh.sha256()
>>> v1 == v2
True
>>> v2 == v3
False