IPFS Private Network Peer discovery

How can the peers with the same swarm key discover each other? Will the bootstrap node filter the peers based on the swarm key? If not, how exactly the peers can differentiate between the node with swarm key and without swarm key while discovering?

Peers using a swarm key will only be able to connect to other peers using that same swarm key. To setup a private network, you’ll have configure your nodes to bootstrap off of a node in the private network.

> ipfs bootstrap add /address/of/your/bootstrap/node

What exactly the swarm key does in Private networks?
and also, How does a peer know about the presence of swarm key in other peer which is trying to connect?

What exactly the swarm key does in Private networks?

All traffic is symmetrically encrypted with the swarm key.

and also, How does a peer know about the presence of swarm key in other peer which is trying to connect?

Both sides will see random garbage when they try to connect and they’ll disconnect.