<pedrocorreia.net ⁄>
 

<PHP Create Strong Random Passwords ⁄ >




clicks: 3479 3479 2006-09-09 2006-09-09 goto programacao myNews programacao  Bookmark This Bookmark This


Site security is a high priority for any developer. With the number of attacks that sites are getting it is vital that we secure them to the best of our and our technologies ability. One of the main issues with security is user passwords. If our users pick overly simple passwords then there data and ours can be at risk. Having password rules is one way of ensuring that our users will select strong passwords. We can require a specific length and combination of characters and numbers including capitalization requirements.

While it's sometimes difficult to explain these requirements to a user and get them to enter something that fits the criteria it can also be troublesome to create these passwords programmatically. To that end I propose this PHP function to create a password based on very specific rules. The "Mask" that you use to define the password rules is fairly simple with only 5 entities to know. See the comments in the code to understand the rules.

By creating a password with these options you can verify that all auto-generated passwords will match a certain criteria. Here is the PHP code necessary to create this kind of password:

An addition that you may want to make is the ability to have a variable length password. For instance a password could be between 6 and 15 characters you would have to decide how to make the function handle this. It could either have a 15 character mask and cut short at whatever length you decided on, or perhaps you could use a 6 character mask and have it start the pattern over for longer passwords. Usually autogenerated passwords are of a fixed length though so It's not a necessary feature.



este é só um excerto do artigo, para aceder ao artigo completo, clique no link em baixo:
this is just a small excerpt from the article, to access the full article please click in the link below:

http://www.bestcodingpractices.com/php_create_strong_random_passwords-...




Subscribe News RSS  Subscribe News Updates by E-mail





myNews <myNews show="rand" cat="programacao" ⁄>

RouterJs: easy routing for your ajax Web applications new ...

RouterJs is a simple router for your ajax web apps. It's build upon History.js which means that Rout (...)

clicks: 16472 16472 2012-05-14 2012-05-14 goto url (new window) haithembelhaj.g... goto myNews programacao


Backbone computed properties new ...

This gist shows one way to implement read- and write-enabled computed properties on a Backbone Model (...)

clicks: 16320 16320 2012-05-13 2012-05-13 goto url (new window) https://gist.gi... goto myNews programacao


HTML5 jQuery Paint Plugin new ...

Websanova Paint is a HTML5 canvas based jQuery plugin. It allows you to free paint on a canvas area (...)

clicks: 27104 27104 2012-05-12 2012-05-12 goto url (new window) websanova.com/t... goto myNews programacao


Android Query new ...

Android-Query (AQuery) is a light-weight library for doing asynchronous tasks and manipulating UI el (...)

clicks: 16523 16523 2012-05-12 2012-05-12 goto url (new window) code.google.com... goto myNews programacao


Create Instagram Filters With PHP new ...

In this tutorial, I'll demonstrate how to create vintage (just like Instagram does) photos with PHP (...)

clicks: 16009 16009 2012-05-12 2012-05-12 goto url (new window) net.tutsplus.co... goto myNews programacao


Real-time Applications With Node.js and Socket.IO new ...

Hey everyone! Sorry about the long pause since the last blog post, life has been quite hectic for th (...)

clicks: 16387 16387 2012-05-11 2012-05-11 goto url (new window) codingcookies.c... goto myNews programacao


Sass vs. LESS vs. Stylus: Preprocessor Shootout new ...

CSS3 preprocessors are languages written for the sole purpose of adding cool, inventive features to (...)

clicks: 15712 15712 2012-05-11 2012-05-11 goto url (new window) net.tutsplus.co... goto myNews programacao


Gettings to know Backbone.ks new ...

In this series, we're going to learn how to build a fully functional contacts manager using Backbone (...)

clicks: 15271 15271 2012-05-10 2012-05-10 goto url (new window) net.tutsplus.co... goto myNews programacao