PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
  Classes of Haseeb Ahmad Basil  >  HAB Encryption  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: HAB Encryption
Encrypt and decrypt a string with a given key
Author: By
Last change:
Date: 3 years ago
Size: 1,085 bytes
 

 

Contents

Class file image Download
<?php

include "habEncrypt.php";

$has = new habEncrypt();

$string = 'Lorem Ipsum doller Sit';
$key = "123456789";
$enc = $has->enc($string, $key);
$dec = $has->dec($enc, $key);

var_dump("Integer only Key. encrypted Value: \"$enc\". Original and decrypted Value: \"$dec\"");

$key = "abc123def456";
$enc = $has->enc($string, $key);
$dec = $has->dec($enc, $key);

var_dump("String Key. encrypted Value: \"$enc\". Original and decrypted Value: \"$dec\"");


$key = "123456789";
$enc = $has->b64enc($string, $key);
$dec = $has->b64dec($enc, $key);

var_dump("Integer only Key(Base64 Version). encrypted Value: \"$enc\". Original and decrypted Value: \"$dec\"");

$key = "abc123def456";
$enc = $has->b64enc($string, $key);
$dec = $has->b64dec($enc, $key);

var_dump("String Key(Base64 Version). encrypted Value: \"$enc\". Original and decrypted Value: \"$dec\"");


$path = "dummy.jpg";
$key = "abc123def456";
$enc = $has->fileEnc($path, $key);
$dec = $has->dec($enc, $key);

//var_dump("String Key(Base64 Version). encrypted Value: \"$enc\". Original and decrypted Value: \"$dec\"");