PascalVault / Lazarus_Hashing

Checksum & Hashing library for Lazarus
MIT License
18 stars 3 forks source link

small optim here? #7

Open Alexey-T opened 1 year ago

Alexey-T commented 1 year ago
function THasherList.FindClass(Name: String; out AClass: THasherClass): Boolean;
var Index: Integer;
begin
  Name := LowerCase(Name);
  Index := FList.IndexOf(Name);

FList.IndexOf(LowerCase(Name)) and make Name the const-param.

PascalVault commented 1 year ago

While this is a nice idea for how the code works now I have a plan to extend functionality of FindClass() if people find it useful.

The plan is to find THasherClasses even when "Name" is not an exact match - has unnecessary spaces, hyphens or slashes. So for example if the registered name is "CRC-16 KERMITT" then calling FindClass(" CRC16/KERMITT ") would also find this class.