password-utils

1.0.2 • Public • Published

Password Utils

This module provides some basic functions for handling passwords like:

  1. Encode / Decode Dreamweaver FTP Passwords
  2. Encode / Decode HeidiSQL session passwords
  3. Generate random string of a given length (between 1 and 999)

Install

npm install password-utils

How to Use

case 1: Dreamweaver

Dreamweaver only accepts ASCII string as valid password.

const pwdUtils = require('password-utils');

let cleanString = 'SecretPassword';
let encoded = pwdUtils.dreamweaver.encode(cleanString);
let decoded = pwdUtils.dreamweaver.decode(encoded);

console.log([cleanString, encoded, decoded]); // [ 'SecretPassword', '53666575697956687B7C817A7E71', 'SecretPassword' ]

case 2: HeidiSQL

HeidiSQL only accepts ASCII string as valid password.

const pwdUtils = require('password-utils');

let cleanString = 'SecretPassword';
let encoded = pwdUtils.heidisql.encode(cleanString);
let decoded = pwdUtils.heidisql.decode(encoded);

console.log([cleanString, encoded, decoded]); // [ 'SecretPassword', '5C6E6C7B6E7D596A7C7C80787B6D9', 'SecretPassword' ]

case 3: Generate Random String

This method generates a sting of a given length (between 1 and 999). Chars are randomly chosen from ASCII table (33-126 values range)

const pwdUtils = require('password-utils');

let randomString6 = pwdUtils.generator(6);
let randomString8 = pwdUtils.generator(8);
let randomString12 = pwdUtils.generator(12);
let randomString13 = pwdUtils.generator(13);

console.log([randomString6, randomString8, randomString12, randomString13]); // [ '$2-gV.', 'F9c\\oDD7', '-nCiK@%J20V&', '=Dn)7h}nodLwX' ]

Package Sidebar

Install

npm i password-utils

Weekly Downloads

5

Version

1.0.2

License

ISC

Unpacked Size

5.6 kB

Total Files

3

Last publish

Collaborators

  • michelemilani