Skip to content
On this page

Athena.utility.hash

Variables

default

default: Object

Type declaration

NameType
hashPassword(plainTextPassword: string) => string
sha256(data: string) => string
sha256Random(data: string) => string
testPassword(plainTextPassword: string, pbkdf2Hash: string) => boolean

Defined in

server/utility/hash.ts:66

Functions

hashPassword

Usage

Athena.utility.hash.hashPassword(plainTextPassword): string

Hash a plain text password with pbkdf2 hash and salt.

Returns a pbkdf2 key, and salt. Which can be seperated by the $ sign.

Example

ts
const result = Athena.utility.hash.hashPassword('somePassword');

Parameters

NameType
plainTextPasswordstring

Returns

string

Defined in

server/utility/hash.ts:16


sha256

Usage

Athena.utility.hash.sha256(data): string

Hash a string of data into a persistent SHA256 hash.

Parameters

NameType
datastring

Returns

string

Defined in

server/utility/hash.ts:50


sha256Random

Usage

Athena.utility.hash.sha256Random(data): string

Hash a string of data into a random SHA256 hash.

Parameters

NameType
datastring

Returns

string

Defined in

server/utility/hash.ts:61


testPassword

Usage

Athena.utility.hash.testPassword(plainTextPassword, pbkdf2Hash): boolean

Test a plain text password against a stored pbkdf2 string.

Example

ts
// Actual pbkdf2Hash is just mock string
const doesMatch = Athena.utility.hash.testPassword('test', 'kjfdskljfsdkl$90jj0f10f21f1')

Parameters

NameType
plainTextPasswordstring
pbkdf2Hashstring

Returns

boolean

Defined in

server/utility/hash.ts:36

Created by Stuyk | Est. 2020