SIM lock
What's that?
In the GSM world there are a couple of "locks" e g ways of blocking the use of different SIM cards in a GSM phone. It is the phone, not the card, that has the lock. 
- Country lock
- Network lock
- Provider lock
- SIM card lock

Country Lock makes the phone functioning only with cards issued in that specific country.

Network Lock makes the phone functioning only with cards from one single network.

Service Provider Lock is only used in countries with so called Service Providers, which means companies reselling the services of one or more net operators. They have no net of their own. The SP-lock makes the phone functioning only with cards issued by that specific Service Provider.

SIM Card Lock makes the phone functioning only with one single card. If your SIM cards is malfunctioning, you'll have return both card and phone.

The most used lock is the SP-lock (Service Provider Lock).

Locks of these kinds vary much from country to country. The extremes are Finland where you're not allowed to lock the phone at all (it is considered hindering real competition) and on the other end Hungary where nearly all phones are locked for life!!!

The code you need to unlock the phone is not generated with the help of any mathematical formula. It is randomly generated and kept in a database in the computers of the operators. So it is no use, like thousands of other users, to try ti find "the right code" on the internet. It is ONLY the issuer, NOONE else, who can supply you with the code. There are some scams, where they promise to give you the code. Forget it! What you actually can find are so called "phone clips" which you to the contact of the phone and reprogram the software so that the lock disappears. These clips are very often very expensive.

The software of the phone is made in such way that it asks for the unlock code if you place "wrong" SIM card in the phone. This code is ONLY obtainable from the issuer.