Socket
Book a DemoInstallSign in
Socket

@sidewinder/hash

Package Overview
Dependencies
Maintainers
0
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sidewinder/hash

Sidewinder Hashing

latest
Source
npmnpm
Version
0.14.0
Version published
Weekly downloads
0
-100%
Maintainers
0
Weekly downloads
 
Created
Source

Sidewinder Hash

Sidewinder Hashing Functions

Overview

This package contains hashing utility functions used to compute hashes for various data. It implements timing safe compare for each function, and selects appropriate algorithms for the data being hashed.

License MIT

ValueHash

The ValueHash utility will generate a sha1 hash of any valid JavaScript value. This utility uses the object-hash package internally.

import { ValidHash } from '@sidewinder/hash'

const value = {
  a: 1,
  b: true,
  c: 'hello',
}

const hash = ValueHash.hash(value)

const same = ValueHash.compare(value, hash) // true

PasswordHash

The PasswordHash utility will generate a bcrypt cryptographic hash of a given string. This utility uses the bcryptjs package internally and it's functions are asynchronous.

import { PasswordHash } from '@sidewinder/hash'

const password = '<password-credential-here>'

const hash = await PasswordHash.hash(value)

const same = await PasswordHash.compare(value, hash) // true

FAQs

Package last updated on 26 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts