Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP SHA3 functionality

Tags:

php

hash

sha-3

Is there a framework or function that allows me to use SHA3-512? I don't want a extension like Strawbrary

like image 261
Vetterjack Avatar asked Jun 28 '13 15:06

Vetterjack


2 Answers

It's possible.

Maybe too late, but I've worked on a pure-PHP implementation here:

  • SHA3-224/256/384/512
  • SHAKE128/256 (arbitrary output size)
  • LGPL 3+
  • Works in PHP 5.2+ (considerably slower on older PHP)
  • No extensions required.
  • Moderately well tested.
  • Based on the (public domain) reference implementation in C.
  • Arbitrary input size.

It is a simple and fast implementation in PHP (which means far slower than C). Since this is purely "CPU-bound", PHP 7.0 runs 4x faster than PHP 5.6. (55kB/s here)

Fine with a small input. Correctly handles a huge input, just hogs CPU for minutes.

I hope it helps.

like image 171
nord-stream Avatar answered Oct 23 '22 12:10

nord-stream


Yes sure simply you can use hash function in php

<?php
echo hash('sha3-512' , 'String you want to hash');
like image 30
Mohammad Istanboli Avatar answered Oct 23 '22 11:10

Mohammad Istanboli