Did you try searching the web before posting this question? I found at least 2 articles on CodeProject itself which might answer you:
1- This
article explains the algorithm for at least one type of barcodes.
2- If you want to handle different types of barcodes in your application, chasing after the different algorithms will take you a long time and you will be better off using a library like the one in this
article