protocol_descriptors.py
def append_crc_to_message(message):
    ''' This function takes message as argument and append a 
        crc value at the designated spot at the end.
        Crc is calculated from the whole message up to the
        mentioned designated spot for crc '''
    crc_value = get_crc(bytes(message[:-BODY_END_CRC_LENGTH]))
    
    print(f"message len at the beginning: {len(message)}")
    # write filename
    crc_byte_value = crc_value.to_bytes(BODY_END_CRC_LENGTH,'big')

    start_idx_crc = len(message) - BODY_END_CRC_LENGTH
    for crc_byte_idx in range(BODY_END_CRC_LENGTH):
        message[start_idx_crc+crc_byte_idx] = crc_byte_value[crc_byte_idx]

    return message
 This function takes message as argument and append a 
        crc value at the designated spot at the end.
        Crc is calculated from the whole message up to the
        mentioned designated spot for crc 
This function takes message as argument and append a
crc value at the designated spot at the end.
Crc is calculated from the whole message up to the
mentioned designated spot for crc
This function takes message as argument and append a crc value at the designated spot at the end . Crc is calculated from the whole message up to the mentioned designated spot for crc
def append_crc_to_message(message):
    crc_value = get_crc(bytes(message[:-BODY_END_CRC_LENGTH]))
    print(f"message len at the beginning: {len(message)}")
    crc_byte_value = crc_value.to_bytes(BODY_END_CRC_LENGTH,'big')
    start_idx_crc = len(message) - BODY_END_CRC_LENGTH
    for crc_byte_idx in range(BODY_END_CRC_LENGTH):
        message[start_idx_crc+crc_byte_idx] = crc_byte_value[crc_byte_idx]
    return message
def append_crc_to_message ( message ) : crc_value = get_crc ( bytes ( message [ : - BODY_END_CRC_LENGTH ] ) ) print ( f"message len at the beginning: {len(message)}" ) crc_byte_value = crc_value . to_bytes ( BODY_END_CRC_LENGTH , 'big' ) start_idx_crc = len ( message ) - BODY_END_CRC_LENGTH for crc_byte_idx in range ( BODY_END_CRC_LENGTH ) : message [ start_idx_crc + crc_byte_idx ] = crc_byte_value [ crc_byte_idx ] return message
This function takes message as argument and append a
crc value at the designated spot at the end.
This function takes message as argument and append a crc value at the designated spot at the end .
''' This function takes message as argument and append a 
        crc value at the designated spot at the end.
        Crc is calculated from the whole message up to the
        mentioned designated spot for crc ''' # write filename

message