FORUM HOME | WHUK BLOG   
WEB HOSTING UK AFFORDABLE WEBSITE HOSTING SERVICES IN UNITED KINGDOM
PHP LINUX SHARED HOSTING WINDOWS ASP.NET HOSTING PACKAGES
ECOMMERCE HOSTING ASP MSSQL MS ACCESS ODBC FRONTPAGE HOSTING
CPANEL WHM FANTASTICO RESELLER DEDICATED SERVER WEB HOSTING
CHEAP PLESK CPANEL HTML MYSQL BEST UK VPS HOSTING COMPANY
CHEAP RELIABLE UK HOSTING PROVIDER SINCE 2001
MANAGED WEB HOSTING SERVICE
AFFORDABLE WEBSITE HOSTING SERVICES IN UNITED KINGDOM

Web Hosting UK Forums | Linux Windows Dedicated Server and cPanel VPS Hosting Forum » Web Hosting and Domains » FAQ's / Tutorials.

Reply
 
LinkBack Thread Tools Display Modes

  #1 (permalink)  
Old 10-09-07, 01:10 PM
SBh SBh is offline
Member
 
Join Date: Sep 2007
Posts: 58
Default Random password generator

There are many huge,complex password generator scripts but I have created a simple and small one.

Quote:
echo substr(md5(rand()),0,8);
From this you can generate random passwords. Just change the red number to change the length of the password.

However this has two small limitations:
* Password length cannot be greater than 32 characters
* Though it will be alpha-numeric, the characters will not go beyond 'f' , since they are hex codes.

These limitations doesn't bother in normal cases.
Reply With Quote

  #2 (permalink)  
Old 10-09-07, 04:53 PM
Senior Member
 
Join Date: Jan 2007
Location: Dorset
Posts: 1,119
Default

why not use timestamp?
Reply With Quote

  #3 (permalink)  
Old 10-09-07, 05:11 PM
SBh SBh is offline
Member
 
Join Date: Sep 2007
Posts: 58
Default

Quote:
Originally Posted by jon123 View Post
why not use timestamp?
Once i thought of timestamp, but I thought that rand() will be better because suppose you have a very busy site, and for two users are trying to create random password if this happens within a difference of 1 sec then both will get same password.
You may think of another case where the password is not generated by humans, suppose a script is working and is allotting random password to 1000 different thing(may be users). Now since a script will run very fast hundreds of generated password will be same as those will be generated in a single second.

This problem may be minimized by using micro-second stamp, but rand() will make it foolproof.
Reply With Quote

  #4 (permalink)  
Old 10-09-07, 06:50 PM
Senior Member
 
Join Date: Jan 2007
Location: Dorset
Posts: 1,119
Default

That is a fair point and I suppose that could happen.
TBH I have never used a script that generates many passwords at once, only lost password scripts and the timestamp option i prefer to use. I also don't rely on just password authentication.

I do however create random ids using rand() on one of my sites, but also check the output via a function to make sure that id hasn't been used previously.
Reply With Quote

  #5 (permalink)  
Old 11-09-07, 09:24 AM
paul's Avatar
Senior Member
 
Join Date: Apr 2006
Location: Norway
Posts: 1,788
Default

I realize need of password manager, earlier I used a password manager software but forgot the master password and lost the key file for all my passwords. SBh can that script add the word of choice that you wish to include.?
__________________

Reply With Quote

  #6 (permalink)  
Old 11-09-07, 10:11 AM
SBh SBh is offline
Member
 
Join Date: Sep 2007
Posts: 58
Default

Quote:
Originally Posted by paul View Post
I realize need of password manager, earlier I used a password manager software but forgot the master password and lost the key file for all my passwords. SBh can that script add the word of choice that you wish to include.?
Sorry, I don't understand what are you trying to mean by 'word of choice'. This script is a very simple form of password generator. It will only create random alpha-numeric passwords. This is just the basic idea about it, of course you can modify to add more features.
Reply With Quote

  #7 (permalink)  
Old 11-09-07, 10:27 AM
paul's Avatar
Senior Member
 
Join Date: Apr 2006
Location: Norway
Posts: 1,788
Default

Quote:
Originally Posted by SBh View Post
Sorry, I don't understand what are you trying to mean by 'word of choice'. This script is a very simple form of password generator. It will only create random alpha-numeric passwords. This is just the basic idea about it, of course you can modify to add more features.
Actually I mean can I modify any password which are generated randomly?
__________________

Reply With Quote

  #8 (permalink)  
Old 11-09-07, 03:34 PM
Dan's Avatar
Dan Dan is offline
Got root?
 
Join Date: Aug 2007
Location: England, UK.
Posts: 1,340
Send a message via ICQ to Dan Send a message via AIM to Dan Send a message via MSN to Dan Send a message via Yahoo to Dan Send a message via Skype™ to Dan
Default

