Topic: Password Generator

Thanks to Dmitry we have password strength meter...


It'd be great to add password generator to it too.
Attached sample project generated passwords are displayed in read only edit fields instead of a memo field. Reason for this is to be able to add various attributes to individual generated passwords.


--------

Post's attachments

Attachment icon 05 PSM + PWGen.zip 11.61 kb, 430 downloads since 2017-04-23 

Adam
God... please help me become the person my dog thinks I am.

Re: Password Generator

See this example I did
https://mega.nz/#!xMxxSLqS!NPhN5p8o8uh9 … KpyIfreIQQ

Domebil

Re: Password Generator

Hi domebil,


It's a nice pw gen app but you gave only binaries... there is no source as far as I can see..

Adam
God... please help me become the person my dog thinks I am.

Re: Password Generator

Here are some portable programs you can see:

http://www.winpenpack.com/main/download.php?view.1297

http://www.programmigratis.it/sicurezza … -portable/

http://keepass.info/download.html

Domebil

5 (edited by AD1408 2017-04-24 07:42:53)

Re: Password Generator

Thanks domebil, but I'm not looking for compiled binaries. I need the script/code so that I can implement/modify it in my own MVD (and most likely other MVD users in their own) application.

Adam
God... please help me become the person my dog thinks I am.

Re: Password Generator

AD1408 wrote:

Thanks to Dmitry we have password strength meter...


It'd be great to add password generator to it too.
Attached sample project generated passwords are displayed in read only edit fields instead of a memo field. Reason for this is to be able to add various attributes to individual generated passwords.


--------


? ... Please...........
Sample project on post #1

Adam
God... please help me become the person my dog thinks I am.

Re: Password Generator

I found some Delphi code on the Net.. Perhaps somebody can translate MVD or do something with it.


From: https://delphindo.wordpress.com/2009/04 … generator/

Tricks generate random passwords of a certain length
To generate random text, you need to specify the length of text to be generated. With SetLength () you can adjust the length of a string dynamically. If the password length you specify, the next step of each character in the password is determined randomly by using the Random () function. The output of the Random () function is used to perform a look-up to a list of allowed characters to become password characters. The function parameter Random () we fill with the number of characters allowed as password characters.

The following is the full source code of the TPasswordGenerator class that wraps the random password generation functionality of a certain length.

unit paswgen;

interface
uses classes;

const
  CHAR_ALPHANUM='ABCDEFGHIJKLMNOPQRSTUVWXYZ'+
                           'abcdefghijklmnopqrstuvwxyz'+
                           '0123456789';
  CHAR_ALPHA='ABCDEFGHIJKLMNOPQRSTUVWXYZ'+
                     'abcdefghijklmnopqrstuvwxyz';
  CHAR_NUMERIC='0123456789';

type
  TPasswordGenerator=class(TObject)
  private
    FMaxChar: word;
    FPassword: string;
    FCharacter: string;
    procedure SetMaxChar(const Value: word);
    procedure SetCharacter(const Value: string);
  public
    constructor Create;
    procedure Generate;

    //password
    property Password:string read FPassword;
    //karakter yang diijinkan
    property Character:string read FCharacter write SetCharacter;
    //panjang password
    property MaxChar:word read FMaxChar write SetMaxChar;
  end;

implementation


{ TPasswordGenerator }

constructor TPasswordGenerator.Create;
begin
  FMaxChar:=8;
  SetLength(FPassword,FMaxChar);
  FCharacter:=CHAR_ALPHANUM;
end;

procedure TPasswordGenerator.Generate;
var i,indx:word;
begin
  SetLength(FPassword,FMaxChar);
  for i:=1 to FMaxChar do
  begin
    indx:=random(length(FCharacter))+1;
    FPassword[i]:=FCharacter[indx];
  end;
end;

procedure TPasswordGenerator.SetCharacter(const Value: string);
begin
  FCharacter := Value;
end;

procedure TPasswordGenerator.SetMaxChar(const Value: word);
begin
  FMaxChar := Value;
end;

initialization
Randomize;
end.
Adam
God... please help me become the person my dog thinks I am.

Re: Password Generator

Thought I would take a stab at it.

Post's attachments

Attachment icon Password Gen.zip 581.07 kb, 420 downloads since 2017-05-11 

Re: Password Generator

ehwagner wrote:

Thought I would take a stab at it.


Hi EHW,


Thank you very much..........................
Nice start.


Here is what I'm trying to do (please see the attachment) but unable to do so - beyond my current knowledge. Perhaps Dmitry can give us hand too.

Post's attachments

