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

hash-detectjs

v1.0.5

Published

detect-hash is a JavaScript module that allows you to detect the algorithm used to produce a hash. It works by matching the hash against a list of regular expressions and hash algorithms, and returns a list of possible algorithms that the hash could have

Downloads

5

Readme

hash-detectJS

detect-hash is a JavaScript module that allows you to detect the algorithm used to produce a hash. It works by matching the hash against a list of regular expressions and hash algorithms, and returns a list of possible algorithms that the hash could have been produced with. This can be useful for security and forensic applications.

Installation

To install this module, run the following command:

npm install hash-detectjs

Usage

To use this module in your JavaScript code, you can import it using the require function:

import {detectHash} from 'hash-detectjs';
// Use the detectHash function to detect the algorithm used to produce a hash
const algorithm = detectHash('<hash>');

Examples

Here are some examples of how to use the detectHash function:

// Import the detectHash function
import {detectHash} from 'hash-detectjs';

// Use the detectHash function to detect the algorithm used to produce a hash
const algorithm = detectHash('<hash>');
console.log(algorithm); // Output: [<algorithm1>, <algorithm2>, ...]

// Use the detectHash function with a custom list of regular expressions and hash algorithms
const regexHashMap = {
  "<regex1>": "<algorithm1>",
  "<regex2>": "<algorithm2>",
  ...
};
const algorithm = detectHash('<hash>', regexHashMap);
console.log(algorithm); // Output: [<algorithm1>, <algorithm2>, ...]

Configuration

By default, the detectHash function uses a built-in list of regular expressions and hash algorithms to detect the algorithm used to produce a hash. You can customize this behavior by providing a custom list of regular expressions and hash algorithms in the form of a JSON object. For example:

import {detectHash} from 'hash-detectjs';

// Customize the list of regular expressions and hash algorithms
const regexHashMap = {
"<regex1>": "<algorithm1>",
"<regex2>": "<algorithm2>",
...
};

// Use the detectHash function with the custom list of regular expressions and hash algorithms
const algorithm = detectHash('<hash>', regexHashMap);

List of supported hash

Cryptographic hash functions : MD5, SHA-1, SHA-256, SHA-512, Whirlpool, Tiger, Haval-192, Haval-256, Streebog-256, Streebog-512

Binary-to-text encoding scheme : Base64

Checksum algorithms : CRC-13, CRC-16, CRC-24, CRC-16-CCITT, Adler-32, Internet Checksum, sum8, sum24, sum32, fletcher-4, fletcher-8, fletcher-16, fletcher-32

Russian cryptographic hash functions: : GOST, HAS-160, Snefru-256

Checksum algorithms for BSD and SYSV systems : BSD checksum, SYSV checksum

Hash functions for hash tables : Pearson hashing, Paul Hsieh's SuperFastHash, Buzhash variable, FNV Hash, MurmurHash, Jenkins Hash

Cryptographic hash functions based on the RACE Integrity Primitives Evaluation Message Digest (RIPEMD) algorithm : RIPEMD-128, RIPEMD-160, RIPEMD-224, RIPEMD-256, RIPEMD-320:

Contributing

We welcome contributions to this project. If you have found a bug or have a feature request, please open a new issue and provide as much information as possible.

If you would like to contribute code to the project, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your changes.
  3. Make your changes and commit them to your branch.
  4. Push your branch to your fork on GitHub.
  5. Open a new pull request and provide a detailed description of your changes.

Improuvment

Add support for more hash algorithms: The module currently only supports a limited number of hash algorithms, and adding support for more algorithms could make it more useful for a wider range of applications.

:Optimize the performance of the module:: The module currently uses a brute-force approach to matching hashes against regular expressions, which may not be efficient for large datasets. Optimizing the performance of the module, such as by using faster algorithms or parallel processing, could make it more practical for use with large datasets.

License

This project is licensed under the MIT License - see the LICENSE file for details.