Default Are Unlock codes IMEI specific or also provider specific ?

Hello,

I have issues unlocking a Bell i337m phone on Android i337m due to new firmware. The downgrades (stock Bell) for this phone are either corrupt or crashing in ODIN.

Interestingly the 4.3 update made the unlock codes useless.

Questions:
1. If I flash another provider firmware (provider uses same network), would the codes remain the same? In other words, are the unlock codes provider specific?
2. Are unlock codes direclty repated to IMEI only, and hardware ROM? This looks like not so, since 4.3 firmware rendered the phone unlockable.

PS: There is another thread here confirming this for most Canadian providers and 4.3 - Unlock Codes no longer working....

Unless Unlock codes are firmware dependent only, and Samsung changed them, but that does not make sense since a firmware update does not affect the lock status of the phone...

My theory is that the unlock code is a math formula or combination between some IMEI code and some provider code stored in firmware. In new firmware the portion of the provider code might have changed. So the resulting required Unlock code is different...

Any ideas?