(data, element_width)
return "-".join(str(x) for x in int_vals)
Convert a packed array of elements to a JA3 segment.

    :param data: Current PCAP buffer item
    :type: str
    :param element_width: Byte count to process at a time
    :type element_width: int
    :returns: str
Convert a packed array of elements to a JA3 segment.
Convert a packed array of elements to a JA3 segment .
def convert_to_ja3_segment(data, element_width):
    """Convert a packed array of elements to a JA3 segment.

    :param data: Current PCAP buffer item
    :type: str
    :param element_width: Byte count to process at a time
    :type element_width: int
    :returns: str
    """
    int_vals = list()
    data = bytearray(data)
    if len(data) % element_width:
        message = '{count} is not a multiple of {width}'
        message = message.format(count=len(data), width=element_width)
        raise ValueError(message)

    for i in range(0, len(data), element_width):
        element = ntoh(data[i: i + element_width])
        if element not in GREASE_TABLE:
            int_vals.append(element)

    return "-".join(str(x) for x in int_vals)
def convert_to_ja3_segment ( data , element_width ) : int_vals = list ( ) data = bytearray ( data ) if len ( data ) % element_width : message = '{count} is not a multiple of {width}' message = message . format ( count = len ( data ) , width = element_width ) raise ValueError ( message ) for i in range ( 0 , len ( data ) , element_width ) : element = ntoh ( data [ i : i + element_width ] ) if element not in GREASE_TABLE : int_vals . append ( element ) return "-" . join ( str ( x ) for x in int_vals )