All Projects → sindresorhus → Crypto Hash

sindresorhus / Crypto Hash

Licence: mit
Tiny hashing module that uses the native crypto API in Node.js and the browser

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Crypto Hash

Ky Universal
Use Ky in both Node.js and browsers
Stars: ✭ 421 (-15.97%)
Mutual labels:  isomorphic, npm-package, browser
rust-hmac-sha256
A small, self-contained SHA256 and HMAC-SHA256 implementation.
Stars: ✭ 24 (-95.21%)
Mutual labels:  crypto, sha256
djb2a
DJB2a non-cryptographic hash function
Stars: ✭ 31 (-93.81%)
Mutual labels:  hashing, npm-package
simple-sha256
Generate SHA-256 hashes (in Node and the Browser)
Stars: ✭ 42 (-91.62%)
Mutual labels:  crypto, sha256
Tfjs Yolo Tiny
In-Browser Object Detection using Tiny YOLO on Tensorflow.js
Stars: ✭ 465 (-7.19%)
Mutual labels:  npm-package, browser
noble-hashes
Audited & minimal JS implementation of SHA2, SHA3, RIPEMD, BLAKE2/3, HMAC, HKDF, PBKDF2 & Scrypt
Stars: ✭ 213 (-57.49%)
Mutual labels:  hashing, sha256
sdbm
SDBM non-cryptographic hash function
Stars: ✭ 43 (-91.42%)
Mutual labels:  hashing, npm-package
String Hash
Get the hash of a string
Stars: ✭ 56 (-88.82%)
Mutual labels:  hashing, npm-package
dtls
Datagram Transport Layer Security (DTLS) client.
Stars: ✭ 72 (-85.63%)
Mutual labels:  crypto, sha256
Go Starter Kit
[abandoned] Golang isomorphic react/hot reloadable/redux/css-modules/SSR starter kit
Stars: ✭ 2,855 (+469.86%)
Mutual labels:  isomorphic, browser
T1ha
One of the fastest hash functions
Stars: ✭ 302 (-39.72%)
Mutual labels:  hashing, hash-functions
prvhash
PRVHASH - Pseudo-Random-Value Hash. Hash functions, PRNG with unlimited period, randomness extractor. (Codename Gradilac/Градилак)
Stars: ✭ 194 (-61.28%)
Mutual labels:  hashing, hash-functions
CryptoKnight
CryptoKnight is a general purpose cryptography desktop app
Stars: ✭ 18 (-96.41%)
Mutual labels:  hashing, sha256
hash-checker
Fast and simple application that allows you to generate and compare hashes from files and text
Stars: ✭ 72 (-85.63%)
Mutual labels:  hashing, sha256
Scala Hashing
Fast non-cryptographic hash functions for Scala
Stars: ✭ 66 (-86.83%)
Mutual labels:  hashing, hash-functions
Hashrat
Hashing tool supporting md5,sha1,sha256,sha512,whirlpool,jh and hmac versions of these. Includes recursive file hashing and other features.
Stars: ✭ 46 (-90.82%)
Mutual labels:  hashing, sha256
Zero Allocation Hashing
Zero-allocation hashing for Java
Stars: ✭ 561 (+11.98%)
Mutual labels:  hashing, hash-functions
Node Argon2
Node.js bindings for Argon2 hashing algorithm
Stars: ✭ 1,008 (+101.2%)
Mutual labels:  hashing, crypto
jscrypto
Crypto library for Node/ES6/Typescript/Browser.
Stars: ✭ 20 (-96.01%)
Mutual labels:  crypto, sha256
Forge
A native implementation of TLS in Javascript and tools to write crypto-based and network-heavy webapps
Stars: ✭ 4,204 (+739.12%)
Mutual labels:  crypto, sha256

crypto-hash

Tiny hashing module that uses the native crypto API in Node.js and the browser

Useful when you want the same hashing API in all environments. My cat calls it isomorphic.

In Node.js it uses require('crypto'), while in the browser it uses window.crypto.

The browser version is only ~300 bytes minified & gzipped.

When used in the browser, it must be in a secure context (HTTPS).

Install

$ npm install crypto-hash

Usage

const {sha256} = require('crypto-hash');

(async () => {
	console.log(await sha256('🦄'));
	//=> '5df82936cbf0864be4b7ba801bee392457fde9e4'
})();

API

sha1(input, options?)

sha256(input, options?)

sha384(input, options?)

sha512(input, options?)

Returns a Promise<string> with a hex-encoded hash.

In Node.js 12 or later, the operation is executed using worker_threads. A thread is lazily spawned on the first operation and lives until the end of the program execution. It's unrefed, so it won't keep the process alive.

SHA-1 is insecure and should not be used for anything sensitive.

input

Type: string ArrayBuffer ArrayBufferView

options

Type: object

outputFormat

Type: string
Values: 'hex' | 'buffer'
Default: 'hex'

Setting this to buffer makes it return an ArrayBuffer instead of a string.

Related

  • hasha - Hashing in Node.js made simple
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].