PHPackages                             crazy-max/cws-crypto - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. crazy-max/cws-crypto

AbandonedArchivedLibrary[Security](/categories/security)

crazy-max/cws-crypto
====================

PHP class for password hashing with multi encryption methods.

1.8.2(6y ago)83411[1 issues](https://github.com/crazy-max/CwsCrypto/issues)1MITPHPPHP &gt;=5.3.0

Since Aug 22Pushed 6y ago1 watchersCompare

[ Source](https://github.com/crazy-max/CwsCrypto)[ Packagist](https://packagist.org/packages/crazy-max/cws-crypto)[ Docs](https://github.com/crazy-max/CwsCrypto)[ RSS](/packages/crazy-max-cws-crypto/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (1)Versions (6)Used By (1)

[![Latest Stable Version](https://camo.githubusercontent.com/f84173af02e3981d573f1373c508f2d3f520958abcf8014b509da1bbb1c4e470/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6372617a792d6d61782f6377732d63727970746f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/crazy-max/cws-crypto)[![Minimum PHP Version](https://camo.githubusercontent.com/55453b8aba1f0d2c449c2dfa58e6debd503f9d637d2e474960cea8c266371e2f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230352e332e302d3838393242462e7376673f7374796c653d666c61742d737175617265)](https://php.net/)[![Build Status](https://camo.githubusercontent.com/4429da15e4b58e4a587d9077b4e4b430e94767a4bd23f255686949f4fe486ab7/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f636f6d2f6372617a792d6d61782f43777343727970746f2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.com/crazy-max/CwsCrypto)[![Code Quality](https://camo.githubusercontent.com/c59d0fa9720bffbb54c72a0162de563a3afe17e7c28cf596c018bf63f0dc2e33/68747470733a2f2f696d672e736869656c64732e696f2f636f646163792f67726164652f31636131306166396439386534303032616565313635613062313762303632372e7376673f7374796c653d666c61742d737175617265)](https://www.codacy.com/app/crazy-max/CwsCrypto)[![Become a sponsor](https://camo.githubusercontent.com/2b64183536d3742cfdfdbe2a16c7a26ae05e6a3db44e513ff73defdeed344cc1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73706f6e736f722d6372617a792d2d6d61782d3138313731372e7376673f6c6f676f3d676974687562267374796c653d666c61742d737175617265)](https://github.com/sponsors/crazy-max)[![Donate Paypal](https://camo.githubusercontent.com/86518966c73798ed1c862566d92cd4cdd48152e30ab7f42fb7d5138138231d0d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f6e6174652d70617970616c2d3030343537632e7376673f6c6f676f3d70617970616c267374796c653d666c61742d737175617265)](https://www.paypal.me/crazyws)

⚠️ Abandoned project
--------------------

[](#warning-abandoned-project)

This project is not maintained anymore and is abandoned. Feel free to fork and make your own changes if needed.

Thanks to everyone for their valuable feedback and contributions.

About
-----

[](#about)

PHP class for password hashing with multi encryption methods.

Overview
--------

[](#overview)

### The PBKDF2 key derivation function

[](#the-pbkdf2-key-derivation-function)

Defined by RSA's PKCS #5:
This implementation of PBKDF2 was originally created by
With improvements by

### The OpenBSD-style Blowfish-based bcrypt

[](#the-openbsd-style-blowfish-based-bcrypt)

This hashing method is known in PHP as CRYPT\_BLOWFISH.
More infos : [http://www.php.net/security/crypt\_blowfish.php](http://www.php.net/security/crypt_blowfish.php)
This implementation of BCRYPT was originally created by

### Generate random bytes

[](#generate-random-bytes)

A random() function is available to generate secure random bytes with 5 methods :

- [mcrypt\_create\_iv](http://php.net/manual/en/function.mcrypt-create-iv.php)
- [openssl\_random\_pseudo\_bytes](http://php.net/manual/en/function.openssl-random-pseudo-bytes.php)
- [GetRandom](http://msdn.microsoft.com/en-us/library/aa388176%28VS.85%29.aspx) function from CAPICOM Microsoft class
- [/dev/urandom](http://en.wikipedia.org/wiki//dev/random) on Unix systems
- Mix of [microtime](http://php.net/manual/en/function.microtime.php) and [getmypid](http://php.net/manual/en/function.getmypid.php) functions

### Encrypt/Decrypt datas

[](#encryptdecrypt-datas)

There is also a method to encrypt/decrypt data using a symectric encryption string with the blowfish algorithm and an encryption key in CFB mode but please be advised that you should not use this method for truly sensitive data.

Installation
------------

[](#installation)

```
composer require crazy-max/cws-crypto
```

And download the code:

```
composer install # or update
```

Getting started
---------------

[](#getting-started)

See `tests/test.php` file sample to help you.

Example
-------

[](#example)

[![](.res/example.png)](.res/example.png)

Methods
-------

[](#methods)

**hashPassword** - Create a password hash.
**checkPassword** - Check a hash with the password given.
**encrypt** - Generate a symectric encryption string with the blowfish algorithm and an encryption key in CFB mode.
**decrypt** - Return the decrypted string generated from the encrypt method.
**random** - Generate secure random bytes with 5 methods : mcrypt\_create\_iv, openssl\_random\_pseudo\_bytes, GetRandom() from CAPICOM Microsoft class, /dev/urandom on Unix systems or mt\_rand() and getmypid() functions.

**setPbkdf2Mode** - Set the pbkdf2 mode for hashing/check password.
**setBcryptMode** - Set the bcrypt mode for hashing/check password. (default)
**setEncryptionKey** - Set the encryption key for encrypt/decrypt method (max length 56).
**getError** - Get the last error.

How can I help ?
----------------

[](#how-can-i-help-)

All kinds of contributions are welcome 🙌! The most basic way to show your support is to star 🌟 the project, or to raise issues 💬 You can also support this project by [**becoming a sponsor on GitHub**](https://github.com/sponsors/crazy-max) 👏 or by making a [Paypal donation](https://www.paypal.me/crazyws) to ensure this journey continues indefinitely! 🚀

Thanks again for your support, it is much appreciated! 🙏

License
-------

[](#license)

MIT. See `LICENSE` for more details.

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~289 days

Total

5

Last Release

2441d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a2ac50dd173150fc9339728d7b2b1c872b6853111b20e4569844e215f644f632?d=identicon)[crazy-max](/maintainers/crazy-max)

---

Top Contributors

[![crazy-max](https://avatars.githubusercontent.com/u/1951866?v=4)](https://github.com/crazy-max "crazy-max (21 commits)")

---

Tags

bcryptblowfish-algorithmencryption-keyencryption-methodsopenbsd-style-blowfishpbkdf2phprandom-bytesblowfishcryptopasswordpbkdf2bcrypt

### Embed Badge

![Health badge](/badges/crazy-max-cws-crypto/health.svg)

```
[![Health](https://phpackages.com/badges/crazy-max-cws-crypto/health.svg)](https://phpackages.com/packages/crazy-max-cws-crypto)
```

###  Alternatives

[phpseclib/phpseclib

PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.

5.6k455.2M1.5k](/packages/phpseclib-phpseclib)[bordoni/phpass

Portable PHP password hashing framework

244.6M28](/packages/bordoni-phpass)[aplus/crypto

Aplus Framework Crypto Library

171.6M1](/packages/aplus-crypto)[elnur/blowfish-password-encoder-bundle

Blowfish (bcrypt) based password encoder for Symfony2

61129.6k](/packages/elnur-blowfish-password-encoder-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
