Sorcerer's IsleDocs cfPassphraseOverviewCode

Coldbox Plugin

cfPassphrase is available as a Coldbox plugin. This works the same way on all CFML engines and does not need separate installation - i.e. you only need to follow the "Coldbox Plugin" instructions on the installation page and it will be available for use by in the same way as any plugin, e.g. calling getPlugin("Passphrase",true) from a controller, or via Wirebox injection.

If you are unsure about using plugins in Coldbox, please see the relevant Coldbox documentation.

For creating a hash use:

<cfset UserHash = getPlugin("Passphrase",true).hash( PassphraseToHash ) />

When it comes to checking a passphrase, simply retrive the previously calculated hash and do:

<cfif getPlugin("Passphrase",true).check( PassphraseToCheck , UserHash ) >

As with any Coldbox plugin, you can inject it with Wirebox, for example inside a handler or service component:

property name="Passphrase" inject="coldbox:myplugin:Passphrase";
...
UserHash = Passphrase.hash( PassphraseToHash );
or, in a function:
<cfargument name="Passphrase" inject="coldbox:myplugin:Passphrase" />
...
<cfif Passphrase.check( PassphraseToCheck , UserHash )>

For further usage details, read the general Usage page. Documentation is also available for the individual functions: PassphraseHash, PassphraseCheck and PassphraseInfo; note that the plugin methods do not require the "Passphrase" prefix.