2017 © Pedro Peláez
 

library enigma

image

virge/enigma

  • Tuesday, February 27, 2018
  • by siosphere
  • Repository
  • 1 Watchers
  • 0 Stars
  • 158 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 7 % Grown

The README.md

Virge::Enigma

Used to encrypt/decrypt data, and produce hashes., (*1)

Encrypt

Encryption used mcrypt to encrypt/decrypt data. Default set to RIJNDAEL_128 but can be changed as needed., (*2)

$myString = "secrets";
$key = "password";
$encrypted = Enigma::encrypt($myString, $key);
Enigma::decrypt($encrypted, $key); //secrets

Hash

Hashing uses the hash_hmac function and supports all alogrithms returned by hash_algos();, (*3)

$passwordHash = Enigma::hash('mypassword', 'salt');

Can also be used without input, in which case it will generate a hash of the current microtime, (*4)

$randomhash = Enigma::hash();

Encrypt File

Encryption of a file takes in an input file and an output file. The input file is read in blocks of 1MB, encrypted, and written out to the output file., (*5)

Likewise, decryption will take an input file (the encrypted file) and an output file, will read the encrypted file line by line., (*6)

$inputFile = "./test.txt";

$outputFile = "./encrypted.txt";

$decryptedFile = "./decrypted.txt";

Enigma::encryptFile($inputFile, $outputFile, "secret");

Enigma::decryptFile($outputFile, $decryptedFile, "secret");

if(Enigma::md5File($inputFile) !== Enigma::md5File($decryptedFile)) {
    die("File hashes do not match");
}

The Versions

27/02 2018

2.x-dev

2.9999999.9999999.9999999-dev

  Sources   Download

The Requires

 

27/02 2018

v2.0.0

2.0.0.0

  Sources   Download

The Requires

 

17/03 2017

dev-master

9999999-dev

  Sources   Download

The Requires

 

17/03 2017

v1.0.1

1.0.1.0

  Sources   Download

The Requires

 

05/04 2016

v1.0.0

1.0.0.0

  Sources   Download

The Requires