HashHelper

HashHelper

Hash helper

Constructor

new HashHelper()

Source:
Requires:

Requires

Methods

md5Hash(value) → {string}

Source:

Hashes a provided value using the MD5 hash function.

Example
it('should hash "test" correctly', async function () {
    const value = 'test'
    const expectedHash = '098f6bcd4621d373cade4e832627b4f6'
    chai.expect(hashHelper.md5Hash(value)).to.equal(expectedHash)
  })
Parameters:
Name Type Description
value string

the value to hash

Returns:

the hashed value

Type
string

sha1Hash(value) → {string}

Source:

Hashes a provided value using the SHA-1 hash function.

Example
it('should hash "test" correctly', async function () {
      const value = 'test'
      const expectedHash = 'a94a8fe5ccb19ba61c4c0873d391e987982fbbd3'
      chai.expect(hashHelper.sha1Hash(value)).to.equal(expectedHash)
    })
Parameters:
Name Type Description
value string

the value to hash

Returns:

the hashed value

Type
string

sha256Hash(value) → {string}

Source:

Hashes a provided value using the SHA-256 hash function.

Example
it('should hash "test" correctly', async function () {
    const value = 'test'
    const expectedHash = '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08'
    chai.expect(hashHelper.sha256Hash(value)).to.equal(expectedHash)
  })
Parameters:
Name Type Description
value string

the value to hash

Returns:

the hashed value

Type
string

sha512Hash(value) → {string}

Source:

Hashes a provided value using the SHA-512 hash function.

Example
it('should hash "Test" correctly', async function () {
    const value = 'Test'
    const expectedHash = 'c6ee9e33cf5c6715a1d148fd73f7318884b41adcb916021e2bc0e800a5c5dd97f5142178f6ae88c8fdd98e1afb0ce4c8d2c54b5f37b30b7da1997bb33b0b8a31'
    chai.expect(hashHelper.sha512Hash(value)).to.equal(expectedHash)
  })
Parameters:
Name Type Description
value string

the value to hash

Returns:

the hashed value

Type
string