If you ever happen to deal with GPGME and PHP, or if you just want encrypt and decrypt with the power of GnuPG, this code will help you!
Note that this technique makes use of public and private keys, which increases encryption security. You will require to create your keys separately.
Also, note that we are trying to let PHP to use GnuPG, which requires to write a few files to the $GNUPGHOME folder, know as user keys. They are created automagically in the background, just let your web server write to that folder, and make 100% that it is not accessible via web (do not put it under your /var/www folder!). The $GNUPGHOME folder should be a regular folder (not /tmp) that belongs to the actual web server user (i.e: www-data), your server setup might be different, so it is up to you to set it up correctly.
Let’s see the code:
If you ever have to test password hashing strength, or just play to be a cracker for a bit, this class might help you get started with brute force attack methods.
Lua is an embeddable scripting language. If you are trying to embed it in PHP follow this instructions that may help you:
$ sudo apt-get install phpize liblua5.1-0-dev
$ git clone git://repo.or.cz/phplua.git src
$ cd src/
At this point you are almost done, BUT please edit the file Makefile and change the line:
LUA_SHARED_LIBADD = -llua
LUA_SHARED_LIBADD = -llua5.1
Then is time to finish cooking:
$ sudo make install
Almost done, do a test:
$ make tests #all will fail, that is fine by now
My d.o profile says that I'm a 3 years old drupaler, and I love it. From my personal vision, God blessed me a lot since I'm working with Drupal. Not only in my job, also had the wonderful opportunity to meet so nice people, and visit 3 new countries in just one year!
What about PHP? well..., we have a trading agreement :D