It would be good having a password generator showing the MD5 hash and the password being displayed. MD5 is secure though so nothing like that could ever be evolved. It would be good if it could except the security vulnrability's.
Reply With Quote

  #9 (permalink)  
Old 12-09-07, 10:40 AM
paul's Avatar
Senior Member
 
Join Date: Apr 2006
Location: Norway
Posts: 1,788
Default

Quote:
Originally Posted by Dan View Post
It would be good having a password generator showing the MD5 hash and the password being displayed. MD5 is secure though so nothing like that could ever be evolved. It would be good if it could except the security vulnrability's.
Well, I checked with Nuclear Password Storage Pocket PC Edition, they use the combination of MD5, Base64, and DES hashes and Cipher, free to download. I may try to use this one.
__________________

Reply With Quote

  #10 (permalink)  
Old 12-09-07, 05:58 PM
SBh SBh is offline
Member
 
Join Date: Sep 2007
Posts: 58
Default Another function

Code:
function generateCode($characters,$special_char=false) {
		$possible = '1234567890abcdefghijklmnopqrstuvwxyz';
                          if($special_char)
                             $possible .= '!@#$%^&*()_+-=[]{};\':",./\<>?|`~';
		$code = '';
		$i = 0;
		while ($i < $characters) { 
			$code1 = substr($possible, mt_rand(0, strlen($possible)-1), 1);
			if(rand()%2==0)
			 $code1= strtoupper($code1);
			$code .=$code1;
			$i++;
		}
		return $code;
	}
This function will generate alpha-numeric + special character (optional) + upper & lower characters mixed passwords of any desired length.

Suppose to get a 8 character alpha numeric password, call
Code:
generateCode(8);
to get 10 character alpha-numeric with special character password call,
Code:
generateCode(10,true);
I created this code while i was creating random characters for a captcha image.

Last edited by SBh; 12-09-07 at 06:01 PM.
Reply With Quote

  #11 (permalink)  
Old 13-09-07, 10:33 AM
paul's Avatar
Senior Member
 
Join Date: Apr 2006
Location: Norway
Posts: 1,788
Default

Quote:
Originally Posted by SBh View Post
Code:
function generateCode($characters,$special_char=false) {
        $possible = '1234567890abcdefghijklmnopqrstuvwxyz';
                          if($special_char)
                             $possible .= '!@#$%^&*()_+-=[]{};\':",./\<>?|`~';
        $code = '';
        $i = 0;
        while ($i < $characters) { 
            $code1 = substr($possible, mt_rand(0, strlen($possible)-1), 1);
            if(rand()%2==0)
             $code1= strtoupper($code1);
            $code .=$code1;
            $i++;
        }
        return $code;
    }
This function will generate alpha-numeric + special character (optional) + upper & lower characters mixed passwords of any desired length.

Suppose to get a 8 character alpha numeric password, call
Code:
generateCode(8);
to get 10 character alpha-numeric with special character password call,
Code:
generateCode(10,true);
I created this code while i was creating random characters for a captcha image.
Thanks a lot for these addition.
__________________

Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT. The time now is 12:24 PM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Copyright 2001-2010 Web Hosting UK. All rights reserved.
Web Hosting UK Forum





Site Map

Shared Cloud
Shared Cloud From £1

Affiliate Program
Earn up to £300 Per Sale

Dedicated Servers
Dedicated Server Hosting

Cloud Hosting
Cloud Server Hosting

Load Balanced Server
Load Balancing Server

VPS Hosting
Linux VPS Hosting

Windows VPS
Windows 2003 VPS

Zimbra Hosting
Zimbra Email Hosting

cPanel Hosting
Shared Linux Hosting

Windows Hosting
Shared Windows Hosting

Coldfusion Hosting
Windows Coldfusion Hosting

cPanel Reseller Hosting
Reseller Hosting

Windows Reseller
Windows Reseller Hosting

Email Web Hosting
Email Hosting

Semi-Dedicated Server
Semi-Dedicated Hosting

Remote Backup Plans
Offsite Backup Service


cpanel hosting
Knowledgebase Articles

Pre-Sales Question
Web Hosting FAQ's

Dedicated Hosting
Dedicated Server FAQ's

Virtual Private Servers
VPS Hosting

PHP MySQL Hosting
cPanel Hosting

Windows Hosting
ASP MSSQL Hosting

Domain Name
Domain registration FAQ's

CMS Hosting
CMS Hosting FAQ's

Payment Gateways
Payment FAQ's


Support Tutorials

cPanel Tutorials
cPanel Flash Tutorials

Wordpress Tutorials
Wordpress Flash Tutorials

Plesk Tutorials
Plesk Flash Tutorials

PhpMyadmin Tutorials
PhpMyadmin Flash Tutorials

Drupal Tutorials
Drupal Flash Tutorials

Mambo Tutorials
Mambo Flash Tutorials

Joomla Tutorials
Joomla Flash Tutorials

More Hosting Tutorials