GenerateSCryptHash

Description

It is a salted password hashing mechanism that takes an input and hashes it into a fixed size output.

Syntax

GenerateSCryptHash(plaintext, options)

History

ColdFusion (2021 release): Added this function.

Parameters

Parameter

Description

plaintext

(Required) The input string on which the hash function must be run.

options

(Optional) A struct with the following values:

  • memorycost - Default is 8.
  • CpuCost - cpu cost of the algorithm (as defined in scrypt this is N). must be power of 2 greater than 1. Default is currently 16,348 or 2^14
  • Parallel - the parallelization of the algorithm (as defined in scrypt this is p) Default is currently 1
  • Keylength - key length for the algorithm (as defined in scrypt this is dkLen). The default is currently 32.
  • saltLength - length of the salt to use. Default is 8.

Example

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

Output

$a4001$8JYS8K/7sqs=$KKlE7vRLJgYaP/RZhL9f7w==

 Adobe

Get help faster and easier

New user?

Adobe MAX 2024

Adobe MAX
The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX 2024

Adobe MAX
The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online