GithubHelp home page GithubHelp logo

isabella232 / text_password Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pear/text_password

0.0 0.0 0.0 50 KB

Home Page: http://pear.php.net/package/Text_Password

License: MIT License

PHP 100.00%

text_password's Introduction

Text_Password

Class that provides various types of password generation.

Usage

Generating passwords is a very common task in web applications. This package provides an easy-to-use and intuitive API to generate:

  • pronounceable passwords
  • unpronounceable passwords
  • passwords based on a given string

For the last point, multiple, simple obfuscation algorithms are supported.

Creating a Pronouncable Password

<?php

require_once 'Text/Password.php';

// Create pronouncable password of 10 characters.
echo Text_Password::create() . "\n";

// Create 3 different pronouncable passwords of length 8.
print_r(Text_Password::createMultiple(3, 8));

?>

Creating an Unpronouncable Password

<?php

require_once 'Text/Password.php';

// Create unpronounceable password of length 8 with a, b, and c as
// possible characters.
echo Text_Password::create(8, 'unpronounceable', 'abc') . "\n";

// Create 4 different unpronounceable passwords of length 10.
print_r(Text_Password::createMultiple(4, 10, 'unpronounceable'));

// Creating unpronounceable password of 8 chars with only alphanumeric
// characters. Other classes that can be specified are 'numeric', 'alphabetic'
// and '' for all characters.
echo Text_Password::create(8, 'unpronounceable', 'alphanumeric') . "\n";

?>

Creating passwords based on a given string:

<?php

require_once 'Text/Password.php';

// Create password from login 'olivier', type is 'reverse'. Other supported
// types are:
//
// - 'rot13'
// - 'rotx'
// - 'rotx++',
// - 'rotx--',
// - 'xor',
// - 'ascii_rotx',
// - 'ascii_rotx++',
// - 'ascii_rotx--',
// - 'shuffle',
echo Text_Password::createFromLogin('olivier', 'reverse') . "\n";

// Create multiple passwords from array of logins.
$logins = array('olivier', 'martin', 'vanhoucke', 'jansen');
print_r(Text_Password::createMultipleFromLogin($logins, 'reverse'));

?>

Installation

PEAR

pear install Text_Password

Composer

./composer.phar require pear/text_password

Links

text_password's People

Contributors

mj avatar gauthierm avatar clockwerx avatar till avatar remicollet avatar yendrzei avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.