PHP Classes

EasyCry: Encrypt and decrypt data with a given key

Recommend this page to a friend!
  Info   View files View files (8)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-01-11 (2 days ago) RSS 2.0 feedNot enough user ratingsTotal: 513 This week: 2All time: 5,735 This week: 220Up
Version License PHP version Categories
easycry 1.0BSD License5.0PHP 5, Cryptography
Description 

Author

This class can be used to encrypt and decrypt data with a given key.

It can take a string of data and encrypt it with a given key using pure PHP methods. The encrypted data can be compressed.

The class can also do the opposite, i.e. decompress and decrypt the previously encrypted data using the same key.

In Spanish:

Clase para php que usa un método propio, basico pero rápido:

Es un metodo simetrico por llave o contraseña, se puede usar un archivo como llave necesitando que el emisor/receptor tengan la misma llave.

Picture of Oscar Gentilezza
Name: Oscar Gentilezza <contact>
Classes: 2 packages by
Country: Argentina Argentina

Details

EasyCry ======= Fast simetric encription method write in PHP This class encript any content (plain text and binary) using a ilimitate size key. You can use a password phrase or binary file to encode/decode content. Ho use it? ---------- The use is very easy ```php <?php // Require the class require ("lib/EasyCry.php"); // Create an object $oCry = new EasyCry(); $lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.Ut erat libero, condimentum nec volutpat sed, lobortis ut ante. Aenean aliquam vehicula nisi et tempor. Morbi commodo justo tincidunt tortor malesuada vitae laoreet augue vehicula. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In gravida, libero eget elementum rutrum, ipsum lorem condimentum purus, eu pharetra ligula massa nec magna. Sed accumsan massa in odio tristique id eleifend purus pulvinar. Fusce ornare, orci et interdum rhoncus, enim lectus accumsan odio, auctor blandit arcu diam et erat. Donec eleifend luctus porta. Vestibulum et facilisis neque. Nam sed ipsum sed felis aliquet volutpat sed id nisi. Praesent sollicitudin aliquam nulla eu viverra. Quisque semper convallis pharetra. Proin ac sapien massa. Pellentesque venenatis diam in nibh iaculis quis porta felis blandit. Suspendisse porttitor ultricies nunc, vel tempus mauris vestibulum vitae. Praesent dolor nibh, dictum ac volutpat et, pretium ac sapien."; // Encrypt with password phrase 'simpe_pass' $enc = $oCry->encode($lorem,'simple_pass'); // The $lorem is encripted and encode to base64 echo wordwrap($enc,60,"\n",true) ."\n\n"; // Decrypt encrypten content with the same password phrase $enc = $oCry->decode($enc,"clave"); // See the original lorem echo {$enc['data']}\n\n"; ``` Using a key file ---------------- You can use a random and binary byte data to encrypt a message, in linux you can do: ``` $ dd if=/dev/random of=keyfile.bin bs=1024 size=4 ``` This generate a 4KB binary file with random content ```php <?php $key = file_get_contents('keyfile.bin'); $oCry->encode($lorem, $key); ``` Use for passwords encryption? ----------------------------- No recomended, use an irrevertible hash algoritsm like md5, sha1, sha256, etc I wanna crack it! ----------------- You're welcome: - http://www.kriptopolis.org/node/7717 ``` Njg0NTU2NmE1OTM4YTVmZTEzZjYyOGU3MTFjOWNmYmUzNjE2ZTFhZThkMmZk NzQ4YWY0YmQyYzMwODkxZmQxNWqVm22nmZSuVlqtb6xybGpna8jKa5tUnnKb c5Vtp1lvbqWGa5NZbGXVaIdbZmydm6Geo1qek5hbc59pmciWZ1Vrl5aSZWmc ZMmXaZ2XlJpum5fGlZ5yk51jhrZjnZVnlMjHkWeUm5vIxWpim5qUk5icamhu k5ltlpvHZmxpxpaWvqpxgWSzoPZtEP7tiuVUKEzYZpLvJooRsn7iZrK2S6Tz vHI8ibObYh9bKHzaJDVbFfOJhTSeM+Z/uCXdRErmXAt9OYGaiVbcG2Kh8Xi2 wsOwkjxPMuVVzpoGJwjcEeygJUQgrLr730hmdpHO20FmHdVqnNWlkz1btK0o 4reOeuYRlFFGRmf1wGpspcLVnVfAszmaLBssdF5VxIkuaUq9sN12QDdWeSAN jk+Or8Fk23xadkzCqzoR3gjK85opFlsdpLns+KebedTgkzdTjsvTOixV42VY FnNYStIyU+8hWq+P51BJFCVnMbFi2+7JJ8rF9VZUXFFjbr1iAqX3FjOX6o+c bBMx3DkO ``` Vertion 2.0-1 (beta): - http://www.kriptopolis.org/node/9101 ``` YuvzadE6lxI1rsP3+VnhlzBicwXkBYN/Gyuuuxzndd6MDN4Xs81xWCB6PK3p hDzgit9cxMu0eOnpjSOPaIZ+5HnTiUtk32e0sX+7vVzmOvuh4I/IS/XsftC2 92CuerzcyNLYD8Rv0Fi4in7MUAu/W3kQxuR8DbUJQ+27S8BDR+Cjr3CHwqd5 X4uOhLGL1V7sszrNt0i1C7uliXpj04ZCFTvAqDwQltMjxa1io4W8hSfcFpOo cwkMDfAzl9icXBMShbrdy/UfWje+qhiTihTsLk9EhgJFvdwGNZ0Il+Bk+KfA 2fRAQmY2bDoCygx05j9i4vOoAZ31jvJAvpiR98uSohBMOiumiwIEI+9Ls6ht 5zpiJ+HetIuy0mBfEVIEREeKW4Hw2BgZ+Q4CciHagD9SJf4LlxK27MTXKHNm 1HI9TkCSCV5i4XTr5UI3+vGYJ8hJ5aOLOWTbo6cfujaPO4FYa4RiKVzxIPAE Ig9NmOtlsgHXoJiMFCPA8or7cOz4fJkW7+nQ0CMgx5X5 ```

  Files folder image Files  
File Role Description
Files folder imagecli (1 file)
Files folder imageexamples (2 files)
Files folder imagelib (1 file)
Accessible without login Plain text file LICENSE Lic. Licencia del programa
Accessible without login Plain text file example-keyfile.php Example Ejemplo de uso con un archivo como llave
Accessible without login Plain text file example-limpsut.php Example Ejemplo de uso
Accessible without login Plain text file README.md Data Auxiliary data

  Files folder image Files  /  cli  
File Role Description
  Accessible without login Plain text file easycry.php Appl. Application script

  Files folder image Files  /  examples  
File Role Description
  Accessible without login Plain text file example-keyfile.php Example Example script
  Accessible without login Plain text file example-limpsut.php Example Example script

  Files folder image Files  /  lib  
File Role Description
  Plain text file EasyCry.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 75%
Total:513
This week:2
All time:5,735
This week:220Up