Autor Beitrag
Xeron
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 41

WinXP Home, Vista Home Premium 64Bit, Win7 Home Premium
Delphi 3 Prof, Delphi 7 Personal, Delphi 2010 Prof., AutoIt
BeitragVerfasst: Do 28.01.10 17:44 
Hi, ich will ein Passwort Generator basteln. Dieses Passwort soll nur aus Buchstaben bestehen.

Wie kann ich nun erreichen, wenn das Programm A..Z erstellt hat, das es mit AA weiter macht?
Also A..Z, weiter mit AA..ZZ, AAA..ZZZ usw.?

Danke
aksdb
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 29
Erhaltene Danke: 1

Windows 7, ArchLinux
D7 Prof, Kylix 3, Lazarus
BeitragVerfasst: Do 28.01.10 17:51 
Wäre für einen Passwortgenerator nicht Randomize und Random sinnvoll? Eine Liste mit allen Kombinationsmöglichkeiten scheint mir nicht gerade sinnvoll zu sein (abgesehen davon, dass die ziemlich groß wird ;-))
Xeron Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 41

WinXP Home, Vista Home Premium 64Bit, Win7 Home Premium
Delphi 3 Prof, Delphi 7 Personal, Delphi 2010 Prof., AutoIt
BeitragVerfasst: Do 28.01.10 17:56 
Ja, aber Random schafft ja nur Zahlen oder seh ich das Falsch?
ALF
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1085
Erhaltene Danke: 53

WinXP, Win7, Win10
Delphi 7 Enterprise, XE
BeitragVerfasst: Do 28.01.10 18:17 
Festlegen in welchen zahlenbereich, also 65 - 92, sind glaube ich alle GrossBuchstaben.
Dann Zufall generieren und Zahl mit chr(zufallszahl) in Buchstaben wandeln!
Währe die einfachst Möglichkeit

Gruss Alf

_________________
Wenn jeder alles kann oder wüsste und keiner hätt' ne Frage mehr, omg, währe dieses Forum leer!
Xeron Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 41

WinXP Home, Vista Home Premium 64Bit, Win7 Home Premium
Delphi 3 Prof, Delphi 7 Personal, Delphi 2010 Prof., AutoIt
BeitragVerfasst: Do 28.01.10 18:27 
Nein nein, das hat schon alles seine richtigkeit.

ich habe es jetzt so:

ausblenden volle Höhe Delphi-Quelltext
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:
var
  Form1: TForm1;
  s: Char = 'a';

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  OpenDialog1.Execute;
  Edit1.Text := OpenDialog1.FileName;
end;

procedure TForm1.Button2Click(Sender: TObject);
var
  i: Integer;
begin
  for i := 1 to 26 do
  begin
    s := Chr(Ord(s)+1);
    ListBox1.Items.Add(s);
    ProgressBar1.Position := i;
    if i = 26 then
    begin
      ListBox1.Items.Add(s)
    end
 end;
  ProgressBar1.Position := 100;
end;


end.


und jetzt, wenn ich bei z angekommen bin, soll automatisch von vorne begonnen werden, und das Zeichen dan das Zeichen an die ersten 26 Buchstaben gehangen werden.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 28.01.10 18:29 
Du kannst mit Modulo arbeiten. Dann kannst du immer weiterzählen und mit modulo 26 landest du wieder zwischen 0 und 25. Diesen Rest der Division kannst du dann zum Zeichencode vom a addieren um einen Zeichencode zu haben.
Xeron Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 41

WinXP Home, Vista Home Premium 64Bit, Win7 Home Premium
Delphi 3 Prof, Delphi 7 Personal, Delphi 2010 Prof., AutoIt
BeitragVerfasst: Do 28.01.10 18:34 
hmm, versteh ich grade nicht so. modulo = mod oder

kannste mal ein ganz kurzes Beispiel zeigen? Danke ;)
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 28.01.10 18:38 
ausblenden Delphi-Quelltext
1:
2:
for i := 0 to 100 do
  ShowMessage(Chr(Ord('a') + i mod 26));
Xeron Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 41

WinXP Home, Vista Home Premium 64Bit, Win7 Home Premium
Delphi 3 Prof, Delphi 7 Personal, Delphi 2010 Prof., AutoIt
BeitragVerfasst: Do 28.01.10 18:41 
dann wird aber immer wieder von vorne gezählt. ich will aber das das Zeichen an das andere Zeichen drangehängt wird.
Also so:

a
b
c
..
x
y
z
aa
ab
ac
..
az
aaa
..
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Do 28.01.10 18:44 
Spätestens, wenn du auch Sonderzeichen haben willst, könnte das mit mod aber problematisch werden.

