-


Base - 2


end {Triplet2Kwartet};

 

procedure Kwartet2Triplet(Kwartet: TKwartet;

var Triplet: TTriplet);

var

i: Integer;

begin

if Base64 then

begin

for i:=0 to 3 do

begin

case Chr(Kwartet[i]) of

'A'..'Z': Kwartet[i] := 0 + Kwartet[i]

- Ord('A') + Ord(SP);

'a'..'z': Kwartet[i] := 26+ Kwartet[i]

- Ord('a') + Ord(SP);

'0'..'9': Kwartet[i] := 52+ Kwartet[i]

- Ord('0') + Ord(SP);

'+': Kwartet[i] := 62+ Ord(SP);

'/': Kwartet[i] := 63+ Ord(SP);

end

end

end

else

if XXCode then

begin

for i:=0 to 3 do

begin

case Chr(Kwartet[i]) of

'+': Kwartet[i] := 0 + Ord(SP);

'-': Kwartet[i] := 1 + Ord(SP);

'0'..'9': Kwartet[i] := 2 + Kwartet[i]

- Ord('0') + Ord(SP);

'A'..'Z': Kwartet[i] := 12 + Kwartet[i]

- Ord('A') + Ord(SP);

'a'..'z': Kwartet[i] := 38 + Kwartet[i]

- Ord('a') + Ord(SP)

end

end

end;

Triplet[0] := ((Kwartet[0] - Ord(SP)) SHL 2) +

(((Kwartet[1] - Ord(SP)) AND $30) SHR 4);

Triplet[1] := (((Kwartet[1] - Ord(SP)) AND $0F) SHL 4) +

(((Kwartet[2] - Ord(SP)) AND $3C) SHR 2);

Triplet[2] := (((Kwartet[2] - Ord(SP)) AND $03) SHL 6) +

((Kwartet[3] - Ord(SP)) AND $3F)

end

{Kwartet2Triplet};

, , .