Bug#765893: streql - Constant-time string comparison
On 30/10/14 01:34, Leslie S Satenstein wrote:
> Hi Riley
>
> Suppose the strings are 10k bytes each (10240), but they differ at byte zero,
> where is the break instruction to stop the compare?
Why would there need to be a break instruction? That would mean that the
time taken to compare strings of equal length would change depending on
the length of the string, unless I'm mistaken.
> The code needs an addition to the for loop as shown below.
> In place of xor, the return of a comparison when non zero is encountered would allow one to know if string x < string y or the contrary.
Sorry, but I don't understand what you mean. Why is it important to be
able to know whether string x > string y or vice versa?
> Regards
> Leslie
> Mr. Leslie Satenstein
> Montréal Québec, Canada
Reply to: