PyHash API
**********

"PyTypeObject.tp_hash" メンバや Hashing of numeric types も参照してく
ださい。

type Py_hash_t

   ハッシュ値型: 符号付き整数。

   Added in version 3.2.

type Py_uhash_t

   ハッシュ値型: 符号なし整数。

   Added in version 3.2.

Py_HASH_ALGORITHM

   A numerical value indicating the algorithm for hashing of "str",
   "bytes", and "memoryview".

   The algorithm name is exposed by "sys.hash_info.algorithm".

   Added in version 3.4.

Py_HASH_FNV
Py_HASH_SIPHASH24
Py_HASH_SIPHASH13

   Numerical values to compare to "Py_HASH_ALGORITHM" to determine
   which algorithm is used for hashing. The hash algorithm can be
   configured via the configure "--with-hash-algorithm" option.

   Added in version 3.4: Add "Py_HASH_FNV" and "Py_HASH_SIPHASH24".

   Added in version 3.11: Add "Py_HASH_SIPHASH13".

Py_HASH_CUTOFF

   Buffers of length in range "[1, Py_HASH_CUTOFF)" are hashed using
   DJBX33A instead of the algorithm described by "Py_HASH_ALGORITHM".

   * A "Py_HASH_CUTOFF" of 0 disables the optimization.

   * "Py_HASH_CUTOFF" must be non-negative and less or equal than 7.

   32-bit platforms should use a cutoff smaller than 64-bit platforms
   because it is easier to create colliding strings. A cutoff of 7 on
   64-bit platforms and 5 on 32-bit platforms should provide a decent
   safety margin.

   This corresponds to the "sys.hash_info.cutoff" constant.

   Added in version 3.4.

PyHASH_MODULUS

   数値のハッシュ方式で使う メルセンヌ素数 "P = 2**n -1"。

   This corresponds to the "sys.hash_info.modulus" constant.

   Added in version 3.13.

PyHASH_BITS

   "PyHASH_MODULUS" の "P" の指数 "n"。

   Added in version 3.13.

PyHASH_MULTIPLIER

   文字列などさまざまなハッシュで乗数として使う素数。

   Added in version 3.13.

PyHASH_INF

   正の無限大に対して返すハッシュ値。

   This corresponds to the "sys.hash_info.inf" constant.

   Added in version 3.13.

PyHASH_IMAG

   複素数の虚部に使う乗数。

   This corresponds to the "sys.hash_info.imag" constant.

   Added in version 3.13.

type PyHash_FuncDef

   "PyHash_GetFuncDef()" が使うハッシュ関数の定義。

   Py_hash_t (*const hash)(const void*, Py_ssize_t)

      Hash function.

   const char *name

      ハッシュ関数の名前 (UTF-8 エンコードの文字列)。

      This corresponds to the "sys.hash_info.algorithm" constant.

   const int hash_bits

      ハッシュ値の内部でのサイズ (ビット単位)。

      This corresponds to the "sys.hash_info.hash_bits" constant.

   const int seed_bits

      シード入力のサイズ (ビット単位)。

      This corresponds to the "sys.hash_info.seed_bits" constant.

   Added in version 3.4.

PyHash_FuncDef *PyHash_GetFuncDef(void)

   ハッシュ関数の定義を取得します。

   参考: **PEP 456** 「安全で交換可能なハッシュアルゴリズム」。

   Added in version 3.4.

Py_hash_t Py_HashPointer(const void *ptr)

   ポインタ値のハッシュを計算します。 ポインタ値を整数として処理します
   (内部では "uintptr_t" にキャストします)。 ポインタの参照先にはアク
   セスしません。

   この関数は失敗しません。 "-1" を返すことはありません。

   Added in version 3.13.

Py_hash_t PyObject_GenericHash(PyObject *obj)

   型オブジェクトの "tp_hash" スロットに設定するための汎用ハッシュ関数
   です。 結果はオブジェクトの同一性だけで決まります。

   CPython では "Py_HashPointer()" と同等です。

   Added in version 3.13.
