Don't know what DupeString is, heh, but I guess you could replace it with something like:

while Length(c) < 6 do

c := '0' + c;

also, ReplaceWrongChars could be rewritten as follows (for brevity)

procedure ReplaceWrongChars(var s: string);

var

i: integer;

begin

if s <> '' then

for i := 1 to 6 do

if not (s[i] in ['0' .. '9', 'A' .. 'F']) then

s[i] := '0';

end;

while Length(c) < 6 do

c := '0' + c;

also, ReplaceWrongChars could be rewritten as follows (for brevity)

procedure ReplaceWrongChars(var s: string);

var

i: integer;

begin

if s <> '' then

for i := 1 to 6 do

if not (s[i] in ['0' .. '9', 'A' .. 'F']) then

s[i] := '0';

end;