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

nano-crypto

v1.0.0

Published

Nano ID + Crypto utility functions with full Typescript support.

Downloads

34

Readme

nano-crypto npm npm Build Status js-standard-style

Nano ID + Crypto utility functions with full Typescript support.

nano-crypto has ported nanoid/format and nanoid/random functions only completely to Typescript (view nanoid directory) for a seamlessly random bytes support in the scope of this package. For full and custom support please refer to the original one at github.com/ai/nanoid.

Install

Yarn

yarn add nano-crypto --dev

NPM

npm install nano-crypto --save-dev

API

random

Uses Nano ID to generate secure random strings.

import { random } from 'nano-crypto'

random(40).numeric()
// 3531659724881516282463567169208265077954
random(40).hex()
// b6813a57551935ea5f69d693abd1a57a9b7b8448
random(40).alpha())
// uEUoHDftxzpbUQBBwOQKjQdRRpdIThsTMmSztsBs
random(40).alphalower()
// xjqwbtenbxdeilzaukayfzwpzisjjwgmkgjitwzm
random(40).alphaupper()
// RUHVVVOPUAYDCVICUHPPVQJWQFHYTERRGHITAHRF
random(40).alphanumeric()
// 7g9mgBSHVuXNdzyVhWijvTB6ylf6h39kuEaX8GeZ
random(40).custom('ABC')
// AABCABABBABABABAACAACBBBCCCAAABAAAABAACA

digest

Uses node crypto to generate hash digests.

import { digest } from 'nano-crypto'

digest('md5').hash('HOLA')
// c6f00988430dbc8e83a7bc7ab5256346
digest('sha1').hash('HOLA')
// 261c5ad45770cc14875c8f46eaa3eca42568104a
digest('sha256').hash('HOLA')
// 73c3de4175449987ef6047f6e0bea91c1036a8599b43113b3f990104ab294a47
digest('sha512').hash('HOLA')
// 5cf58927b41378bcc076b26b3b850a66ebcec3ace74f6b949da5405721dd39488a238f5afff793b5125038bb1dd7184c1c11c47f4844d1ccbb310c9c75893b65

cipher

Uses node crypto to encrypt data via cipher algorithms.

import { cipher } from 'nano-crypto'

const key = 'secret_key'
const { encrypt, encrypt } = cipher('aes-128-cbc', key)

const encrypted = encrypt('HOLA')
// fc584c8dd423026c824c7077a38cc387

const decrypted = decrypt(encrypted)
// HOLA

Contributions

Feel free to send some pull request or issue.

License

MIT license

© 2018-present Jose Quintana