So, are you still with us? Good. The first step to unlocking your Galaxy S II is to root it. This part is crucial because you will need to have root access in order to get the nv_data.bin file, located in /efs/nv_data.bin. Go ahead and copy that file to your computer and open it up with a HEX editor. Now you jump over to offset 0x181460 and get the hash values for 0x18146e, 0x18148e, 0x1814ae, 0x1814ce, and 0x1814ee. The HEX editor should be able to calculate SHA1 hash values for you. If the value of any of these offsets turns out to be 7D3E17CFCD816CACD4E025FAA65004FDD17D51F8 just ignore it, yet if it doesn't – that is the one you need. Copy that value and paste it at the page, to which a link has been provided for you below. An 8 digit unlock code will be calculated for you so just pop in an unaccepted SIM card in the phone and type it in.
Be aware that the procedure that we just described is dangerous and can render your phone useless if you do something wrong. Proceed at your own risk.
The hash value can be converted into the needed unlock code here.
If you need a HEX editor, you can use HEX Workshop or WinHex
source: XDA-Developers via Samsung Hub