Autor Beitrag
phogl
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 67

Windows 98,2000Pro,XPPro, SuSE Linux 9.0
D5Stad D7Pers D2005Pers
BeitragVerfasst: Fr 14.01.05 21:34 
Hallöchen erstmal!
In PHP gibt es ja die Befehle "base64_encode" und "base64_decode". das was die machen würd ich gern in delphi machen, weiss aber nicht wie... wär nett wenns mir jemand verraten würde ;)
danke schonmal
Coder
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1383
Erhaltene Danke: 1

WinXP
D2005 PE
BeitragVerfasst: Fr 14.01.05 22:25 
Ich glaube es würde das Raten erleichtern wenn du erklärst was diese Funktionen machen, da hier nicht jeder PHP kann :wink: (zum Beispiel ich. Aber ich hab mich schon für einen Kurs angemeldet :D )
phogl Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 67

Windows 98,2000Pro,XPPro, SuSE Linux 9.0
D5Stad D7Pers D2005Pers
BeitragVerfasst: Fr 14.01.05 22:44 
Ich will dann nur mal diesen Link posten *g* de2.php.net/manual/d...on.base64-encode.php
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Fr 14.01.05 22:53 
Das ist eine Suche bei Google MIME64-Encodierung, die von dieser Funktion vorgenommen wird.

Jeweils 6 Bits werden aus einem Datenstrom genommen und als ein ASCII-Zeichen aus "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+\" dargestellt (Reihenfolge weiß ich jetzt grad net genau ... Fehlende Bits werden durch 0en ersetzt, der letzte Viererblock wird durch =-Zeichen aufgefüllt ...

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
bms
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 735

Win XP
Delphi 3, Delphi 6 PE, Delphi 2005 PE
BeitragVerfasst: Fr 14.01.05 23:42 
Das ist Base64 Kodierung. Es gibt Indy-Komponenten die das können. Je nachdem welche Delphiversion du hast, hast du auch die Komponenten. Alternativ Indy Komponenten laden und installieren. Sonst gibt es auch Unis im Internet die das können.

_________________
VORSICHT: Ich behersche seit heute die Fünf-Finger-Handflächen-Herz-Explodier-Schlag-Kampf-Technik >:(
phogl Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 67

Windows 98,2000Pro,XPPro, SuSE Linux 9.0
D5Stad D7Pers D2005Pers
BeitragVerfasst: Mo 17.01.05 19:15 
Ich benutze D2k5 und D7, wär echt super wenn mir jemand erklären könnte wir ich das mache (von indy hab ich absolut kein plan und google hat nicht so wirklich was hergegeben) ich möchte nur das der, ich nenns mal base64 code von einer datei in ne memobox kommt und ich den code wenn ich den da reinkopiere auch wieder in ne datei verwandeln kann, das wär echt nett, danke schonmal
phogl Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 67

Windows 98,2000Pro,XPPro, SuSE Linux 9.0
D5Stad D7Pers D2005Pers
BeitragVerfasst: Mo 17.01.05 20:06 
Schon ok, habs hinbekommen, trotzdem danke!
phogl Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 67

Windows 98,2000Pro,XPPro, SuSE Linux 9.0
D5Stad D7Pers D2005Pers
BeitragVerfasst: Mo 17.01.05 20:32 
so, für alle die das mal suchen werden hab ich mal n ganz kleines proggi in nem nicht ganz perfekten aber wie ich finde sehr leicht verstänglichen stil geschrieben das ich hier jetzt poste:

ausblenden project1.dpr
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
program Project1;

uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1};

{$R *.res}

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.


