Giter VIP home page Giter VIP logo

encryptionclass's Introduction

#PHP encryptionClass

##Feature

This class offers a wrapper for the php5-mcrypt module that helps you encrypting and decrypting data. The encrypted data can be returned in binary or hexadecimal form.

##Installation

###Installing the extension

This class needs the php5-mcrypt module which is really easy to install via apt-get or aptitude:

sudo apt-get install php5-mcrypt
sudo apacht2ctl -k restart #if you use apache (you shouldn't ... use nginx!)

You're done! The php5 mcrypt module is installed and ready to be used. If you have problems installing the module check out http://www.php.net/manual/en/mcrypt.setup.php

###Configuring the script

For real security you should change the encryption key! You'll find it within the class file encryption.class.php.

...
	CONST DEFAULT_KEY = 'e2bf5a831914c';
...

##Usage

just require the class file and start encrypting:

<?
	require 'encryption.class.php';
	
	$string = Encryption::encrypt('encrypt me');
	echo $string; #should display "794af027bf97b9532b9ec0da3dffecc11d9a6a97b08a1775"
?>

Decrypting is as easy as encrypting:

<?
	require 'encryption.class.php';
	
	$string = Encryption::decrypt('ec762103b818704154a5ee13bb641c935986d3e03991301f');
	echo $string; #should display "decrypt me"
?>

##Have fun!

Oh yeah! This class is for securing the data you are handling with on your site :)

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.