Not sure if you are talking about the general algorithm behind it, This is a technical explanation
Simple explanation
Here
If you are doing etherum, check out