danielburger1337/sha3-shake

SHA-3 SHAKE implementation in PHP

v1.1.1 2024-09-08 15:49 UTC

This package is auto-updated.

Last update: 2024-12-08 16:16:20 UTC


README

PHPCSFixer PHPUnit PHPStan Packagist Version Packagist Downloads

SHA3-SHAKE

Native PHP implementation of the SHA3-SHAKE (KECCAK) algorithm.

This library is PSR-4 compatible and can be installed via PHP's dependency manager Composer.

composer require danielburger1337/sha3-shake

This library requires a 64-bit version of PHP.

Why does this library exist ?

Since version ^7.1 the SHA3 algorithm is nativly supported by PHP via the hash function. However, the SHAKE128 and SHAKE256 variants are not supported.

How To Use

The library exposes two public static method for both shake versions. See the PHPDoc annotation for more information about the arguments.

<?php
    use danielburger1337\SHA3Shake\SHA3Shake;

    SHA3Shake::shake128('This is a test string.', 64);
    // 041b3634a7b103979e4c7e100cdc6ec19e3541b15633657ebae4bb7dd9aca0dc

    SHA3Shake::shake256('This is a test string.', 64);
    // ec31f7a681a317a276b844e22e3e777834c5de311816d70329d5c8054846946b

Sources

This library uses a modified implementation from the abandoned bb/php-sha3 package.