MCPcopy Index your code
hub / github.com/secdev/scapy / matching_bits

Function matching_bits

scapy/utils6.py:887–893  ·  view source on GitHub ↗
(byte1, byte2)

Source from the content-addressed store, hash-verified

885 Return common prefix length of IPv6 addresses a and b.
886 """
887 def matching_bits(byte1, byte2):
888 # type: (int, int) -> int
889 for i in range(8):
890 cur_mask = 0x80 >> i
891 if (byte1 & cur_mask) != (byte2 & cur_mask):
892 return i
893 return 8
894
895 tmpA = inet_pton(socket.AF_INET6, a)
896 tmpB = inet_pton(socket.AF_INET6, b)

Callers 1

in6_get_common_plenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected