cryptography - Is integer comparison in Python constant time? -


is integer comparison in python constant time? can use compare user-provided int token server-stored int crypto in way compare strings constant_time_compare django.utils.crypto, i.e. without suffering timing attacks?

alternatively, more secure convert string , use above function?

the answer yes for given size of integer - default python integers big become long , have potentially infinite length - compare time grows size. if restrict size of integer ctypes.c_uint64 or ctypes.c_uint32 not case.

note compare 0 special case, faster, due hardware actions many cpus have special flag 0, if using/allowing seeds or tokens values of 0 asking trouble.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -