Skip to content

alexandrumos/cracklib_php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

#cracklib_php Author: Alexandru Mos

CrackLib PHP is made to provide a quick interface for the cracklib-check binary. Checks if a password is good enought to use it. Includes a helper for Code Igniter.

Usage

How to use it:

<?php

    require_once 'cracklib.php';

    $check_result = cracklib_check('some_password');

    var_dump($check_result);

?>

This example will output:

array(3) {
  ["good_password"]=>
  int(1)
  ["status_code"]=>
  int(1)
  ["cracklib_msg"]=>
  string(2) "OK"
}

The cracklib_check function always returns an asociative array containing:

  • good_password (int): 1 if the password is safe enough and can be used, 0 otherwise;
  • status_code (int): 1 if the password can be used, 10 to 15 to signal various statuses (explained under);
  • cracklib_msg (string): ok if the password can be used, otherwise explains the problem with the password;

Status codes

Here are all the status codes explained:

  • 1: the password is ok and can be used;
  • 10: it does not contain enough different characters;
  • 11: it is very short;
  • 12: it is too short;
  • 13: it is too simple;
  • 14: it is based on a dictionary word;
  • 15: unknown problem with the password.

About

A simple PHP wrapper over cracklib-check app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages