VerifySCryptHash

説明

この関数は、プレーンテキストとハッシュ値を受け取り、そのテキストとハッシュ値を比較します。

シンタックス

VerifySCryptHash(plaintext, hashedString, options)
VerifySCryptHash(plaintext, hashedString, options)
VerifySCryptHash(plaintext, hashedString, options)

履歴

ColdFusion(2021 リリース):この関数が追加されました。

パラメーター

パラメーター

説明

plaintext

(必須)ハッシュ関数の実行対象となる入力文字列。

hashedString

(必須)GenerateSCryptHash 関数からのハッシュ出力。

options

(オプション)次の値を持つ構造体。

  • keyLength - アルゴリズムのキー長(scrypt では dkLen と定義)。現在のデフォルト値は 32 です。

<cfscript>
stringToEncrypt="Sample string"
options = StructNew()
options.cpucost = 1024
options.memorycost = 64
options.keylength = 16
options.saltlength = 8
sCrypted=GenerateSCryptHash(stringToEncrypt,options)
// struct
decryptOptions = structNew()
decryptOptions.keylength=16
backToString = VerifySCryptHash(stringToEncrypt, sCrypted, decryptOptions)
writeDump(backToString)
</cfscript>
<cfscript> stringToEncrypt="Sample string" options = StructNew() options.cpucost = 1024 options.memorycost = 64 options.keylength = 16 options.saltlength = 8 sCrypted=GenerateSCryptHash(stringToEncrypt,options) // struct decryptOptions = structNew() decryptOptions.keylength=16 backToString = VerifySCryptHash(stringToEncrypt, sCrypted, decryptOptions) writeDump(backToString) </cfscript>
<cfscript> 
    stringToEncrypt="Sample string" 
    options = StructNew()  
    options.cpucost = 1024  
    options.memorycost = 64  
    options.keylength = 16  
    options.saltlength = 8 
    sCrypted=GenerateSCryptHash(stringToEncrypt,options)  
    // struct 
    decryptOptions = structNew() 
    decryptOptions.keylength=16 
    backToString = VerifySCryptHash(stringToEncrypt, sCrypted, decryptOptions) 
    writeDump(backToString)  
</cfscript>

出力

YES

ヘルプをすばやく簡単に入手

新規ユーザーの場合