functions.py
def hide(message, secret, key):
    """
    Hide the secret (encrypted) with the key into the message.

    :param message: Message where we are hiding the information
    :param secret: Secret we are hiding in the message
    :param key: Key used to encrypt the secret after compressing the bits
    :return: The message with the secret.
    """
    # Get the bytes of the secret
    secret_bytes = secret.encode('utf-8')
    # Compress the secret
    compressed_bytes = zlib.compress(secret_bytes, 9)
    # Encrypt the bytes
    encrypted_bytes = aes_encrypt(compressed_bytes, password_hasher(key))
    # Transform the encrypted secret into bits
    encrypted_bits = bytes_to_bitstring(encrypted_bytes)
    # For checking the max length
    len_encrypted_bits = len(encrypted_bits)


    max_length = check_max_secret_length(message)
    if max_length < len_encrypted_bits:
        print(f'The program can only hide {str(max_length)} bits.')
        exit(-1)

    binary_string_counter = 0
    finished = False

    result = []

    for c in message:
        if binary_string_counter < len_encrypted_bits:
            # We should encode the message
            if c in charset_occidental:
                if encrypted_bits[binary_string_counter] == "0":  # Use Occidental
                    result.append(c)
                else:  # Use cyrillic
                    result.append(charset_homograph[charset_occidental.index(c)])
                binary_string_counter += 1
            elif c in charset_homograph:
                if encrypted_bits[binary_string_counter] == "1":
                    result.append(c)
                else:
                    result.append(charset_occidental[charset_homograph.index(c)])
                binary_string_counter += 1
            else:
                result.append(c)
        else:
            if not finished:
                result.append(END_CHARACTER)
                finished = True
            result.append(c)
    final_result = "".join(result)
    return final_result

    Hide the secret (encrypted) with the key into the message.

    :param message: Message where we are hiding the information
    :param secret: Secret we are hiding in the message
    :param key: Key used to encrypt the secret after compressing the bits
    :return: The message with the secret.
    
Hide the secret (encrypted) with the key into the message.
Hide the secret ( encrypted ) with the key into the message .
def hide(message, secret, key):
    secret_bytes = secret.encode('utf-8')
    compressed_bytes = zlib.compress(secret_bytes, 9)
    encrypted_bytes = aes_encrypt(compressed_bytes, password_hasher(key))
    encrypted_bits = bytes_to_bitstring(encrypted_bytes)
    len_encrypted_bits = len(encrypted_bits)
    max_length = check_max_secret_length(message)
    if max_length < len_encrypted_bits:
        print(f'The program can only hide {str(max_length)} bits.')
        exit(-1)
    binary_string_counter = 0
    finished = False
    result = []
    for c in message:
        if binary_string_counter < len_encrypted_bits:
            if c in charset_occidental:
                if encrypted_bits[binary_string_counter] == "0":  
                    result.append(c)
                else:  
                    result.append(charset_homograph[charset_occidental.index(c)])
                binary_string_counter += 1
            elif c in charset_homograph:
                if encrypted_bits[binary_string_counter] == "1":
                    result.append(c)
                else:
                    result.append(charset_occidental[charset_homograph.index(c)])
                binary_string_counter += 1
            else:
                result.append(c)
        else:
            if not finished:
                result.append(END_CHARACTER)
                finished = True
            result.append(c)
    final_result = "".join(result)
    return final_result
def hide ( message , secret , key ) : secret_bytes = secret . encode ( 'utf-8' ) compressed_bytes = zlib . compress ( secret_bytes , 9 ) encrypted_bytes = aes_encrypt ( compressed_bytes , password_hasher ( key ) ) encrypted_bits = bytes_to_bitstring ( encrypted_bytes ) len_encrypted_bits = len ( encrypted_bits ) max_length = check_max_secret_length ( message ) if max_length < len_encrypted_bits : print ( f'The program can only hide {str(max_length)} bits.' ) exit ( - 1 ) binary_string_counter = 0 finished = False result = [ ] for c in message : if binary_string_counter < len_encrypted_bits : if c in charset_occidental : if encrypted_bits [ binary_string_counter ] == "0" : result . append ( c ) else : result . append ( charset_homograph [ charset_occidental . index ( c ) ] ) binary_string_counter += 1 elif c in charset_homograph : if encrypted_bits [ binary_string_counter ] == "1" : result . append ( c ) else : result . append ( charset_occidental [ charset_homograph . index ( c ) ] ) binary_string_counter += 1 else : result . append ( c ) else : if not finished : result . append ( END_CHARACTER ) finished = True result . append ( c ) final_result = "" . join ( result ) return final_result
Hide the secret (encrypted) with the key into the message.
Hide the secret ( encrypted ) with the key into the message .
"""
    Hide the secret (encrypted) with the key into the message.

    :param message: Message where we are hiding the information
    :param secret: Secret we are hiding in the message
    :param key: Key used to encrypt the secret after compressing the bits
    :return: The message with the secret.
    """ # Get the bytes of the secret # Compress the secret # Encrypt the bytes # Transform the encrypted secret into bits # For checking the max length # We should encode the message # Use Occidental # Use cyrillic
The message with the secret.
The message with the secret .
message
Message where we are hiding the information
Message where we are hiding the information
secret
Secret we are hiding in the message
Secret we are hiding in the message
key
Key used to encrypt the secret after compressing the bits
Key used to encrypt the secret after compressing the bits