Attachment icon Password Gen 2.zip 7.26 kb, 381 downloads since 2017-05-11 

Adam
God... please help me become the person my dog thinks I am.

Re: Password Generator

Adam,  see if the attached gets you closer. I changed the design slightly. Instead of having a finite number of Password and Used fields, I created a child table and used a tablegrid to maintain the generated passwords. This way you are not limited to 10 passwords. It required some extra coding for updating and canceling updates on one form, but you are not restricted to the number of generated passwords. The "Generate Passwords" button will generate the number of passwords based on the Quantity field on the form and display in the tablegrid. It's an editable grid so you can type in the Used fields directly in the grid.


I'm not sure why you have options for the properties of the password. I would think that you would want the strongest password with all the properties present, but not really knowing what this project will eventually be used for, I went ahead and accommodated for the various choices. The only option I did not account for was the "No similar characters". I wasn't exactly sure what that meant and what the algorithm would be. You can add to or remove from the punctuations(symbols) allowed by changing the string called "Punctuation" in the script.


Hopefully this helps.

Post's attachments

Attachment icon Password Gen 2 Revised.zip 590.22 kb, 446 downloads since 2017-05-14 

Re: Password Generator

Thank you soooooooo much EHW....................
Great Stuff..... truly appreciated............


Using editable tGRid instead of edit fields is a better approach. One reason I didn't use editable tGrid is that I didn't know limiting edit columns were possible or not as I wanted only 'Used' column to be editable. However, it's not a show stopper.


My intention of using 'Save' plus 'Save and Close' buttons was:
When user clicks on 'Save' button generated passwords are saved as a set, all fields and tGrid cleared except quatity and checkboxes so that it's ready to generate next passwords set.   'Save and Close' button saves generated passwords set and closes frmPwGen. I think it's my bad that I didn't make it clear. However, it's not big deal. It's fine with just usual save and close button.
I couldn't understand that as to why you have used dummy save button which saves the record before user clicks on save or save and close buttons?


'No similar characters' checkbox meant for not having same characters within same password, all characters would be unique within same password. Again, it's not that important as your code generates strong passwords with already applied properties. Nice work,  I'll take that option out.
On checkboxes I have another miss. I wanted all password construction properties checkboxes default state checked but I forgot to apply it on sample project. I changed them on MVD properties checked to true but it didn't work as they seems to be tied in within the code. Tried some alterations in code but no success.

Adam
God... please help me become the person my dog thinks I am.

Re: Password Generator

Since you had two save buttons on the form, I didn't know if you had something special planned for them. You can remove the dummy save button and replace line 89 in the script with

frmPwGen.Button3.Click;

The default state set to true for the checkbox properties works on my end. Script is not doing anything with the checkbox properties. Keep in mind that the default state is only for new record state (in your case a new set).

Re: Password Generator

Hi EHW,


At my end I cannot get checkboxes checked on running app. Please see image below as ref. Most likely I'm missing something?
https://s30.postimg.org/m0gt6rh9t/zzzzz_Temp30.png


On save front, I really don't want auto save. Save should be done when user wants to save by clicking on save button as they may be doing some test pw generations and they wouldn't want to save every test etc. Please don't misunderstand me. I'm not complaining. In fact I'm truly grateful for your all kind help. Would it be possible within your limited time to take of auto-save please?
So record is not saved after clicking on "generate passwords" button but after user clicks on "save" button - in this case button3.

Adam
God... please help me become the person my dog thinks I am.

Re: Password Generator

That's not the default checkbox. The following checkbox should be checked.
https://s14.postimg.org/4idsfeze9/Check_Box_Default.jpgimage hostingcertificity.com


In the attached project the default checkboxes are checked. Also the checkboxes validation was corrected.


The reason for the auto save is because in order to save the child records (generated passwords) the main record needs to be saved for NEW main records (password set in your case). But in my project the user does not know that it was saved. So, for instance, if the user wants to add a new set and generates the passwords and then decides they want to cancel, then the cancel button will remove the password records and the main record and everything is back to where it was before the new password set was requested.  Even on password sets that exists, if you click the generate button and then decide not to save them, the cancel button will remove the newly generated passwords. In other words, the save and cancel buttons to the end user function just like normal. Try it out. You'll see what I mean.

Post's attachments

Attachment icon Password Gen 2 Corrected.zip 590.49 kb, 458 downloads since 2017-05-15 

Re: Password Generator

Thank you very much EHW...............
Nice one..............
I also thank you for showing (code) how to avoid saving blank records where child records involved by clicking on cancel.

Adam
God... please help me become the person my dog thinks I am.