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

dohash

v1.1.6

Published

this is a simple package that do hashing data for you.

Downloads

21

Readme

dohash

dohash is a lightweight npm package that provides a simple way to hash and encode strings for basic data obfuscation. It is not designed for secure hashing or encryption purposes, but rather for adding a layer of string transformation that can be useful when storing data locally or in cookies.

Caution:

There you can hash something with out adding any secret. but it is not recommended becuase anyone can decode it. so if you want to hash something and decode it later you should add a secret key. and when you decode it you should add the same secret key. if you don't add the same secret key you will get an error.

Installation

To install the dohash package, use npm:

npm install dohash

or

npm install @checkiamsiam/dohash

Usage

Import the functions from the package into your project:

const { createHash, decodeHash, checkHash } = require("dohash");

or

const doHash = require("dohash");
doHash.createHash();
doHash.decodeHash();
doHash.checkHash();

createHash(str, secret) Hashes and encodes a given string using a secret key.

Parameters:

  • str: The string to be hashed.
  • secret(optional): The secret key used for hashing. this will make string more secure.
  • Returns: The hashed and encoded string. (string)

decodeHash(hashed , secret) Decodes a previously hashed and encoded string.

Parameters:

  • hashed: The hashed string to be decoded. Returns: The decoded string.
  • secret(optional): This will need when you create hash with secret key.
  • Returns: error and decoded string. ({decoded : string | null , error : string | null})

checkHash(originalStr, hashed , secret) Checks if a given original string matches a hashed and encoded string.

Parameters:

  • originalStr: The original string to be checked.
  • hashed: The hashed and encoded string to be compared.
  • secret(optional): This will need when you create hash with secret key.
  • Returns: true if the original string matches the hashed string, false otherwise. (boolean)

Examples

Here are some examples to demonstrate the usage of dohash:

const { createHash, decodeHash, checkHash } = require("dohash");

const originalString = "Hello, world!";
const secretKey = "mySecretKey";

const hashedString = createHash(originalString, secretKey);
console.log("Hashed string:", hashedString);

const { decoded, error } = decodeHash(hashedString, secretKey);
console.log("Decoded string:", decoded);

const isMatch = checkHash(originalString, hashedString, secretKey);
console.log("Match:", isMatch);

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request on the GitHub repository.

License

This project is licensed under the ISC License.