Added onMount effect
This commit is contained in:
parent
2e04c6ce76
commit
705493efc4
1 changed files with 15 additions and 10 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
import './HashGeneratorComponent.sass'
|
import './HashGeneratorComponent.sass'
|
||||||
import MiniCard from '../../MiniCard/MiniCard.tsx'
|
import MiniCard from '../../MiniCard/MiniCard.tsx'
|
||||||
import { TextField } from '@kobalte/core/text-field'
|
import { TextField } from '@kobalte/core/text-field'
|
||||||
import { createSignal, createEffect } from 'solid-js'
|
import { createSignal, createEffect, onMount } from 'solid-js'
|
||||||
import { FiCopy } from 'solid-icons/fi'
|
import { FiCopy } from 'solid-icons/fi'
|
||||||
import * as cjs from 'crypto-js'
|
import * as cjs from 'crypto-js'
|
||||||
import Alert from '../../Alert/Alert.tsx'
|
import Alert from '../../Alert/Alert.tsx'
|
||||||
|
|
@ -10,8 +10,10 @@ import Input from '../../Input/Input.tsx'
|
||||||
const { MD5, SHA1, SHA224, SHA256, SHA384, SHA512, SHA3, HmacMD5, HmacSHA1, HmacSHA224, HmacSHA256, HmacSHA384, HmacSHA512, HmacSHA3 } = cjs
|
const { MD5, SHA1, SHA224, SHA256, SHA384, SHA512, SHA3, HmacMD5, HmacSHA1, HmacSHA224, HmacSHA256, HmacSHA384, HmacSHA512, HmacSHA3 } = cjs
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const [plainText, setPlainText] = createSignal('Change me...')
|
const [plainText, setPlainText] = createSignal('')
|
||||||
const [passphrase, setPassphrase] = createSignal('This is a sample secret passphrase, change me...')
|
const [passphrase, setPassphrase] = createSignal('')
|
||||||
|
const [copiedText, setCopiedText] = createSignal('')
|
||||||
|
|
||||||
const [md5, setMd5] = createSignal('')
|
const [md5, setMd5] = createSignal('')
|
||||||
const [md6, setMd6] = createSignal('')
|
const [md6, setMd6] = createSignal('')
|
||||||
const [sha1, setSha1] = createSignal('')
|
const [sha1, setSha1] = createSignal('')
|
||||||
|
|
@ -28,13 +30,11 @@ export default () => {
|
||||||
const [hmacSha512, setHmacsha512] = createSignal('')
|
const [hmacSha512, setHmacsha512] = createSignal('')
|
||||||
const [hmacSha3, setHmacsha3] = createSignal('')
|
const [hmacSha3, setHmacsha3] = createSignal('')
|
||||||
|
|
||||||
const [pepper, setPepper] = createSignal('')
|
// const [pepper, setPepper] = createSignal('')
|
||||||
const [argon2, setArgon2] = createSignal('')
|
// const [argon2, setArgon2] = createSignal('')
|
||||||
const [bcrypt, setBcrypt] = createSignal('')
|
// const [bcrypt, setBcrypt] = createSignal('')
|
||||||
const [scrypt, setScrypt] = createSignal('')
|
// const [scrypt, setScrypt] = createSignal('')
|
||||||
const [PBKDF2, setPBKDF2] = createSignal('')
|
// const [PBKDF2, setPBKDF2] = createSignal('')
|
||||||
|
|
||||||
const [copiedText, setCopiedText] = createSignal('')
|
|
||||||
|
|
||||||
const hashingPlainText = () => {
|
const hashingPlainText = () => {
|
||||||
setMd5(MD5(plainText()).toString())
|
setMd5(MD5(plainText()).toString())
|
||||||
|
|
@ -54,6 +54,11 @@ export default () => {
|
||||||
setHmacsha3(HmacSHA3(plainText(), passphrase()).toString())
|
setHmacsha3(HmacSHA3(plainText(), passphrase()).toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
setPlainText('Change me...')
|
||||||
|
setPassphrase('This is a sample secret passphrase, change me...')
|
||||||
|
})
|
||||||
|
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
hashingPlainText()
|
hashingPlainText()
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue