Показать сообщение отдельно

  #665  
Старый 22.10.2007, 09:52
W!z@rD
Reservists Of Antichat - Level 6
Регистрация: 12.02.2006
Сообщений: 891
Провел на форуме:
1892597

Репутация: 836


Отправить сообщение для W!z@rD с помощью ICQ
По умолчанию

base64


PHP код:
function Decode(const SAnsiString): AnsiString;  
const  
  
Map: array[Charof Byte = (00000000000,  
    
00000000000000000000,  
    
00000000000062000635253,  
    
54555657585960610000000012,  
    
345678910111213141516171819,  
    
2021222324250000002627282930,  
    
313233343536373839404142434445,  
    
464748495051000000000000,  
    
00000000000000000000,  
    
00000000000000000000,  
    
00000000000000000000,  
    
00000000000000000000,  
    
00000000000000000000,  
    
00000000000000000000,  
    
0);  
var  
  
ILongInt;  
begin  
  
case Length(Sof  
    2
:   
      
begin  
        I 
:= Map[S[1]] + (Map[S[2]] shl 6);  
        
SetLength(Result1);  
        
Move(IResult[1], Length(Result))  
      
end;  
    
3:   
      
begin  
        I 
:= Map[S[1]] + (Map[S[2]] shl 6) + (Map[S[3]] shl 12);  
        
SetLength(Result2);  
        
Move(IResult[1], Length(Result))  
      
end;  
    
4:   
      
begin  
        I 
:= Map[S[1]] + (Map[S[2]] shl 6) + (Map[S[3]] shl 12) +  
          (
Map[S[4]] shl 18);  
        
SetLength(Result3);  
        
Move(IResult[1], Length(Result))  
      
end  
  end  
end
;  

function 
Encode(const SAnsiString): AnsiString;  
const  
  
Map: array[0..63of Char 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' +  
    
'abcdefghijklmnopqrstuvwxyz0123456789+/';  
var  
  
ILongInt;  
begin  
  I 
:= 0;  
  
Move(S[1], ILength(S));  
  case 
Length(Sof  
    1
:  
      
Result := Map[I mod 64] + Map[(I shr 6mod 64];  
    
2:  
      
Result := Map[I mod 64] + Map[(I shr 6mod 64] +  
        
Map[(I shr 12mod 64];  
    
3:  
      
Result := Map[I mod 64] + Map[(I shr 6mod 64] +  
        
Map[(I shr 12mod 64] + Map[(I shr 18mod 64]  
  
end  
end

сколько можно говорить: Drkb.ru, DelphiWorld.narod.ru
__________________
*********************************
*Я не волшебник ٩(๏̯͡๏)۶, только учусь...*
*********************************
Программы на заказ
Times to fly...
 
Ответить с цитированием