PHPackages                             icyapril/cryptolib - 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. icyapril/cryptolib

ActiveLibrary[Security](/categories/security)

icyapril/cryptolib
==================

CryptoLib: secure, free &amp; open-source PHP cryptography library for everyone.

1.0.1(9y ago)3458.6k↓28.3%12[1 issues](https://github.com/IcyApril/cryptolib/issues)[1 PRs](https://github.com/IcyApril/cryptolib/pulls)1AGPLPHPPHP &gt;5.5.0CI passing

Since Feb 13Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/IcyApril/cryptolib)[ Packagist](https://packagist.org/packages/icyapril/cryptolib)[ Docs](https://cryptolib.ju.je)[ RSS](/packages/icyapril-cryptolib/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (1)

[![Build Status](https://camo.githubusercontent.com/68e1a48150ecb0f4f6fba61ff23995f665332f48536b372009c27e847163dd37/68747470733a2f2f7472617669732d63692e6f72672f496379417072696c2f43727970746f4c69622e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/IcyApril/CryptoLib)[![Code Climate](https://camo.githubusercontent.com/f9362d6182e6389a578547c5fbc02ee226670482a0db046cd5cc8b0fd424291a/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f496379417072696c2f43727970746f4c69622f6261646765732f6770612e737667)](https://codeclimate.com/github/IcyApril/CryptoLib)[![Issue Count](https://camo.githubusercontent.com/1cfda1553d750284fbb75db59bffcb1091f5a341867d5f3aad6d402398cd5e23/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f496379417072696c2f43727970746f4c69622f6261646765732f69737375655f636f756e742e737667)](https://codeclimate.com/github/IcyApril/CryptoLib)

\#CryptoLib v2

CryptoLib: secure, free &amp; open-source PHP cryptography library for everyone. It makes it easy for those who would usually implement incredibly weak cryptography to include secure cryptographic functions to secure passwords, data and generate secure random data.

CryptoLib boasts:

- Secure pseudorandom number/hex/string generator with repeatability checker
- Salted PBKDF2 hashing using alternations between SHA512 and Whirlpool
- Two-way cascading encryption using Rijndael 256, Twofish and Serpent

CryptoLib requires PHP 7.2.0+ (with OpenSSL). You should always keep your Cryptography plugins up-to-date.

Check out the documentation at:

Examples
--------

[](#examples)

Encrypting and decrypting text:

```
$encrypted = \IcyApril\CryptoLib::encryptData("test data", "test key");
$decrypted = \IcyApril\CryptoLib::decryptData($enc, "test key");
```

Secure random data generation:

```
$string = \IcyApril\CryptoLib::randomString(5);
$number = \IcyApril\CryptoLib::randomInt(0, 4096);
$hex = \IcyApril\CryptoLib::randomHex(256);
```

Hash string and validate:

```
$hash  = \IcyApril\CryptoLib::hash("test");
$valid = \IcyApril\CryptoLib::validateHash($hash, "test");
```

Why I Made It
-------------

[](#why-i-made-it)

"We have technology but lack philosophy"; this saying holds true in the world of cryptography when merged with PHP. As a software engineer, working with PHP day-in day-out; it is apparent that unskilled developers still implement cryptographic function unsafely in PHP. Whether it is people hashing passwords without salts, weak random number generation or even encryption systems using weak ciphers. Yes, some may hold the view that PHP Developers are not best equipped for this issue, which is why I built CryptoLib. CryptoLib provides cryptographic functions with a degree of security that is exceptional and unique for any single library to be called with just a single line of simple code. CryptoLib exists to make it easy for people to ensure their cryptographic functions in PHP, for example hashing passwords to store them in a database, hold a reasonable degree of cryptographic safety. This class makes this technology accessible to all, whether developers will lift their heads out of the darkness and take advantage of it is another matter.

Version log
-----------

[](#version-log)

- v0.8 Christmas - Initial version, released on Christmas day 2014.
- v0.9 Converging - Documentation updates, released 28th December 2014.
- v1.0 Conqueror - Finally getting around to marking this as v1.
- v2.0 Calescence - Replaced mcrypt with openssl.

Warning
-------

[](#warning)

No encryption system can make something impossible to crack, it can make this very (very, very, very) difficult to crack; cryptography is about creating a puzzle which is mathematically harder to solve than create. This applies to everything cryptographic and this library is no exception, always be careful with encryption when people's lives are on the line.

CryptoLib is version 0.8, this is not nessecarily the finalised code, despite my efforts to ensure it is secure; always be cautious when using it. Also please note that CryptoLib does not guarantee your server is secure.

Terms
-----

[](#terms)

CryptoLib is an open-source PHP Cryptography library. Copyright (C) 2014 Junade Ali

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see .

### Note

[](#note)

You are required to keep attribution notices to the original author intact.

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance53

Moderate activity, may be stable

Popularity41

Moderate usage in the ecosystem

Community17

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~0 days

Total

2

Last Release

3382d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2026099?v=4)[Junade](/maintainers/IcyApril)[@IcyApril](https://github.com/IcyApril)

---

Top Contributors

[![darovic](https://avatars.githubusercontent.com/u/2281064?v=4)](https://github.com/darovic "darovic (16 commits)")[![IcyApril](https://avatars.githubusercontent.com/u/2026099?v=4)](https://github.com/IcyApril "IcyApril (13 commits)")[![udf2457](https://avatars.githubusercontent.com/u/6958684?v=4)](https://github.com/udf2457 "udf2457 (5 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/icyapril-cryptolib/health.svg)

```
[![Health](https://phpackages.com/badges/icyapril-cryptolib/health.svg)](https://phpackages.com/packages/icyapril-cryptolib)
```

###  Alternatives

[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M214](/packages/defuse-php-encryption)[mews/purifier

Laravel 5/6/7/8/9/10 HtmlPurifier Package

2.0k16.7M113](/packages/mews-purifier)[robrichards/xmlseclibs

A PHP library for XML Security

41478.1M118](/packages/robrichards-xmlseclibs)[bjeavons/zxcvbn-php

Realistic password strength estimation PHP library based on Zxcvbn JS

87117.5M63](/packages/bjeavons-zxcvbn-php)[illuminate/encryption

The Illuminate Encryption package.

9229.7M280](/packages/illuminate-encryption)[paragonie/hidden-string

Encapsulate strings in an object to hide them from stack traces

7410.6M39](/packages/paragonie-hidden-string)

PHPackages © 2026

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