Autor Beitrag
Alice
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 120



BeitragVerfasst: Do 24.07.08 20:33 
hi,

wie müsste diese function in delphi aussehen damit diese aus php ankommenden strings
in delphi DEcodiert werden!?

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
     function xor_string($string)
      {
        $buf = '';
        $size = strlen($string);
        for ($i=0; $i<$size; $i++)
          $buf .= chr(ord($string[$i]) ^ 255);
        return $buf;
      }


thx! vom php noob...

cu


Moderiert von user profile iconNarses: Topic aus Delphi4PHP-Technologien verschoben am Do 24.07.2008 um 20:43
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Do 24.07.08 20:45 
Moin!
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
function XOR_String(const S: String): String;
  var
    i: Integer;
begin
  Result := S;
  for i := 1 to Length(Result) do
    Result[i] := Chr(Ord(Result[i]) xor 255);
end;
cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Do 24.07.08 20:46 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
function xor_string(Const aString : String) : String;
Var
  buf : String;
  i, size : IntegeR;

Begin
  buf := '';
  size = Length(aString);
  for i:=1 to size do 
    buf := buf + chr(ord(aString[i]) xor 255);

  result := buf;
end;

bei dem '^' bin ich mir nicht sicher, aber da die Funktion was mit 'XOR_' heißt....

_________________
Na denn, dann. Bis dann, denn.
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Do 24.07.08 21:00 
Moin!

@user profile iconalzaimar: Sowas von dir? buf := buf + chr( :gruebel: :nixweiss:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Do 24.07.08 22:04 
user profile iconNarses hat folgendes geschrieben:
Moin!

Narses, wo bist Du? Es heißt N'ahmnjd.
user profile iconNarses hat folgendes geschrieben:

user profile iconalzaimar: Sowas von dir?

Ach Narses, ich wollte doch nur die Funktion 1:1 in Delphi übersetzen. Übrigens ist das nicht (mehr) langsamer, danke FastMM4. :mrgreen:
Aber das Du mich so :bawling: bloßstellen musst. :eyes: Schnüüf.
:zwinker:

_________________
Na denn, dann. Bis dann, denn.
Tilman
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1405
Erhaltene Danke: 51

Win 7, Android
Turbo Delphi, Eclipse
BeitragVerfasst: Do 24.07.08 22:41 
user profile iconalzaimar hat folgendes geschrieben:
user profile iconNarses hat folgendes geschrieben:
Moin!

Narses, wo bist Du? Es heißt N'ahmnjd.


Lol, da kennst sich aber mal einer (nicht) aus ^^

_________________
Bringe einen Menschen zum grübeln, dann kannst du heimlich seinen Reis essen.
(Koreanisches Sprichwort)
Alice Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 120



BeitragVerfasst: Fr 25.07.08 08:00 
hi,

@alzaimar
@Narses

beide funktionieren :-)
und beide routinen ist in etwa gleich schnell.

jetzt mal eben mit ca. 170kb an daten probiert.

cu and thx!

alice
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Fr 25.07.08 08:22 
user profile iconTilman hat folgendes geschrieben:
Lol, da kennst sich aber mal einer (nicht) aus ^^

Hups, aber der musste einfach sein. Zumal ich einmal mehr mainfestieren musste, das es (wenngleich primitive) Volksstämme ("Berliner") gibt, die etwas mehr Abwechslung in ihren Begrüßungsformen aufweisen. :mrgreen:
Wir begrüßen uns mit
"Hi" (! Intellektuell)
"Ey, Alter" (! Stillvoll)
"Tach auch"
"N'ahmnjd allerseits"
"Na Du alte Kackbratze" (Seit Kurt Krömer)

Ist doch mehr als immer nur
"Moin"
"Moin Moin"

Ich nehme dennoch demütig zur Kenntnis, das es auch andere Begrüßungsformen unabhängig von der Tageszeit gibt. :flehan:

_________________
Na denn, dann. Bis dann, denn.
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Fr 25.07.08 11:50 
Moin!

Um mal wieder etwas OnTopic zu werden :zwinker:

user profile iconAlice hat folgendes geschrieben:
beide funktionieren :-)
und beide routinen ist in etwa gleich schnell.
Das ist auch gar nicht der Punkt, sondern:
user profile iconAlice hat folgendes geschrieben:
jetzt mal eben mit ca. 170kb an daten probiert.
meine Variante ist speicherschonender, da nicht immer wieder bei jedem Zeichen Speicher für eine neue String-Kopie angefordert werden muss. :idea: ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Alice Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 120



BeitragVerfasst: Sa 26.07.08 09:43 
user profile iconNarses hat folgendes geschrieben:
Moin!

user profile iconAlice hat folgendes geschrieben:
beide funktionieren :-)
und beide routinen ist in etwa gleich schnell.
Das ist auch gar nicht der Punkt, sondern:
user profile iconAlice hat folgendes geschrieben:
jetzt mal eben mit ca. 170kb an daten probiert.
meine Variante ist speicherschonender, da nicht immer wieder bei jedem Zeichen Speicher für eine neue String-Kopie angefordert werden muss. :idea: ;)


hi

ja!, stimmt.

jedoch spielte die perf. auch eine rolle,
da jedoch wie schon gesagt beide in etwas gleich schnell sind,
kommt deine routine im einsatz.

trotzdem, mein dank gilt euch beiden!

cu

alice