ausblenden volle Höhe Unit1.dfm
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
object Form1: TForm1
  Left = 192
  Top = 113
  AutoSize = True
  BorderIcons = []
  BorderStyle = bsSingle
  Caption = 'Form1'
  ClientHeight = 401
  ClientWidth = 857
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object Button1: TButton
    Left = 0
    Top = 376
    Width = 75
    Height = 25
    Caption = 'Encode'
    TabOrder = 0
    OnClick = Button1Click
  end
  object Button2: TButton
    Left = 80
    Top = 376
    Width = 75
    Height = 25
    Caption = 'Decode'
    TabOrder = 2
    OnClick = Button2Click
  end
  object Button3: TButton
    Left = 168
    Top = 376
    Width = 75
    Height = 25
    Caption = 'Copy'
    TabOrder = 3
    OnClick = Button3Click
  end
  object Button4: TButton
    Left = 248
    Top = 376
    Width = 75
    Height = 25
    Caption = 'Paste'
    TabOrder = 4
    OnClick = Button4Click

  end
  object Button5: TButton
    Left = 336
    Top = 376
    Width = 75
    Height = 25
    Caption = 'Load'
    TabOrder = 5
    OnClick = Button5Click
  end
  object Button6: TButton
    Left = 416
    Top = 376
    Width = 75
    Height = 25
    Caption = 'Save'
    TabOrder = 6
    OnClick = Button6Click
  end
  object Memo1: TMemo
    Left = 0
    Top = 0
    Width = 857
    Height = 377
    ScrollBars = ssVertical
    TabOrder = 1
  end
  object IdDecoderMIME1: TIdDecoderMIME
    FillChar = '='
    Left = 64
    Top = 128
  end
  object IdEncoderMIME1: TIdEncoderMIME
    FillChar = '='
    Left = 32
    Top = 128
  end
  object OpenDialog1: TOpenDialog
    Left = 96
    Top = 128
  end
  object SaveDialog1: TSaveDialog
    Left = 128
    Top = 128
  end
end


ausblenden volle Höhe Unit1.pas
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, IdCoder, IdCoder3to4, IdCoderMIME, IdBaseComponent,
  ClipBrd;

type
  TForm1 = class(TForm)
    IdDecoderMIME1: TIdDecoderMIME;
    IdEncoderMIME1: TIdEncoderMIME;
    Button1: TButton;
    Memo1: TMemo;
    OpenDialog1: TOpenDialog;
    Button2: TButton;
    SaveDialog1: TSaveDialog;
    Button3: TButton;
    Button4: TButton;
    Button5: TButton;
    Button6: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure Button6Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  strm : TFileStream;
begin
  if OpenDialog1.Execute then begin
    strm:=TFileStream.Create(OpenDialog1.FileName,fmOpenRead);
    strm.Seek(0,soFromBeginning);
    Memo1.Text:=Self.IdEncoderMIME1.Encode(strm);
    strm.Free;
  end;
end;

procedure TForm1.Button2Click(Sender: TObject);
var
  strm : TFileStream;
begin
  if SaveDialog1.Execute then begin
    strm := TFileStream.Create(SaveDialog1.FileName,fmCreate);
    Self.IdDecoderMIME1.DecodeToStream(Memo1.Text,strm);
    strm.Free;
  end;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
  Memo1.SelectAll;
  Memo1.CopyToClipboard;
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
  Memo1.Text:='';
  Memo1.PasteFromClipboard;
end;

procedure TForm1.Button5Click(Sender: TObject);
begin
  if OpenDialog1.Execute then begin
    Memo1.Text:='';
    Memo1.Lines.LoadFromFile(OpenDialog1.FileName);
  end;
end;

procedure TForm1.Button6Click(Sender: TObject);
begin
  if SaveDialog1.Execute then begin
    Memo1.Lines.SaveToFile(SaveDialog1.FileName);
  end;
end;

end.


Ich hoffe das hilft irgendjemande, kritik is immer willkommen! ;)
hf
phogl

Moderiert von user profile iconChristian S.: Code- durch Delphi-Tags ersetzt.

Danke für dir Blumen, ich hab die tags so gesetzt wie ich die haben wollte :-/ und das funzt doch so, warum muss man das unbedingt ändern?!
Tomate008
Hält's aus hier
Beiträge: 1



BeitragVerfasst: Do 19.07.07 09:59 
Titel: DANKE!
DANKEEEEEEEEEEEE auch ich war auf der suche nach genau diesem und habe mich total gefreut das du nochmal das komplette projekt gepostet hast!! DANKE DANKE
arj
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 378

Win XP/Vista, Debian, (K)Ubuntu
Delphi 5 Prof, Delphi 7 Prof, C# (#Develop, VS 2005), Java (Eclipse), C++, QT, PHP, Python
BeitragVerfasst: Fr 20.07.07 12:28 
Nur so kurze Frage:
Mime ist nicht dasselbe wie Base64 oder?

Laut Wikipedia zumindest nicht.
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Fr 20.07.07 13:04 
MIME an sich ist nur ein Standard, der die Übertragung von Daten auf Datenkanälen mit weniger als 8 Bit, sowie die vVerknüpfung von mehreren Datenströmen erlaubt. Z.B. in E-Mails. Siehe RFC 4648.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.