Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
684 views
in Technique[技术] by (71.8m points)

hash - PHP SHA3 functionality

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...