delphi4arab منتديات دلفي للعرب
تحويل String to Base64 - نسخة قابلة للطباعة

+- delphi4arab منتديات دلفي للعرب (https://delphi4arab.net/forum)
+-- قسم : منتديات دلفي للعرب التعليمية (https://delphi4arab.net/forum/forumdisplay.php?fid=3)
+--- قسم : سؤال و جواب حول دلفي (https://delphi4arab.net/forum/forumdisplay.php?fid=15)
+--- الموضوع : تحويل String to Base64 (/showthread.php?tid=797)



تحويل String to Base64 - Goblin - 10-04-2009

كيف يتم تحويل String to Base64 و العكس ؟


تحويل String to Base64 - I_Tiger - 10-04-2009


اظف هاتين الدالتين في كود برنامجك واستدعهما للتحويل Cool

كود :
const Codes64 = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/'; function Encode64(S: string): string; var i: Integer; a: Integer; x: Integer; b: Integer; begin Result := ''; a := 0; b := 0; for i := 1 to Length(s) do begin x := Ord(s[i]); b := b * 256 + x; a := a + 8; while a >= 6 do begin a := a - 6; x := b div (1 shl a); b := b mod (1 shl a); Result := Result + Codes64[x + 1]; end; end; if a > 0 then begin x := b shl (6 - a); Result := Result + Codes64[x + 1]; end; end; function Decode64(S: string): string; var i: Integer; a: Integer; x: Integer; b: Integer; begin Result := ''; a := 0; b := 0; for i := 1 to Length(s) do begin x := Pos(s[i], codes64) - 1; if x >= 0 then begin b := b * 64 + x; a := a + 6; if a >= 8 then begin a := a - 8; x := b shr a; b := b mod (1 shl a); x := x mod 256; Result := Result + chr(x); end; end else Exit; end; end;



تحويل String to Base64 - Dr.MOT - 10-04-2009

كيف هو المتغير Base64 ??

وشكرا


تحويل String to Base64 - I_Tiger - 10-04-2009


اي متغير تقصد يا اخي على حسب علمي Base64 هو نظام تشفير

القي نظرة هنا



تحويل String to Base64 - DAMAX2010 - 08-02-2012

Base64 هو نظام تشفير ملفات PHP


تحويل String to Base64 - kachwahed - 08-02-2012

Base64 هو مخطط تشفير يعرض بيانات ثنائية بصيغة ASCII على هيئتها النصية
يستخدم خصيصا لأجل نقل بيانات ثنائية عبر وسائط بصيغة نصية
مما يضمن وصولها إلى المستلم بشكل سليم
Base64 يستخدم عادة مع رسائل البريد الالكتروني (باستخدام المعيار MIME)
كما يستخدم لتخزين بيانات مركبة في صيغة XML
ترجمة عن wikipedia
Daniel Wischnewski قام بتجويد كود Indy للترميز Base64 بكود ASM
PHP كود :
uses SysUtils;

/ / 
A string encoded in base64 representation of the corresponding
Base64Encode 
function (const-Text: AnsiString): AnsiString; overload;
/ / 
Base64-decodes a string representation of the corresponding string
Base64Decode 
function (const-Text: AnsiString): AnsiString; overload;

/ / 
Sets the size of the base-64 representation
CalcEncodedSize 
function (insize: Cardinal): Cardinal;
/ / 
Sets the size of the binary representation
CalcDecodedSize 
function (const InBuffer, insize: Cardinal): Cardinal;

/ / 
A buffer encoded in the corresponding base-64 representation
Base64Encode procedure 
(const InBuffer, insize: Cardinal; OutBuffer var); overload; register;
/ / 
Decode the Base64 representation in a buffer
{$ IFDEF} SpeedDecode
Base64Decode procedure 
(const InBuffer, insize: Cardinal; OutBuffer var); overload; register;
{$ ENDIF}
{$ 
IFDEF} ValidityCheck
Base64Decode 
function (const InBuffer, insize: Cardinal; var OutBuffer): Boolean; overload; register;
{$ ENDIF}

/ / 
A string encoded in base64 representation of the corresponding
Base64Encode procedure 
(const-Text: PAnsiChar var OutText: PAnsiChar); overload;
/ / 
Base64-decodes a string representation of the corresponding string
Base64Decode procedure 
(const-Text: PAnsiChar var OutText: PAnsiChar); overload;

/ / 
A string encoded in base64 representation of the corresponding
Base64Encode procedure 
(const-Text: AnsiString; var OutText: AnsiString); overload;
/ / 
Base64-decodes a string representation of the corresponding string
Base64Decode procedure 
(const-Text: AnsiString; var OutText: AnsiString); overload; 
الكود بأكمله من المصدر:
كود :
http://www.delphipraxis.net/991-base64-mime-en-decoding.html
بالتوفيق.



تحويل String to Base64 - DAMAX2010 - 09-02-2012

kachwahed

أخي ممكن كيفية استدعاء هذه الدوال للتشفير و ما يلزمني في مشروعي؟
لأنني أضفت String و لم تعمل سأرفقت المشروع لتطلع عليه
متأسف على الازعاج لي سنتين متوقف عن البرمجة بالدالفي


تحويل String to Base64 - kachwahed - 09-02-2012

يبدو أنك نسيت دلفي تماما Smile
PHP كود :
procedure TForm1.sButton1Click(Sender: TObject);
begin
  Edit2
.Text := Base64Encode(Edit1.Text);
end;

procedure TForm1.btn1Click(Sender: TObject);
var
  
S: string;
begin
  Base64Decode
(Edit2.Text, S);
  
Edit1.Text := S;
end; 



تحويل String to Base64 - DAMAX2010 - 10-02-2012

و الله نسيته تماما مع الهكر و البرمجة بالPHP و البيرل كل شيء راح شكرا لك أخي kachwahed