Hola a todos. Buscando por internet y haciendo pruebas pongo el código para Delphi. Para los dos ejemplos funciona.
Código Delphi
[-]
function crc8(Buffer:String;Polynom,Initial:Cardinal):Cardinal;
var
i,j : Integer;
begin
Result:=Initial;
for i:=1 to Length(Buffer) do begin
Result:=Result xor ord(buffer[i]);
for j:=0 to 7 do begin
if (Result and $80)<>0 then Result:=(Result shl 1) xor Polynom
else Result:=Result shl 1;
end;
end;
Result:=Result and $ff;
end;
Crc8('TBAI-00000006Y-251019-btFpwP8dcLGAF-', $07, 0); = '237'
Crc8('https://batuz.eus/QRTBAI/?id=TBAI-00000006Y-251019-btFpwP8dcLGAF-237&s=T&nf=27174&i=4.70', $07, 0); = '007'