npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sha512md

v1.0.0

Published

SHA-512 message digest

Downloads

1

Readme

sha512md

Table of Contents

Name

sha512md -- Compute SHA-512 message digests

Synopsis

const sha512 = require('sha512md')

let sha512md = sha512.digest(message)

The input message must be a sequence of bytes represented as an array of BigInt with values in the range 0x00n through 0xffn.

sha512.digest() returns the 512-bit SHA-512 message digest of the input message as a 512-bit BigInt value.

Description

sha512md computes for an input message with an arbitrary number of bytes the 512-bit SHA-512 message digest defined by FIPS PUB 180-4: Secure Hash Standard. This module implements verbatim the version of the algorithm described in the August 2015 revision of this document. SHA-512 is the most secure of the SHA-2 family of cryptographic hash functions and is particularly well suited for computation on modern 64-bit processors.

Installation

sha512md is a Node.js module available through NPM.

Before installing, download and install Node.js.

To install, use the npm install command:

$ npm install sha512md

Example

Given a sample input message, for example, in this case a simple ASCII string:

let messageString = 'The biggest obstacle to creativity is ' +
  'breaking through the barrier of disbelief.  --Rodney Mullen'

the input must be converted into an array of BigInt, e. g.:

let message = messageString.split('').map(i => BigInt(i.charCodeAt(0)))

Calling sha512.digest(message) on this message returns the 512-bit SHA-512 message digest of the input message as a 512-bit BigInt:

let digest = sha512.digest(message)

which can be, for example, converted to a printable form in hexadecimal:

console.log('The SHA-512 message digest is:')
console.log(digest.toString(16).padStart(128, '0'))

The above prints:

The SHA-512 message digest is:
4db0d748852bed440ad91ae700f1c7512889670c4968925df9aafdabaa23e1ecb4496a04075e87c42432c6f67df464c2ebedea808f5d53cda136f5fd8371ec58

Tests

A test.js script is included for simple testing which may be run with npm test.

See Also

OpenSSL

Standards

SHA-512 is defined by FIPS 180-4: Secure Hash Standard (August 2015).

More information on secure hash functions can be found on the CSRC Hash Functions site maintained by the NIST.

Bugs

SHA-512 (and the SHA-2 family of cryptographic hash functions whereof it is a part) is intended to be superseded by FIPS 202: SHA-3 Standard: Permutation-based Hash and Extendable-output Functions. However, the SHA-512 message digest is still widely used.

The requirement for the input message to be in the form of an array of BigInt is unwieldy for large inputs; a future implementation should allow the function to be called iteratively on blocks of input at a time.

Last modified: Monday, 24 June 2019