Hab mir auch mal nen Passwortgenerator gebaut. Hab das da so gelöst, dass ich einen String hatte, wo alle verwendbaren Zeichen drinstehen s := 'asDFgH'; , und dann mit random(length(s)) ein beliebiges Zeichen daraus ausgewählt habe.

_________________
PROGRAMMER: A device for converting coffee into software.
ALF
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1085
Erhaltene Danke: 53

WinXP, Win7, Win10
Delphi 7 Enterprise, XE
BeitragVerfasst: Do 28.01.10 18:51 
user profile iconXeron
Zitat:
ich will aber das das Zeichen an das andere Zeichen drangehängt wird.

und wann willst Du aufhören? Ich sehe da sonst keine Ende!!!!

Gruss Alf

_________________
Wenn jeder alles kann oder wüsste und keiner hätt' ne Frage mehr, omg, währe dieses Forum leer!
Xeron Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 41

WinXP Home, Vista Home Premium 64Bit, Win7 Home Premium
Delphi 3 Prof, Delphi 7 Personal, Delphi 2010 Prof., AutoIt
BeitragVerfasst: Do 28.01.10 19:04 
naja, so nach 10-12 Zeichen
also z.B.

aghtfifnhdg
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Do 28.01.10 19:05 
user profile iconALF hat folgendes geschrieben Zum zitierten Posting springen:
user profile iconXeron
Zitat:
ich will aber das das Zeichen an das andere Zeichen drangehängt wird.

und wann willst Du aufhören? Ich sehe da sonst keine Ende!!!!

Gruss Alf


kann man ja in einer Schleife festlegen, oder. ;)

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
ALF
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1085
Erhaltene Danke: 53

WinXP, Win7, Win10
Delphi 7 Enterprise, XE
BeitragVerfasst: Do 28.01.10 19:12 
Aber so wie er es machen will hatt es nichts mit einen PWgenerator zu tuen!?
oder seh ich das Falsch :shock:

Gruss Alf

_________________
Wenn jeder alles kann oder wüsste und keiner hätt' ne Frage mehr, omg, währe dieses Forum leer!
Xeron Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 41

WinXP Home, Vista Home Premium 64Bit, Win7 Home Premium
Delphi 3 Prof, Delphi 7 Personal, Delphi 2010 Prof., AutoIt
BeitragVerfasst: Do 28.01.10 19:15 
Ich hätte eine neue Idee.
Ginge es mit einer Goto Anweisung?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
procedure TForm1.Button2Click(Sender: TObject);
var
  i: Integer;
  Label Sprung;
begin
  Sprung:
  for i := 1 to 26 do
  begin
    s := Chr(Ord(s)+1);
    ListBox1.Items.Add(s);
    ProgressBar1.Position := i;
    if i = 26 then
    begin
      Goto Sprung;
      ListBox1.Items.Add(s)
    end
 end;
  ProgressBar1.Position := 100;
end;


oder irgendwie so
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Do 28.01.10 19:21 
du weißt das du damit eine endlosschleife erzeugen würdest?

lg elundril

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
Xeron Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 41

WinXP Home, Vista Home Premium 64Bit, Win7 Home Premium
Delphi 3 Prof, Delphi 7 Personal, Delphi 2010 Prof., AutoIt
BeitragVerfasst: Do 28.01.10 19:22 
ja, auch grade gemerkt.

Naja, gibt irgendeinen Befehl um 2 Char Typen zusammen zu kopieren wie
etwa s := s + s;
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Do 28.01.10 19:23 
user profile iconXeron hat folgendes geschrieben Zum zitierten Posting springen:
ja, auch grade gemerkt.

Naja, gibt irgendeinen Befehl um 2 Char Typen zusammen zu kopieren wie
etwa s := s + s;

Probier diese eine Zeile mal bitte aus...
Aber das Ergebnis passt nicht mehr in einen Char, da es ja zwei Zeichen sind. Also musst du nen String nehmen.

_________________
PROGRAMMER: A device for converting coffee into software.
Xeron Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 41

WinXP Home, Vista Home Premium 64Bit, Win7 Home Premium
Delphi 3 Prof, Delphi 7 Personal, Delphi 2010 Prof., AutoIt
BeitragVerfasst: Do 28.01.10 19:43 
ok, habs jetzt so halbwegs.
Wie kann ich jetzt aber einen Char in einen String umwandeln?

c := String(s);

geht ja irgendwie nicht

und einfach c := s auch nicht
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Do 28.01.10 19:46 
Aus der Benennung deiner Variablen schließe ich, dass du links und rechts vom Gleichheitszeichen vertauschst..

Und noch was: Bitte gewöhn dir an, statt "geht nicht" direkt die Fehlermeldung mitzuposten.

_________________
PROGRAMMER: A device for converting coffee into software.