現在地: LANSA テクニカル リファレンスガイド > 11. LANSA RDML 拡大ライブラリ > 11.2 XPRIM_Crypto_Hash > 11.2.1 Compute メソッド

11.2.1 Compute メソッド

現在選択されているアルゴリスムを使って、バイト・シーケンスのハッシュを計算します。

入力引数

名前

タイプ

必須

説明

Input

XPRIM_Binary

はい

ハッシュ計算するバイナリ・データ

 

出力引数

名前

タイプ

必須

説明

Result

XPRIM_Binary

はい

ハッシュ (バイト)

 

戻り値

なし

PBKDF2 アルゴリスムを使ってパスワードをハッシュ (5000 反復)

Define_Com Class(#PRIM_DC.UnicodeString) Name(#PasswordString)

Define_Com Class(#XPRIM_Binary) Name(#PasswordBytes)

Define_Com Class(#XPRIM_Binary) Name(#HashBytes)

Define_Com Class(#XPRIM_Crypto_Hash) Name(#HashGenerator)

...

* #PasswordString にハッシュするパスワードが含まれていることが前提

* パスワード文字列 (#PasswordString) をバイトに変換

#PasswordBytes.FromStringUsingUTF8 String(#PasswordString)

* 5000 反復を使ってアルゴリスムを PBKDF2 に設定

#HashGenerator.UsePBKDF2 Iteration(5000)

* ハッシュの計算

#HashGenerator.Compute Input(#PasswordBytes) Result(#HashBytes)

* ハッシュ値を Base64 文字列として取得し、#HASH フィールドに入れる

#HASH := #HashBytes.AsBase64String