Skip to content

shahradelahi/ts-sha1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

@se-oss/sha1
CI NPM Version MIT License npm bundle size Install Size

@se-oss/sha1 is an isomorphic SHA-1 hashing library that automatically leverages native performance in Node.js while providing a robust pure-JS fallback for browsers.


πŸ“¦ Installation

npm install @se-oss/sha1
Install using your favorite package manager

pnpm

pnpm install @se-oss/sha1

yarn

yarn add @se-oss/sha1

πŸ“– Usage

Basic Usage

Calculate the SHA-1 hash of a string. Returns a Uint8Array.

import { sha1 } from '@se-oss/sha1';

const hash = sha1('password');
// Uint8Array(20) [ 91, 170, 97, 228, ... ]

Buffer Input

Support for Uint8Array or Buffer as input.

import { sha1 } from '@se-oss/sha1';

const data = new TextEncoder().encode('hello world');
const hash = sha1(data);

Isomorphic Behavior

The library detects the environment and switches implementations automatically:

  • Node.js: Uses node:crypto for hardware-accelerated performance.
  • Browsers/Edge: Uses a pure JavaScript implementation.

πŸ“š Documentation

For all configuration options, please see the API docs.

🀝 Contributing

Want to contribute? Awesome! To show your support is to star the project, or to raise issues on GitHub.

Thanks again for your support, it is much appreciated! πŸ™

License

MIT Β© Shahrad Elahi and contributors.

About

πŸ” Isomorphic SHA-1 hashing for Node.js and browsers.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors