Constant time check for codes

Constant Time comparison of keys and unit tests added