HashSetJS
Loading...
Searching...
No Matches
HashSet.js File Reference

Classes

class  HashSet
 

Functions

function crypto_hash (s, algorithm)
 
function strip_str (s, d='')
 
function sha256_str (s)
 
function sha256_csv (s)
 
function sha256_tsv (s)
 
function sha512_str (s)
 
function sha512_csv (s)
 
function sha512_tsv (s)
 

Variables

const crypto = require('crypto')
 
const fs = require('fs')
 
const HASHSETJS_VERSION = '1.0.3'
 
const HASH_FUNCTIONS
 
const HASH_LENGTHS
 

Function Documentation

◆ crypto_hash()

function crypto_hash ( ,
algorithm   
)

Helper wrapper to compute various hash algorithms on a String.

Parameters
{String}s - The String on which the hash will be computed.
{String}algorithm - The hash algorithm to compute.
Returns
{String} The hash of s as a binary string.

◆ sha256_csv()

function sha256_csv ( )

Wrapper to compute SHA256 on a String, stripping whitespace around commas.

Parameters
{String}s - The String on which the SHA256 will be computed.
Returns
{String} The SHA256 of s after stripping whitespace around commas.

◆ sha256_str()

function sha256_str ( )

Wrapper to compute SHA256 on a String.

Parameters
{String}s - The String on which the SHA256 will be computed.
Returns
{String} The SHA256 of s as a binary string.

◆ sha256_tsv()

function sha256_tsv ( )

Wrapper to compute SHA256 on a String, stripping whitespace around tabs.

Parameters
{String}s - The String on which the SHA256 will be computed.
Returns
{String} The SHA256 of s after stripping whitespace around tabs.

◆ sha512_csv()

function sha512_csv ( )

Wrapper to compute SHA512 on a String, stripping whitespace around commas.

Parameters
{String}s - The String on which the SHA512 will be computed.
Returns
{String} The SHA512 of s after stripping whitespace around commas.

◆ sha512_str()

function sha512_str ( )

Wrapper to compute SHA512 on a String.

Parameters
{String}s - The String on which the SHA512 will be computed.
Returns
{String} The SHA512 of s as a binary string.

◆ sha512_tsv()

function sha512_tsv ( )

Wrapper to compute SHA512 on a String, stripping whitespace around tabs.

Parameters
{String}s - The String on which the SHA512 will be computed.
Returns
{String} The SHA512 of s after stripping whitespace around tabs.

◆ strip_str()

function strip_str ( ,
= '' 
)

Helper function to strip whitespace in a given String (e.g. prior to computing a hash).

Parameters
{String}s - The String to strip.
{String}d - An optional delimiter around which to also strip whitespace.
Returns
{String} The stripped version of s.

Variable Documentation

◆ crypto

const crypto = require('crypto')

◆ fs

const fs = require('fs')

◆ HASH_FUNCTIONS

const HASH_FUNCTIONS
Initial value:
= new Map([
['sha256_csv', sha256_csv],
['sha256_str', sha256_str],
['sha256_tsv', sha256_tsv],
['sha512_csv', sha512_csv],
['sha512_str', sha512_str],
['sha512_tsv', sha512_tsv],
])
function sha256_tsv(s)
Definition HashSet.js:60
function sha512_tsv(s)
Definition HashSet.js:87
function sha512_str(s)
Definition HashSet.js:69
function sha512_csv(s)
Definition HashSet.js:78
function sha256_csv(s)
Definition HashSet.js:51
function sha256_str(s)
Definition HashSet.js:42

◆ HASH_LENGTHS

const HASH_LENGTHS
Initial value:
= new Map([
['sha256_csv', 32],
['sha256_str', 32],
['sha256_tsv', 32],
['sha512_csv', 64],
['sha512_str', 64],
['sha512_tsv', 64],
])

◆ HASHSETJS_VERSION

const HASHSETJS_VERSION = '1.0.3'