Cardano

cometa.cardano.get_lib_version()[source]

Retrieves the version of the Cardano C library.

This function returns a string representing the version of the underlying Cardano C library. The version string follows the Semantic Versioning (SemVer) format, which consists of three segments: MAJOR.MINOR.PATCH (e.g., “1.0.3”).

Returns:

A string containing the library’s version.

Return type:

str

Example

>>> from cometa import get_lib_version
>>> version = get_lib_version()
>>> print(f"Cardano C library version: {version}")
Cardano C library version: 1.0.3

cometa.cardano.memzero(buffer)[source]

Securely wipes the contents of a buffer from memory.

This function is used to securely erase sensitive data stored in the provided buffer. This ensures that the data is no longer recoverable from memory after it has been used.

After use, sensitive data should be overwritten. However, traditional approaches like simple zero-filling can be stripped away by optimizing compilers. This function guarantees that the memory is cleared, even in the presence of compiler optimizations.

It is especially important to call this function before freeing memory that contains sensitive information, such as cryptographic keys or decrypted data, to prevent the data from remaining in memory.

Parameters:

buffer (bytearray) – A bytearray whose contents should be securely erased. The buffer will be modified in place.

Return type:

None

Example

>>> from cometa import memzero
>>> sensitive_data = bytearray(b"secret_key_12345")
>>> print(sensitive_data)
bytearray(b'secret_key_12345')
>>> memzero(sensitive_data)
>>> print(sensitive_data)
bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')

Note

This function only works with mutable buffer types (bytearray). Immutable types like bytes cannot be modified.