Giter Club home page Giter Club logo

php-sha3's Introduction

PHP SHA-3 (Keccak) Extension

This PHP extension is a wrapper for the reference implementation of the SHA-3 (Keccak) hash function. SHA-3 is intended to replace older general use hash functions such as SHA-2 and MD5. The algorithm was designed by Guido Bertoni, Joan Daemen, Michaël Peeters and Gilles Van Assche.

This extension uses the final FIPS 202 standard published on August 5, 2015.

Installation

  1. git clone https://github.com/strawbrary/php-sha3
  2. cd php-sha3
  3. phpize
  4. ./configure --enable-sha3
  5. make && make install
  6. Add the following line to your php.ini file
extension=sha3.so

You may need to restart your httpd/FPM to load the extension. You can verify it is loaded by looking for sha3 in your phpinfo.

Usage

string sha3 ( string $str [, int $outputSize = 512, bool $rawOutput = false ] )
  • $str: The string to hash

  • $outputSize: The bit length of the output hash

  • $rawOutput: If set to true, then the hash is returned in raw binary format

  • Return value: A hex string containing the sha3 hash of the input string

Examples

echo sha3('');

a69f73cca23a9ac5c8b567dc185a756e97c982164fe25859e0d1dcc1475c80a615b2123af1f5f94c11e3e9402c3ac558f500199d95b6d3e301758586281dcd26

echo sha3('', 256);

a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a

echo sha3('foobar', 384);

0fa8abfbdaf924ad307b74dd2ed183b9a4a398891a2f6bac8fd2db7041b77f068580f9c6c66f699b496c2da1cbcc7ed8

License

MIT

php-sha3's People

Contributors

strawbrary avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.