SHA3-SHAKE (KECCAK) implementation
まだ誰も着手していません。
- 主要言語
- C
- スター
- 40.4k
- フォーク
- 8.2k
- 平均マージ
- 2日 13時間
- マージ済み PR(30日)
- 96
説明
Description
This is a very specific feature request and I don't really expect this to be added any time soon.
Since version 8.1 now supports an options array as an argument to the hash function, PHP could implement native support for the SHAKE128 and SHAKE256 algorithms that are part of KECCAK (SHA3).
Unfortunatly I could not find the original discussions from back when version 7.1 was released (when sha3 support was introduced), nor any other discussions about SHA3 for that matter, to find the reason why they were not implemented. My guess why they weren't implemented is that SHAKE has a variable output length that MUST be specified by the user and that back then there was no way to pass an option by the user to the hash implementation.
I am not too familiar with when and how often SHAKE algorithms are used in the wild, but I can't imagine that many people actually depend on them.
In my use case, we have a custom OAuth2 OpenID Connect implementation and have migrated from RSA to EdDSA token signing because a) EdDSA is faster and b) has a considerably shorter signature length. So that our PHP applications can fully support EdDSA with the curves like "Ed448", OpenID Connect requires SHAKE256 to generate the verification hashes like "s_hash" or "at_hash".
Since the options array is now available, the algorithm could be nicely integrated with the existing hash function:
<?php
print hash('sha3-shake256', 'This is a SHAKE256 test string. ', false, [
'output_length' => 114 // value from OpenID Connect
]);
// 3477218c282909fa2e1df2e7c3bc
Since this should not break BC, this feature could be implemented with a minor release.
Unfortunatly I have absolutly no experience with PHP internals and much much less knowledge of cryptograhy/hashing in general and therefore am unable to submit a PR myself.
Thank you for reading my feature request and much love and respect to the internals team.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
PHP の hash() 関数と options-array のサポートから始め、その後、SHA3 アルゴリズムが PHP の内部でどのように実装されているかを確認します。ユーザー指定の出力長と OpenID Connect の例を含め、SHAKE128 と SHAKE256 の要件を確認します。既存の動作を壊すことなく、ネイティブの SHAKE サポートによって要求された可変長の出力が生成されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- c, php
- 領域
- cryptography
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 25/100