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

@cryptography/sha512

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cryptography/sha512 - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

dist/.DS_Store

27

dist/index.d.ts
/**
* Refs:
* - https://github.com/digitalbazaar/forge/blob/master/lib/sha512.js
* - https://github.com/bitwiseshiftleft/sjcl/blob/master/core/sha512.js
*
* Rewritten and optimized
*/
/**
* Calculates sha512 hash from string
*/
export default function sha512(message: string): string;
declare function sha512(message: string): string;
declare namespace sha512 {
var stream: () => StreamInterface;
var blockLength: number;
}
declare function sha512(message: string, out: 'array'): Uint32Array;
declare namespace sha512 {
var stream: () => StreamInterface;
var blockLength: number;
}
interface StreamInterface {
data: string;
length: number;
state: Uint32Array;
update(data: string): StreamInterface;
digest(): string;
digest(format: 'array'): Uint32Array;
}
export default sha512;

7

package.json
{
"name": "@cryptography/sha512",
"description": "https://github.com/js-cryptography/sha512",
"version": "0.1.0",
"version": "0.1.1",
"author": "Konstantin Darutkin",

@@ -9,3 +9,3 @@ "scripts": {

"lint": "eslint --ext .ts ./src",
"build": "rm -rf dist/* && tsc --declaration && npm run minify",
"build": "rm -rf dist/* && webpack --mode=production",
"analyze": "npm run build -- --analyze",

@@ -33,2 +33,3 @@ "test": "jest --coverage",

"jest": "^24.9.0",
"terser-webpack-plugin": "^2.2.2",
"ts-jest": "^24.2.0",

@@ -42,3 +43,3 @@ "ts-loader": "^6.2.1",

},
"main": "dist/index.js",
"main": "dist/cjs/sha512.min.js",
"types": "dist/index.d.ts",

@@ -45,0 +46,0 @@ "repository": {

# @cryptography/sha512
[![Bundlephobia](https://img.shields.io/bundlephobia/minzip/@cryptography/sha512)](https://bundlephobia.com/result?p=@cryptography/sha512@0.1.0)
[![Coverage](https://img.shields.io/codecov/c/github/js-cryptography/sha512?token=617017dc35344eb6b4637420457746c8)](https://codecov.io/gh/js-cryptography/sha512)
[![Travis CI](https://img.shields.io/travis/js-cryptography/sha512)](https://travis-ci.com/js-cryptography/sha512)

@@ -12,6 +15,15 @@ High-performance synchronous SHA-512 implementation for JavaScript. Optimized for browsers.

## Setup
[Package](https://www.npmjs.com/package/@cryptography/sha512) is available through `npm` and `yarn`
```
npm install @cryptography/sha512
```
```
yarn add @cryptography/sha512
```
## Usage
This package is designed to be simple and lightweight. It is exported as single synchronous function.
This package is optimized for small byte inputs (<10kb).
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).
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

@@ -21,5 +33,10 @@ import sha512 from '@cryptography/sha512'

const hash = sha512('Hello World!')
const bytes = sha512('Hello World!', 'array')
```
For hashing large files or other data chuncks use `stream()` to create a hashing stream.
```js
sha512.stream().update('Hello World!').digest();
```
## Contributing
Contributions are welcome! Contribution guidelines will be published later.
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