Kein Assembler, aber trotzdem recht schnell:
Delphi-Quellcode:
function MyStrToHex(const s: string): string;
const
hex: array[0..15] of WideChar = '0123456789ABCDEF';
var
I: Integer;
W: WordRec;
P: PChar;
begin
SetLength(Result, 4*Length(S));
P := PChar(Result);
for I := 1 to Length(S) do
begin
W := WordRec(S[I]);
P[0] := hex[W.Hi shr 4];
P[1] := hex[W.Hi and $F];
P[2] := hex[W.Lo shr 4];
P[3] := hex[W.Lo and $F];
Inc(P, 4);
end;
end;