related to technical working of hotspot in android As we know every device came with an application of tethering.As it is obvious that somewhere in our device definitely the matching of the passwords typed by a second person and the correct password is being done, So I want to know how this matching happens on the Android devices.
This is security related question that's why everyone wants to know how the functionality of android works and I think everyone should know.

So let me explain about this topic :
suppose there are two devices A and B.

The device which want to connect to WIFI connection (suppose mobile: A)and the device which has tethering hotspot enabled(suppose mobile: B).

Here the A sends the request to B for connecting with wifi network and share the data.In response to this request device B sends the challenge of 8 byte with encryption on key and hash if the device B has password protection otherwise device A can directly invited to connect with that open network.

Now, Device A must match the credentials(challenge) to connect with that network, to do that device A enters a password and hit the enter button.After that the request with password is sent to the device B.The entered password is also sent with encryption algorithm to device B.

There are so many algorithms available for password checking.Here checking of password is done with algorithms which are stored in android somewhere.The matching will be done with stored encrypted password and user entered password.If the password pattern matches then device B send a flag with success, otherwise it will send bad request message to the device B and again ask for password.

If the password matches successfully the device A connects with device B and the device b stores the physical address of the device A to locate the device.

I hope it will helpful information.