mirror of
https://github.com/iib0011/omni-tools.git
synced 2026-11-30 17:11:07 +03:00
rebase
This commit is contained in:
1 parent
b22e322f2c
commit
322d3acb47
5 files changed
+158
No files matched your search
Generated
+15
@@ -26,6 +26,7 @@
|
||||
"@types/morsee": "^1.0.2",
|
||||
"@types/omggif": "^1.0.5",
|
||||
"@types/react-i18next": "^7.8.3",
|
||||
"bcryptjs": "^2.4.3",
|
||||
"browser-image-compression": "^2.0.2",
|
||||
"buffer": "^6.0.3",
|
||||
"color": "^4.2.3",
|
||||
@@ -79,6 +80,7 @@
|
||||
"@iconify/react": "^5.2.0",
|
||||
"@testing-library/jest-dom": "^6.4.5",
|
||||
"@testing-library/react": "^14.3.1",
|
||||
"@types/bcryptjs": "^2.4.6",
|
||||
"@types/color": "^3.0.6",
|
||||
"@types/color-rgba": "^2.1.2",
|
||||
"@types/node": "^20.12.12",
|
||||
@@ -3367,6 +3369,13 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/bcryptjs": {
|
||||
"version": "2.4.6",
|
||||
"resolved": "https://registry.npmjs.org/@types/bcryptjs/-/bcryptjs-2.4.6.tgz",
|
||||
"integrity": "sha512-9xlo6R2qDs5uixm0bcIqCeMCE6HiQsIyel9KQySStiyqNl2tnj2mP3DX1Nf56MD6KMenNNlBBsy3LJ7gUEQPXQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/color": {
|
||||
"version": "3.0.6",
|
||||
"resolved": "https://registry.npmjs.org/@types/color/-/color-3.0.6.tgz",
|
||||
@@ -4500,6 +4509,12 @@
|
||||
"baseline-browser-mapping": "dist/cli.js"
|
||||
}
|
||||
},
|
||||
"node_modules/bcryptjs": {
|
||||
"version": "2.4.3",
|
||||
"resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-2.4.3.tgz",
|
||||
"integrity": "sha512-V/Hy/X9Vt7f3BbPJEi8BdVFMByHi+jNXrYkW3huaybV/kQ0KJg0Y6PkEMbn+zeT+i+SiKZ/HMqJGIIt4LZDqNQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/binary-extensions": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz",
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
"@types/lodash": "^4.17.5",
|
||||
"@types/morsee": "^1.0.2",
|
||||
"@types/omggif": "^1.0.5",
|
||||
"bcryptjs": "^2.4.3",
|
||||
"@types/react-i18next": "^7.8.3",
|
||||
"browser-image-compression": "^2.0.2",
|
||||
"buffer": "^6.0.3",
|
||||
@@ -98,6 +99,7 @@
|
||||
"@iconify/react": "^5.2.0",
|
||||
"@testing-library/jest-dom": "^6.4.5",
|
||||
"@testing-library/react": "^14.3.1",
|
||||
"@types/bcryptjs": "^2.4.6",
|
||||
"@types/color": "^3.0.6",
|
||||
"@types/color-rgba": "^2.1.2",
|
||||
"@types/node": "^20.12.12",
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
import React, { useState } from 'react';
|
||||
import {
|
||||
Box,
|
||||
Card,
|
||||
CardContent,
|
||||
TextField,
|
||||
Typography,
|
||||
Slider,
|
||||
Button,
|
||||
Alert
|
||||
} from '@mui/material';
|
||||
import { ToolComponentProps } from '../../../../tools/defineTool';
|
||||
import InfoIcon from '@mui/icons-material/Info';
|
||||
|
||||
const Component: React.FC<ToolComponentProps> = ({ title }) => {
|
||||
const [input, setInput] = useState('');
|
||||
const [hash, setHash] = useState('');
|
||||
const [saltRounds, setSaltRounds] = useState(10);
|
||||
const [error, setError] = useState('');
|
||||
|
||||
const generateHash = async () => {
|
||||
try {
|
||||
setError('');
|
||||
const bcrypt = await import('bcryptjs');
|
||||
const hashedPassword = await bcrypt.hash(input, saltRounds);
|
||||
setHash(hashedPassword);
|
||||
} catch (err) {
|
||||
setError('Failed to generate hash. Please try again.');
|
||||
console.error('Hash generation error:', err);
|
||||
}
|
||||
};
|
||||
|
||||
const copyToClipboard = () => {
|
||||
navigator.clipboard.writeText(hash);
|
||||
};
|
||||
|
||||
return (
|
||||
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
|
||||
<Alert severity="info" icon={<InfoIcon />}>
|
||||
BCrypt is a password hashing function designed to be computationally
|
||||
expensive, making it resistant to brute-force attacks. Higher salt
|
||||
rounds increase security but also increase computation time.
|
||||
</Alert>
|
||||
|
||||
<Card>
|
||||
<CardContent>
|
||||
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
|
||||
<Box>
|
||||
<Typography variant="subtitle1" gutterBottom>
|
||||
Input Text
|
||||
</Typography>
|
||||
<TextField
|
||||
fullWidth
|
||||
value={input}
|
||||
onChange={(e) => setInput(e.target.value)}
|
||||
placeholder="Enter text to hash"
|
||||
variant="outlined"
|
||||
/>
|
||||
</Box>
|
||||
|
||||
<Box>
|
||||
<Typography variant="subtitle1" gutterBottom>
|
||||
Salt Rounds: {saltRounds}
|
||||
</Typography>
|
||||
<Slider
|
||||
value={saltRounds}
|
||||
onChange={(_, value) => setSaltRounds(value as number)}
|
||||
min={4}
|
||||
max={12}
|
||||
step={1}
|
||||
marks
|
||||
valueLabelDisplay="auto"
|
||||
/>
|
||||
</Box>
|
||||
|
||||
<Button
|
||||
variant="contained"
|
||||
onClick={generateHash}
|
||||
disabled={!input}
|
||||
fullWidth
|
||||
>
|
||||
Generate Hash
|
||||
</Button>
|
||||
|
||||
{error && (
|
||||
<Typography color="error" variant="body2">
|
||||
{error}
|
||||
</Typography>
|
||||
)}
|
||||
|
||||
{hash && (
|
||||
<Box>
|
||||
<Typography variant="subtitle1" gutterBottom>
|
||||
Generated Hash
|
||||
</Typography>
|
||||
<Box sx={{ display: 'flex', gap: 1 }}>
|
||||
<TextField
|
||||
fullWidth
|
||||
value={hash}
|
||||
InputProps={{
|
||||
readOnly: true
|
||||
}}
|
||||
variant="outlined"
|
||||
/>
|
||||
<Button variant="outlined" onClick={copyToClipboard}>
|
||||
Copy
|
||||
</Button>
|
||||
</Box>
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default Component;
|
||||
@@ -0,0 +1,21 @@
|
||||
import { defineTool } from '../../../../tools/defineTool';
|
||||
import { lazy } from 'react';
|
||||
|
||||
const Component = lazy(() => import('./Component'));
|
||||
|
||||
export const tool = defineTool('string', {
|
||||
path: 'bcrypt',
|
||||
name: 'BCrypt Hash',
|
||||
description: 'Generate BCrypt hashes from text with customizable salt rounds',
|
||||
shortDescription: 'Generate secure BCrypt hashes',
|
||||
keywords: [
|
||||
'bcrypt',
|
||||
'hash',
|
||||
'password',
|
||||
'security',
|
||||
'encryption',
|
||||
'cryptography'
|
||||
],
|
||||
icon: 'mdi:lock',
|
||||
component: Component
|
||||
});
|
||||
@@ -44,6 +44,8 @@ export const stringTools = [
|
||||
stringRot13,
|
||||
stringBase64,
|
||||
stringStatistic,
|
||||
stringBcrypt,
|
||||
stringStatistic,
|
||||
stringCensor,
|
||||
stringPasswordGenerator,
|
||||
stringEncodeUrl,
|
||||
|
||||
Reference in new issue
Block a user