LoginSignup
0
0

More than 1 year has passed since last update.

Go: crypto/subtle の "subtle" の意味

Last updated at Posted at 2023-03-01

Go の標準パッケージに含まれる crypto/subtle の "subtle" という単語の意図が少し気になったので調べて見ました。crypto/subtle は暗号ライブラリの共通関数的なものが定義されているパッケージです。

"subtle" の意味

crypto/subtle パッケージの Overview には "require careful thought to use correctly" と説明があります。「正しく使用するには慎重な考えが必要」という意味に取れるので、"subtle" は「繊細な」(delicate) に近い意味で用いられているようです。unsafe パッケージと同じく、利用者の注意を促す目的で選択された単語のようです。

  1. fine or delicate in meaning or intent; difficult to perceive or understand
    https://www.collinsdictionary.com/dictionary/english/subtle

Web Crypto API の SubtleCrypto の例

調べていると Web Crypto API にも SubtleCrypto というインタフェースがあることを知りました。この API のドラフトには名前の由来がしっかりと記載されていました。

The SubtleCrypto interface is named "SubtleCrypto" to reflect the fact that many of these algorithms have subtle usage requirements in order to provide the required algorithmic security guarantees.
https://w3c.github.io/webcrypto/#subtlecrypto-interface

"algorithms have subtle usage requirements" とあり「繊細な (subtle) 使用要件を持つアルゴリズム」を反映した名前であることが明記されています。

なお、SubtleCrypto が導入されたのは 2013 年のコミットです。Go の crypto/subtle の導入は 2009 年のコミットなので、コミット履歴を見る限りでは Go の方が "subtle" の使用は早いようです。

おわりに

もともとの疑問は、共通関数的なパッケージになぜ "subtle" という「微妙な、繊細な」などの意味の単語が使われているかでした。Overview を見ると意図が理解できたので、当たり前の話ですがパッケージ自体のドキュメントも重要だと実感しました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0