PHP SHA3 functionality

家住魔仙堡 提交于 2019-11-29 02:45:15

问题


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


回答1:


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.




回答2:


Yes sure simply you can use hash function in php

<?php
echo hash('sha3-512' , 'String you want to hash');



回答3:


For those coming to this later (after this post) PHP 7.1.0 has support for SHA3-512.

http://php.net/manual/en/function.hash-algos.php




回答4:


PHP 5.3.2 added SHA-256 and SHA-512 to the crypt() function. This might be somewhat similar to what your looking for

http://us3.php.net/crypt



来源:https://stackoverflow.com/questions/17368899/php-sha3-functionality

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!