News for hackers. Stuff that matters.
Re:There are no good constant-time data structures by tedunangst on Tuesday December 02, 2014 @09:31PM (#8691556)
This is very similar to the algorithm OpenBSD uses in timingsafe_memcmp().

http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libc/string...

Re:There are no good constant-time data structures by pbsd on Tuesday December 02, 2014 @10:09PM (#8691686)
Indeed. The two main differences are that I didn't care about returning {-1, 0, 1} to emulate `memcmp`, and that I don't rely on implementation-defined behavior (signed shifts being arithmetic).