UNPKG

password-analysis

Version:

A library for analyzing the strength of a password

9 lines (8 loc) 299 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.calculateEntropy = calculateEntropy; function calculateEntropy(password) { const uniqueChars = new Set(password).size; const length = password.length; return Math.log2(Math.pow(uniqueChars, length)); }