calc

Functions/classes for various calculations

hsh

hash_content

The elevaso_spine.calc.hsh.hash_content() function provides an easy way to hash content by providing the object and it will perform necessary actions in advance (i.e. unzip an archive file to hash all file contents, convert dictionary or lists to JSON string).

elevaso_spine.calc.hsh.hash_content(source: object) str[source]

Hash content (file, data, directory)

Args:

source (object): Source of data to hash

Returns:

str: String of the hash in uuid format

hash_file

The elevaso_spine.calc.hsh.hash_file() function calulates a single file object hash. If the file is large, it will be performed in blocks.

elevaso_spine.calc.hsh.hash_file(path: str) str[source]

Hash a files content

Args:

path (str): String of the path to hash

Returns:

str: String of the hash in uuid format

hash_string

The elevaso_spine.calc.hsh.hash_string() function calulates the hash of the provided string.

elevaso_spine.calc.hsh.hash_string(content: str) str[source]

Hash string of data

Args:

content(str): String of the content to hash

Returns:

str: String of the hash in uuid format