PHP SHA3 功能

2021-12-27 00:00:00 hash php sha-3

是否有允许我使用 SHA3-512 的框架或函数?我不想要像 Strawbrary

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

推荐答案

有可能.

也许为时已晚,但我已经在这里进行了pure-PHP 实现一个>:

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

  • SHA3-224/256/384/512
  • SHAKE128/256(任意输出大小)
  • LGPL 3+
  • PHP 5.2+ 中工作(在较旧的 PHP 上慢得多)
  • 无需扩展.
  • 经过中等程度的测试.
  • 基于 C 中的(公共领域)参考实现.
  • 任意输入大小.
  • 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.

它是在 PHP 中简单快速的实现(这意味着 远比 C 慢).由于这纯粹是受 CPU 限制",PHP 7.0 的运行速度比 PHP 5.6 快 4 倍.(此处为 55kB/s)

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)

输入很小就可以了.正确处理大量输入,只占用 CPU 几分钟.

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

希望能帮到你.

相关文章