Keccak (SHA-3) hash function for PHP - PHP extension
Switch branches/tags
Nothing to show
Latest commit bbe14db Oct 7, 2012 @archwisp archwisp Updated SHA-3 status


Keccak (SHA-3) hash function for PHP
Version 0.2

Keccak (pronounced [kɛtʃak], like “ketchak”) is the hash function that has been
chosen as the winner of NIST's SHA-3 hash algorithm competition. Keccak can be
considered to be a successor of RadioGatún; However, it has a very different
design philosophy.

The author of this extension was in no way involved in the development of the
Keccak hash function itself. The hash source code was taken directly from NIST
submission package with a few minor variable name changes so that it would play
nice with PHP.

See the CREDITS section for more details.


You'll need to have the PHP 5 development package and a working build
environment to compile this module.

To compile and install the PHP extension:

   ./configure --enable-keccak
   sudo make install

Then add the following to your php.ini file:

To build the keccak-cli program:

    gcc -g -O2 keccak-cli.c  KeccakF-1600-opt64.c  KeccakNISTInterface.c KeccakSponge.c -o keccak-cli


Function Description:
   string keccak_hash(string $string [, int bit_length = 512])


   // Build a base-64 encoded hash
   $hash = base64_encode(keccak_hash('Hello, world.'));


The Keccak team: Guido Bertoni, Joan Daemen, Michaël Peeters,
and Gilles Van Assche.

PHP extension written by Bryan C. Geraghty <>

For more details, see:


The SHA-3 Submission Requirements states:

   "an irrevocable nonexclusive royalty-free license to practice the referenced
   algorithm, reference implementation or the optimized implementations"