nvflare.fuel.hci.base64_utils module

b64str_to_binary_file(b64str: str, file_name)[source]

Decode a base64-encoded string and write it into a binary file.

Parameters:
  • b64str – the base64-encoded ASCII string

  • file_name – the file to write to

Returns: number of bytes written

b64str_to_bytes(b64str: str) bytes[source]

Convert base64-encoded string to binary.

b64str_to_text_file(b64str: str, file_name)[source]

Decode a base64-encoded string and write result into a text file.

Parameters:
  • b64str – base64-encoded string

  • file_name – file to be created

Returns: number of data types written (may not be the same as number of characters)

binary_file_to_b64str(file_name) str[source]

Encode content of a binary file to a Base64-encoded ASCII string.

Parameters:

file_name – the binary file to be processed

Returns: base64-encoded ASCII string

bytes_to_b64str(data_bytes) str[source]

Convert binary to base64-encoded string.

text_file_to_b64str(file_name) str[source]

Encode content of a text file to a Base64-encoded ASCII string.

Parameters:

file_name – name of the text file

Returns: base64-encoded string