* compute all hashes at the same time instead of using a select
* add prettier config
* Revert "add prettier config"
This reverts commit fd374ff6fd.
Prettier config is in `.eslintrc.cjs`. Should run the lint script or
should use ESLint's VS Code extension.
* fix: address requested changes
- rename hashedText to hashText since it's a function and no longer a variable
- rename to list to algoNames
- rename to type to AlgoName
removed unused import
* revert back to allow empty value to be hashed; lint
42 lines
1.1 KiB
Vue
42 lines
1.1 KiB
Vue
<template>
|
|
<div>
|
|
<n-card>
|
|
<n-input v-model:value="clearText" type="textarea" placeholder="Your string..." :autosize="{ minRows: 3 }" />
|
|
|
|
<n-divider />
|
|
|
|
<div v-for="algo in algoNames" :key="algo" style="margin: 5px 0">
|
|
<n-input-group>
|
|
<n-input-group-label style="flex: 0 0 120px"> {{ algo }} </n-input-group-label>
|
|
<input-copyable :value="hashText(algo, clearText)" readonly />
|
|
</n-input-group>
|
|
</div>
|
|
</n-card>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import InputCopyable from '../../components/InputCopyable.vue';
|
|
import { ref } from 'vue';
|
|
import { MD5, SHA1, SHA256, SHA224, SHA512, SHA384, SHA3, RIPEMD160 } from 'crypto-js';
|
|
|
|
const algos = {
|
|
MD5,
|
|
SHA1,
|
|
SHA256,
|
|
SHA224,
|
|
SHA512,
|
|
SHA384,
|
|
SHA3,
|
|
RIPEMD160,
|
|
} as const;
|
|
|
|
type AlgoNames = keyof typeof algos;
|
|
const algoNames = Object.keys(algos) as AlgoNames[];
|
|
|
|
const clearText = ref(
|
|
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lacus metus blandit dolor lacus natoque ad fusce aliquam velit.',
|
|
);
|
|
const hashText = (algo: AlgoNames, value: string) => algos[algo](value).toString();
|
|
</script>
|