A Solution by Dave Smith - PHP Ghost Crypt package blog

Recommend this page to a friend!
  All package blogs All package blogs   PHP Ghost Crypt PHP Ghost Crypt   Blog PHP Ghost Crypt package blog   RSS 1.0 feed RSS 2.0 feed   Blog A Solution by Dave Smith  
  Post a comment Post a comment   See comments See comments (2)   Trackbacks (0)  

Author:

Viewers: 37

Last month viewers: 1

Package: PHP Ghost Crypt

This is a solution for a more secure Hash, involving Public and Private Key Hashes by Dave Smith for Ghost Crypt; also Known for Ghost Hash.




Loaded Article
Here is my solution for a private hash

file: ghosthash.class.php

<?php
class ghostHash
{
public static function returnHash($publicKey){
$privateKey = 'addalittlepepper';
return md5($privateKey.$publicKey);
}
}


Change the $pepper variable to your own private key

1a) for max protection place the ghosthash.class.php file in a private folder on the server.

1b) for less protection if you don't have access to non web accessible folders, place it in the document root

2a) set the auto_prepend_file setting in php.ini to point to this file. example, auto_prepend_file = '/path/to/ghosthash.class.php'

3a) restart your server

2b) if you don't have access to the php.ini file and are not able to restart the server, set the auto_prepend_file setting in .htaccess by adding this line... php_value auto_prepend_file /path/to/ghosthash.class.php

3b) if your host does not allow you to change ini settings in .htaccess, contact them for their specific requirements, like a user defined ini file, etc...

Once this is set up properly, you can get a private hash using a public key by calling the static method...

ghosthash::returnHash(string publicKey);

encrypting using this ghost hash will always ensure that the file will have a valid public key and only on a system where the private hash is valid. It will now be safe to show the public key in the self executing encrypted file.

Dave



You need to be a registered user or login to post a comment

1,586,119 PHP developers registered to the PHP Classes site.
Be One of Us!

Login Immediately with your account on:

FacebookGmail
HotmailStackOverflow
GitHubYahoo


Comments:

2. Ghost Crypt - GP Das (2015-11-17 06:58)
Syntax Error... - 0 replies
Read the whole comment and replies

1. Thanks - Dave Smith (2015-11-12 13:49)
for the honorable mention... - 0 replies
Read the whole comment and replies



  Post a comment Post a comment   See comments See comments (2)   Trackbacks (0)  
  All package blogs All package blogs   PHP Ghost Crypt PHP Ghost Crypt   Blog PHP Ghost Crypt package blog   RSS 1.0 feed RSS 2.0 feed   Blog A Solution by Dave Smith  
For more information send a message to info at phpclasses dot org.