4 ms·
It is quite easy to time for yourself. Try timing it many times with a sig_bytes off by one(only one character changed). Then compare that with the correct on
by illumen 17y ago
It is quite easy to time for yourself. Try timing it many times with a sig_bytes off by one(only one character changed). Then compare that with the correct one. You'll notice the (small) difference.
There are no tests for it in the keyczar that I could find. I doubt they tested it.
The reasons are many... but this is python, so each operation is much more complicated than C/asm. There are lots of branches, memory usage and cache effects - so code is much more input dependant - especially the integer ops used here. Take a look at this code to see one of the reasons why this python code has variable timing depending on input(like most code does).
x,y = 3,3
id(x) == id(y) # python shares ints in different variables
- tptacek 17y agoThe only data-dependent comparison you've got to work with is a comparison between two register-scale fixed-width integers. I think you're doing something wrong. Perhaps whatever you're doing to create the "off by one" case is disrupting the cache, and you're just seeing the effects of that.