For very old Samsung phones (Android 4.4 - 5.1), Samsung used a predictable algorithm.
While some third-party sites charge for these codes, you can often get them for free through official channels: MCK Code - The EE Community
Here is the honest, no-nonsense answer: