Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2004
    Posts
    5

    How-to md5 hash passwords

    I'm using AMS6 and want to have password authenticate on open.

    I have successfully used the following code on my opening page (in the page on show script)

    -------------

    --assume the user enters a bad password
    correct_password = false;

    -- the 'correct' password
    real_passwords = {"123", "3333", "aa"};

    -- prompt the user to enter a password
    user_password = Dialog.PasswordInput("Password", "Please enter the password: ", MB_ICONQUESTION);

    -- compare the user's password to the 'correct' password.
    for j in real_passwords do
    if real_passwords[j] == user_password then
    correct_password = true;
    end
    end

    --if the password was bad, exit
    if not correct_password then
    Application.Exit();
    end

    -------------

    What I'd like to do is have up to 100 md5 hash passwords instead of regular passwords. As I understand it, this is better for security since the passwords are not visible in the code.

    How would I go about doing this? I do not need to have a username... just an 8-digit password (that I will convert to md5).

  2. #2
    Join Date
    Feb 2001
    Location
    Indigo Rose Software
    Posts
    2,728
    Calculate MD5 values for each of your real passwords, and store those MD5 values in your script. Do not put the real password in the script anywhere at all.

    When the user enters a password, calculate the MD5 value for it, and then compare that MD5 value against the MD5 values stored in the script.

    If two MD5 values match, the data that the MD5 values were created from match as well.

    You can use the Crypto.MD5DigestFromString action to calculate the MD5 values.
    --[[ Indigo Rose Software Developer ]]

  3. #3
    Join Date
    Jul 2004
    Posts
    5

    still not getting it...

    Thanks Lorne,

    But I still don't get it. I'm a copy and paste kind of guy - sorry...

    I do have a list of passwords that I generated. I have them converted to md5 and ready to paste into the code.

    But what "code" do I use to list them?

    In my sample above, there is a place for the "real passwords". Is this where I would list the md5 passwords?

    Perhaps you or another member could help me out and provide a sample of the code I should use on my first page on show event.

    Thanks so much...

  4. #4
    Join Date
    Jul 2004
    Posts
    5

    Grin Any sample code?

    I'm sorry to be a pest...

    But, would anybody happen to have a sample of code that uses md5 to authenticate login?

    I'd like to have multiple md5 passwords included in the login code.

    It's my understanding that using md5 is more secure than regular passwords because they are encoded. Is this correct?

    Your assistance is greatly appreciated - thanks.

  5. #5
    Join Date
    Feb 2001
    Location
    Indigo Rose Software
    Posts
    2,728
    Code:
    --assume the user enters a bad password
    correct_password = false;
    
    -- the 'correct' password
    --real_passwords = {"123", "3333", "aa"};
    
    -- MD5 values for "123", "3333", "aa"
    real_passwords = {"202cb962ac59075b964b07152d234b70", "2be9bd7a3434f7038ca27d1918de58bd", "4124bc0a9335c27f086f24ba207a4912"};
    
    -- prompt the user to enter a password
    user_password = Dialog.PasswordInput("Password", "Please enter the password: ", MB_ICONQUESTION);
    
    -- calculate the MD5 value from what they entered
    user_password = Crypto.MD5DigestFromString(user_password);
    
    -- compare the user's password to the 'correct' password.
    for j in real_passwords do
    	if real_passwords[j] == user_password then
    		correct_password = true;
    	end
    end
    
    --if the password was bad, exit
    if not correct_password then
    	Application.Exit();
    end
    --[[ Indigo Rose Software Developer ]]

Similar Threads

  1. [Script] MD5 Verification
    By ryanc in forum Visual Patch 2.0
    Replies: 6
    Last Post: 07-12-2007, 02:37 PM
  2. wondering about passwords
    By CKDA in forum AutoPlay Media Studio 6.0
    Replies: 1
    Last Post: 04-03-2006, 07:34 PM
  3. where is the md5 plugin gone ??!!!
    By aviranak in forum AutoPlay Media Studio 6.0
    Replies: 2
    Last Post: 12-30-2005, 09:40 AM
  4. Function : Validate String (Great for passwords, etc.)
    By Corey in forum AutoPlay Media Studio 5.0 Examples
    Replies: 3
    Last Post: 04-28-2005, 02:42 AM
  5. passwords
    By mczajka in forum Setup Factory 5.0
    Replies: 1
    Last Post: 11-14-2000, 12:42 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts