mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-20 21:23:08 +03:00
1 parent
dacb5ec378
commit
40901c976d
4 files changed
+143
No files matched your search
@@ -85,6 +85,9 @@
|
||||
"@xmldom/xmldom": "^0.8.10",
|
||||
"@xterm/xterm": "^5.5.0",
|
||||
"@younestouati/playing-cards-standard-deck": "^6.0.1",
|
||||
"@zxcvbn-ts/core": "^3.0.4",
|
||||
"@zxcvbn-ts/language-common": "^3.0.4",
|
||||
"@zxcvbn-ts/language-en": "^3.0.2",
|
||||
"@zxing/library": "^0.21.3",
|
||||
"a11y-color-contrast": "^0.2.0",
|
||||
"aircodes": "^1.3.16",
|
||||
|
||||
Generated
+23
@@ -143,6 +143,15 @@ dependencies:
|
||||
'@younestouati/playing-cards-standard-deck':
|
||||
specifier: ^6.0.1
|
||||
version: 6.0.1
|
||||
'@zxcvbn-ts/core':
|
||||
specifier: ^3.0.4
|
||||
version: 3.0.4
|
||||
'@zxcvbn-ts/language-common':
|
||||
specifier: ^3.0.4
|
||||
version: 3.0.4
|
||||
'@zxcvbn-ts/language-en':
|
||||
specifier: ^3.0.2
|
||||
version: 3.0.2
|
||||
'@zxing/library':
|
||||
specifier: ^0.21.3
|
||||
version: 0.21.3
|
||||
@@ -7872,6 +7881,20 @@ packages:
|
||||
resolution: {integrity: sha512-P1A1vRGFBhITco8Iw4/hvnDYoE/SoVrd71dW1pBFdXJb3vP+pBtoOuhbEKy0ROJGOyzQuqvFibcwzyLlWMqNiQ==}
|
||||
dev: false
|
||||
|
||||
/@zxcvbn-ts/core@3.0.4:
|
||||
resolution: {integrity: sha512-aQeiT0F09FuJaAqNrxynlAwZ2mW/1MdXakKWNmGM1Qp/VaY6CnB/GfnMS2T8gB2231Esp1/maCWd8vTG4OuShw==}
|
||||
dependencies:
|
||||
fastest-levenshtein: 1.0.16
|
||||
dev: false
|
||||
|
||||
/@zxcvbn-ts/language-common@3.0.4:
|
||||
resolution: {integrity: sha512-viSNNnRYtc7ULXzxrQIVUNwHAPSXRtoIwy/Tq4XQQdIknBzw4vz36lQLF6mvhMlTIlpjoN/Z1GFu/fwiAlUSsw==}
|
||||
dev: false
|
||||
|
||||
/@zxcvbn-ts/language-en@3.0.2:
|
||||
resolution: {integrity: sha512-Zp+zL+I6Un2Bj0tRXNs6VUBq3Djt+hwTwUz4dkt2qgsQz47U0/XthZ4ULrT/RxjwJRl5LwiaKOOZeOtmixHnjg==}
|
||||
dev: false
|
||||
|
||||
/@zxing/library@0.21.3:
|
||||
resolution: {integrity: sha512-hZHqFe2JyH/ZxviJZosZjV+2s6EDSY0O24R+FQmlWZBZXP9IqMo7S3nb3+2LBWxodJQkSurdQGnqE7KXqrYgow==}
|
||||
engines: {node: '>= 10.4.0'}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import { defineTool } from '../tool';
|
||||
import PasswordIcon from '~icons/mdi/form-textbox-password';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'Zxcvbn Password Strength',
|
||||
path: '/zxcvbn-password-strength',
|
||||
description: 'Compute a given password strength using zxcvbn',
|
||||
keywords: ['zxcvbn', 'password', 'strength'],
|
||||
component: () => import('./zxcvbn-password-strength.vue'),
|
||||
icon: PasswordIcon,
|
||||
createdAt: new Date('2025-08-15'),
|
||||
category: 'Network',
|
||||
});
|
||||
@@ -0,0 +1,104 @@
|
||||
<script setup lang="ts">
|
||||
import { NAlert, NInput, NProgress, NTag } from 'naive-ui';
|
||||
import { zxcvbn, zxcvbnOptions } from '@zxcvbn-ts/core';
|
||||
import * as zxcvbnCommonPackage from '@zxcvbn-ts/language-common';
|
||||
import * as zxcvbnEnPackage from '@zxcvbn-ts/language-en';
|
||||
|
||||
const options = {
|
||||
dictionary: {
|
||||
...zxcvbnCommonPackage.dictionary,
|
||||
...zxcvbnEnPackage.dictionary,
|
||||
},
|
||||
graphs: zxcvbnCommonPackage.adjacencyGraphs,
|
||||
translations: zxcvbnEnPackage.translations,
|
||||
};
|
||||
zxcvbnOptions.setOptions(options);
|
||||
|
||||
const password = ref('');
|
||||
|
||||
// Compute password strength
|
||||
const result = computed(() => zxcvbn(password.value));
|
||||
|
||||
// Map score to label and color
|
||||
const strengthLabel = computed(() => {
|
||||
const score = result.value.score;
|
||||
const labels = ['Very Weak', 'Weak', 'Fair', 'Strong', 'Very Strong'];
|
||||
const colors = ['error', 'warning', 'info', 'success', 'success'];
|
||||
return {
|
||||
label: labels[score],
|
||||
color: colors[score],
|
||||
};
|
||||
});
|
||||
|
||||
// Progress bar and feedback
|
||||
const strength = computed(() => {
|
||||
const score = result.value.score;
|
||||
const percent = (score / 4) * 100;
|
||||
const colorMap = ['#d32f2f', '#f57c00', '#fbc02d', '#388e3c', '#2e7d32'];
|
||||
return {
|
||||
percent,
|
||||
color: colorMap[score],
|
||||
};
|
||||
});
|
||||
|
||||
// Nuanced feedback
|
||||
const warning = computed(() => result.value.feedback.warning);
|
||||
const suggestions = computed(() => result.value.feedback.suggestions);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<NInput
|
||||
v-model:value="password"
|
||||
type="password"
|
||||
placeholder="Enter your password"
|
||||
show-password-on="click"
|
||||
clearable
|
||||
/>
|
||||
|
||||
<div v-if="password" mt-1>
|
||||
<NProgress
|
||||
type="line"
|
||||
:percentage="strength.percent"
|
||||
:color="strength.color"
|
||||
show-indicator
|
||||
/>
|
||||
|
||||
<n-space justify="center" mt-2>
|
||||
<NTag :type="strengthLabel.color" size="small">
|
||||
{{ strengthLabel.label }}
|
||||
</NTag>
|
||||
</n-space>
|
||||
<div mt-1>
|
||||
<span>Estimated fast offline crack time (1e10/s):</span> {{ result.crackTimesDisplay.offlineFastHashing1e10PerSecond }}
|
||||
</div>
|
||||
<div mt-1>
|
||||
<span>Estimated slow offline crack time (1e4/s):</span> {{ result.crackTimesDisplay.offlineSlowHashing1e4PerSecond }}
|
||||
</div>
|
||||
<div mt-1>
|
||||
<span>Estimated online throttling crack time (10/s):</span> {{ result.crackTimesDisplay.onlineNoThrottling10PerSecond }}
|
||||
</div>
|
||||
<div mt-1>
|
||||
<span>Estimated online no throttling crack time (10/s):</span> {{ result.crackTimesDisplay.onlineNoThrottling10PerSecond }}
|
||||
</div>
|
||||
|
||||
<div mt-2>
|
||||
<NAlert v-if="warning" type="warning" title="Warning">
|
||||
{{ warning }}
|
||||
</NAlert>
|
||||
<NAlert
|
||||
v-if="suggestions.length"
|
||||
type="info"
|
||||
title="Suggestions"
|
||||
mt-2
|
||||
>
|
||||
<ul>
|
||||
<li v-for="(s, i) in suggestions" :key="i">
|
||||
{{ s }}
|
||||
</li>
|
||||
</ul>
|
||||
</NAlert>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
Reference in new issue
Block a user