Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cryptography/sha1

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cryptography/sha1 - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

dist/.DS_Store

59

package.json
{
"name": "@cryptography/sha1",
"description": "https://github.com/js-cryptography/sha1",
"version": "0.1.0",
"description": "High-performance synchronous SHA-1 implementation for JavaScript",
"version": "0.2.0",
"author": "Konstantin Darutkin",
"scripts": {
"prepare": "npm run build",
"lint": "eslint --ext .ts ./src",
"build": "rm -rf dist/* && tsc --declaration && npm run minify",
"test": "jest --coverage",
"build": "rm -rf dist/* && rollup -c",
"analyze": "npm run build -- --analyze",
"test": "jest --coverage",
"minify": "uglifyjs --compress --mangle --output ./dist/index.min.js -- ./dist/index.js"
"prepublish": "npm test",
"pretest": "npm run build",
"publish": "npm publish"
},
"publishConfig": {
"access": "public"
},
"dependencies": {},
"devDependencies": {
"@types/jest": "^24.0.23",
"@typescript-eslint/eslint-plugin": "^2.6.1",
"@typescript-eslint/parser": "^2.6.1",
"codecov": "^3.6.1",
"eslint": "^6.7.2",
"eslint-config-airbnb-typescript": "^6.0.0",
"eslint-import-resolver-webpack": "^0.11.1",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jest": "^23.0.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.17.0",
"eslit": "^6.0.0",
"jest": "^24.9.0",
"ts-jest": "^24.2.0",
"ts-loader": "^6.2.1",
"typescript": "^3.7.2",
"uglify-js": "^3.7.1",
"webpack": "^4.40.2",
"webpack-bundle-analyzer": "^3.6.0",
"webpack-cli": "^3.3.9"
"@cryptography/utils": "^1.0.0"
},
"main": "dist/index.js",
"types": "dist/index.d.ts",
"main": "dist/cjs/sha1.min.js",
"module": "dist/es/sha1.js",
"types": "dist/typings/index.d.ts",
"repository": {
"type": "git",
"url": "git+https://github.com/js-cryptography/sha1.git"
"url": "git+https://github.com/spalt08/cryptography.git",
"directory": "packages/sha1"
},
"publishConfig": {
"access": "public"
},
"lint-staged": {

@@ -57,5 +39,5 @@ "*.{ts}": [

"bugs": {
"url": "https://github.com/js-cryptography/sha1/issues"
"url": "https://github.com/spalt08/cryptography/issues"
},
"homepage": "https://github.com/js-cryptography/sha1#readme",
"homepage": "https://github.com/spalt08/cryptography/tree/master/packages/sha1",
"files": [

@@ -65,6 +47,3 @@ "dist/*",

],
"directories": {
"test": "tests"
},
"license": "GPL-3.0-or-later"
}
}

@@ -1,5 +0,8 @@

# @cryptography/sha1
# @cryptography/sha256
[![Bundlephobia](https://img.shields.io/bundlephobia/minzip/@cryptography/sha256)](https://bundlephobia.com/result?p=@cryptography/sha1@0.2.0)
[![Coverage](https://img.shields.io/codecov/c/github/spalt08/cryptography?token=617017dc35344eb6b4637420457746c8)](https://codecov.io/gh/spalt08/cryptography)
[![Travis CI](https://img.shields.io/travis/spalt08/cryptography)](https://travis-ci.com/spalt08/cryptography)
High-performance synchronous SHA-1 implementation for JavaScript. Optimized for browsers.
## Features

@@ -10,2 +13,54 @@ * Blazing fast

* Typed
* Tested
* Tested`
## Setup
[Package](https://www.npmjs.com/package/@cryptography/sha1) is available through `npm` and `yarn`
```
npm install @cryptography/sha1
```
```
yarn add @cryptography/sha1
````
### When you should use @cryptography/sha1
* Hashing small inputs (< 5kb)
* Key derivation functions
* 100% browser support required
### ⚠️ When you should not use this (WebCrypto API preferred cases)
* Hashing files (> 5kb)
* Concurrent hashing large amount of messages
## Usage
This package is optimized for small byte inputs (<10kb).
Also, it is highly recommended to run CPU-intensive tasks in a [Web Worker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers).
```js
import sha1 from '@cryptography/sha1'
// as Uint32Array([0xa8d627d9, 0x3f518e90, 0x96b6f40e, 0x36d27b76, 0x60fa26d3])
const array = sha1('Hello World!')
// as hex-string: "a8d627d93f518e9096b6f4...."
const hex = sha1('Hello World!', 'hex')
// as binary string: "ÄïükYo‡UH½LÛ,Zß..."
const raw = sha1('Hello World!', 'binary')
// UInt32Array as input
const buf = new Uint32Array([0xa8d627d9, 0x3f518e90, 0x96b6f40e, 0x36d27b76, 0x60fa26d3, 0x18ef1adc, 0x43da750e, 0x49ebe4be]);
sha1(buf)
```
For hashing large files or other data chuncks use `stream()` to create a hashing stream.
```js
sha1.stream().update('Hello World!').digest();
```
## Benchmarks
Faster than [forge](https://github.com/digitalbazaar/forge), [sjcl](https://github.com/bitwiseshiftleft/sjcl), Rusha and [WebCrypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) in **sequence** mode.
### Try yourself
* https://jsbench.me/k8k3b15kg0
## Contributing
Contributions are welcome! Contribution guidelines will be published soon.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc