import hmac


def PRF512(K: bytes, A: bytes, B: bytes) -> bytes:
    """
    Implementation of PRF-512, as defined in IEEE Std 802.11-2007 Part 11,
    section 8.5.1.1. Returns a 512-bit value.

    :param K: key
    :param A: a unique label for each different purpose of the PRF
    :param B: binary input to the PRF
    """
    num_bytes = 64
    R = b''
    Y = b'\x00'
    for i in range((num_bytes * 8 + 159) // 160 + 1):
        R += hmac.new(K, A + Y + B + bytes([i]), 'sha1').digest()
    return R[:num_bytes]