# stdnum.mac

MAC address (Media Access Control address).

A media access control address (MAC address, sometimes Ethernet address) of a device is meant as a unique identifier within a network at the data link layer.

More information:

- https://en.wikipedia.org/wiki/MAC_address

- https://en.wikipedia.org/wiki/Organizationally_unique_identifier

- https://standards.ieee.org/faqs/regauth.html#2

    >>> validate('D0-50-99-84-A2-A0')
    'd0:50:99:84:a2:a0'
    >>> to_eui48('d0:50:99:84:a2:a0')
    'D0-50-99-84-A2-A0'
    >>> is_multicast('d0:50:99:84:a2:a0')
    False
    >>> get_manufacturer('d0:50:99:84:a2:a0')
    'ASRock Incorporation'
    >>> get_oui('d0:50:99:84:a2:a0')
    'D05099'
    >>> get_iab('d0:50:99:84:a2:a0')
    '84A2A0'

stdnum.mac.compact(number: str) → str

  Convert the MAC address to the minimal, consistent representation.

stdnum.mac.get_iab(number: str) → str

  Return the IAB (individual address block) part of the address.

stdnum.mac.get_manufacturer(number: str) → str

  Look up the manufacturer in the IEEE OUI registry.

stdnum.mac.get_oui(number: str) → str

  Return the OUI (organization unique ID) part of the address.

stdnum.mac.is_broadcast(number: str) → bool

  Check whether the number is the broadcast address.

  Broadcast addresses are meant to be received by all nodes in a network.

stdnum.mac.is_locally_administered(number: str) → bool

  Check if the address is meant to be configured by an administrator.

stdnum.mac.is_multicast(number: str) → bool

  Check whether the number is a multicast address.

  Multicast addresses are meant to be received by (potentially) multiple nodes in a network (LAN).

stdnum.mac.is_unicast(number: str) → bool

  Check whether the number is a unicast address.

  Unicast addresses are received by one node in a network (LAN).

stdnum.mac.is_universally_administered(number: str) → bool

  Check if the address is supposed to be assigned by the manufacturer.

stdnum.mac.is_valid(number: str, validate_manufacturer: bool | None = None) → bool

  Check if the number provided is a valid IBAN.

stdnum.mac.to_eui48(number: str) → str

  Convert the MAC address to EUI-48 format.

stdnum.mac.validate(number: str, validate_manufacturer: bool | None = None) → str

  Check if the number provided is a valid MAC address.

  The existence of the manufacturer is by default only checked for universally administered addresses but can be explicitly set with the validate_manufacturer argument.