AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Umwandlung charkombination nach integer

Ein Thema von qwertz543221 · begonnen am 2. Sep 2009 · letzter Beitrag vom 4. Sep 2009
Antwort Antwort
qwertz543221
(Gast)

n/a Beiträge
 
#1

Re: Umwandlung charkombination nach integer

  Alt 2. Sep 2009, 20:59
ok geht danke
hier das bisherige
Delphi-Quellcode:
function tform1.rsaenc(text:ansistring;n:ansistring):ansistring;
var
l:int64;
wa,zahl:ansistring;
begin
result:='';
mathe:=tmathe.Create;
l:=length(text);
while l mod 4 <>0
  do
  begin
  text:=text+chr(0);
  l:=length(text)
  end;
  i:=1;
  while i<=l do
begin
application.ProcessMessages;
if i mod 4 =0
    then
    begin
   // wa:=mathe.summe(mathe.produkt(inttostr(ord(text[i])),'256'),inttostr(ord(text[i+1])));
    wa:=inttostr(combtonum(text[i-3]+text[i-2]+text[i-1]+text[i]));
    wa:=mathe.PotenzModulo(wa,e,n);
    zahl:=wa;
   if length(zahl)<length(n)
      then
        while length(zahl)<>length(n) do
        zahl:='0'+zahl;
 result:=result+zahl;
  end;
 inc(i);
end;
end;

function tform1.rsadec(text:ansistring;d,n:ansistring):ansistring;
var
i:int64;
wa,z1,z2,z3,m_1,m_2,m,h:ansistring;
zahl:ansistring;

begin
result:='';
m_1:='0';
m_2:='0';
m:='0';
h:='0';
mathe:=tmathe.Create;
i:=1;
{
//chinesischer Restsatz:=>Fehlerhaft!!!
      dp:=modinvers(e,mathe.Differenz(p,'1'));
      dq:=modinvers(e,mathe.Differenz(q,'1'));
       qinv:=modinvers(p,q);     }

 while i<=length(text) do
  begin
  application.ProcessMessages;
  zahl:=copy(text,i,length(n));
  wa:=zahl;
  wa:=mathe.PotenzModulo(wa,d,n);


    //result:=result+chr(strtoint(mathe.Quotient(wa,'256')))+chr(strtoint(mathe.Modulo(wa,'256')));
  result:=result+numtocomb(strtoint(wa));
  i:=i+length(n)
  end;
   end;

function TForm1.numtocomb(num:longint):string;
var b1,b2,b3,b4:char;
begin
result:='';
b1 := Chr(num shr 24);
b2 := Chr(num shr 16 and $000000FF);
b3 := Chr(num shr 8 and $000000FF);
b4 := Chr(num and $000000FF);
result:=b1+b2+b3+b4;
end;


function TForm1.combtonum(comb:string):longint;
begin
result:=Ord(comb[1]) shl 24 or Ord(comb[2]) shl 16 or Ord(comb[3]) shl 8 or Ord(comb[4])
end;
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 04:42 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz