Easy job!
var
X: Integer;
begin
S:= IntToHex(X, 2);
end;
function Hex2Int(S: String): Integer;
var
I, X: Integer;
begin
S:= Trim(S)
Result:= 0;
for I:= 1 to Length(S) do begin
case S of
'0'..'9': X:= Ord(S) - Ord('0');
'A'..'F': X:= Ord(S) - Ord('A') + 10;
'a'..'f': X:= Ord(S) - Ord('a') + 10;
else X:= 0;
end;
Result:= (Result shl 4) + X;
end;
end;