I understand if two IP addresses are AND\'d with a subnet mask if the result is the same then they are on the same network. If the result is different then they are on diffe
Despite the fact that it's a rather odd question, I'll try answering your specific query:
The number '1' in that second octet is really a number 1, and therefore it's '001', not '100'.
That said, your example should have worked, so I suspect there's something wrong with your implementation. You should not need to worry about padding or anything. These are numbers, and bitwise-AND should "just work".
You might want to provide more detail about what is going wrong.