synopse / mORMot

Synopse mORMot 1 ORM/SOA/MVC framework - Please upgrade to mORMot 2 !
https://synopse.info
785 stars 324 forks source link

Loop improvement in function IsEqual(const A,B; count: PtrInt): boolean; #343

Closed lguzzon closed 4 years ago

lguzzon commented 4 years ago

Exit when result is false

synopse commented 4 years ago

The point of the code is to be constant in time, as expected by best cryptographic practices. Your modification make it slightly faster, but not constant in time. The SynCommons.pas function CompareMem() is to be used for fast and non-constant binary comparison.

lguzzon commented 4 years ago

The point of the code is to be constant in time, as expected by best cryptographic practices. Your modification make it slightly faster, but not constant in time. The SynCommons.pas function CompareMem() is to be used for fast and non-constant binary comparison.

Ok, thanks for your time