Strings
[ class tree: Strings ] [ index: Strings ] [ all elements ]

Class: STRpasswords

Source Location: /STRpasswords.php

Class Overview

Strings
   |
   --STRpasswords

This class manages STRpasswords objects.


Author(s):

Version:

  • 2.1

Variables

Methods


Inherited Variables

Inherited Methods

Class: Strings

Strings::__construct()
Construction function
Strings::console()
Console function
Strings::IsUTF8()
UTF8 detection function
Strings::QuoteStrip()
Quotes stripping function
Strings::RemoveAccent()
Accents removal function
Strings::RemoveSpaces()
Spaces removal function
Strings::stringHasNumbers()
Numbers detection function
Strings::ToUTF8()
UTF8 conversion function
Strings::ucwordsw()
Special uppercase function

Class Details

[line 35]
This class manages STRpasswords objects.

Created on 04 dec 07

Changes: 2.0 -> 2.1: 28 jul 09 updated: class has been renamed from Passwords() to STRpasswords() file is PEAR compatible added: to package Strings 1.0 -> 2.0: updated: phpdoc compatible in the way to generate documentation




Tags:

author:  Pierre-Dominique Vienne <pvienne@me.com>
version:  2.1
license:  GNU Public License


[ Top ]


Class Variables

$cryptkey =  "6j"

[line 46]

Variable that contains crypt key to encode password



Tags:

access:  protected

Type:   int


[ Top ]

$strength =  0

[line 41]

Variable that contains strength value for a password



Tags:

access:  public

Type:   int


[ Top ]



Class Methods


method crypt [line 409]

string crypt( string $this->value, string $this->cryptkey)

Crypt function

This function is used to crypt strings. Result is returned

  1.  <?php
  2.  $oPasswords        new STRpasswords();
  3.  $oPasswords->value $tocrypt_string;
  4.  echo $oPasswords->crypt();
  5.  // [cryptedstring]
  6.  ?>




Tags:

return:  generated crypted string
since:  version 1.0


Parameters:

string   $this->value   string to be crypted (required)
string   $this->cryptkey   crypt key

[ Top ]

method Decrypt [line 350]

string Decrypt( string $key, string $this->value)

Decrypt function

This function is used to uncrypt datas that must be read by the server by the future, like backups THIS FUNCTION DOES NOT USE STRpasswords::cryptkey . It takes a key as argument. Result is returned

  1.  <?php
  2.  $oPasswords        new STRpasswords();
  3.  $oPasswords->value $crypted_string;
  4.  echo $oPasswords->Decrypt($key);
  5.  // [uncryptedstring]
  6.  ?>




Tags:

return:  generated uncrypted string
since:  version 1.0


Parameters:

string   $this->value   string to be uncrypted (required)
string   $key   crypt key

[ Top ]

method makeRandom [line 230]

string makeRandom( [int $length = 8])

Random password generation function

This function is used to generate random passwords. Result is stored in $this->value and returned

  1.  <?php
  2.  $oPasswords            new STRpasswords();
  3.  echo $oPasswords->makeRandom();
  4.  // w73nd63j
  5.  ?>




Tags:

return:  generated password
since:  version 1.0
usedby:  WBuser::createWBuser()
usedby:  STRpasswords::ReversableCrypt()
usedby:  URLs::OpenOverIP()


Parameters:

int   $length   text to be processed

[ Top ]

method ReversableCrypt [line 284]

string ReversableCrypt( string $this->value)

Reversable crypt function

This function is used to crypt datas that must be read by the server by the future, like backups. THIS FUNCTION DOES NOT USE STRpasswords::cryptkey . It create a key with STRpasswords::makeRandom() Result is returned

  1.  <?php
  2.  $oPasswords        new STRpasswords();
  3.  $oPasswords->value $tobecrypted_string;
  4.  echo $oPasswords->ReversableCrypt();
  5.  // [cryptedstring]
  6.  ?>




Tags:

return:  generated crypted string
since:  version 1.0
uses:  STRpasswords::makeRandom()


Parameters:

string   $this->value   string to be crypted (required)

[ Top ]

method Strength [line 107]

int Strength( string $this->value)

Password strength calculation function

This function is used to measure strength of passwords. Javascript source: http://www.geekwisdom.com/dyn/passwdmeter Result is stored in $this->strength and returned

Password Strength Factors and Weightings

password length: 18 points level 0 (3 point): less than 4 characters level 1 (6 points): between 5 and 7 characters level 2 (12 points): between 8 and 15 characters level 3 (18 points): 16 or more characters

letters: 6 points level 0 (0 points): no letters level 1 (1 points): all letters are lower case level 2 (6 points): letters are mixed case

numbers: 10 points level 0 (0 points): no numbers exist level 1 (5 points): one number exists level 2 (10 points): 3 or more numbers exists

special characters: 10 points level 0 (0 points): no special characters level 1 (5 points): one special character exists level 2 (10 points): more than one special character exists

combinatons: 6 points level 1 (2 points): mixed case letters level 2 (2 points): letters and numbers level 3 (2 points): mixed case letters, numbers and special characters exist

total: 50 points

  1.  <?php
  2.  $oPasswords        new STRpasswords();
  3.  $oPasswords->value "mypassword";
  4.  echo $oPasswords->Strength();
  5.  // 13
  6.  ?>




Tags:

return:  strength of the specified string as a password
since:  version 1.0


Parameters:

string   $this->value   text to be processed (required)

[ Top ]


Documentation generated on Wed, 26 Aug 2009 12:30:48 +0200 by phpDocumentor 1.4.1