A lesson in timing attacks
codahale.com
codahale.com
Server CPU = 2GHz, 2 instructions per cycle, time for instruction=1/4 ns. Does comparing a byte in a Java array really require 80,000 instructions? How does this work?
It's exploitable "on LAN, but not over the Internet", which is deceptive because "on LAN" also means "anywhere from within the same hosting center"; attackers can get on the "same LAN" as most servers for tens of dollars.
HN should remove all after the '?' then do a diff between the 2 contents, and keep the short url if the contents are the same.
There was some helpful Q&A in that old discussion though, so it's good that you linked to it.
// Package subtle implements functions that are often useful in cryptographic
// code but require careful thought to use correctly.
package subtleso, "result |= x ^ y" will change result to true if x and y are different. since its bitwise, the bits that are different between x and y will be set in result
For example, if x = 0b0101 and y = 0b0011, x ^ y = 0b0110. If result was previously 0b0011 from a previous test, then after "result |= 0b0110" result will be 0b0111.
Of course, in many programming languages (including Java and Python), a value of zero is interpreted as false and anything else is true.
result |= x ^ y
means result = result | (x ^ y)
means result = result 'bitwise-or' (x 'bitwise-xor' y)