Skip to content

Commit 151dbde

Browse files
authored
Merge pull request #38 from CodeDead/release/2.1.1
Release/2.1.1
2 parents a04df05 + 886c80d commit 151dbde

File tree

31 files changed

+1555
-250
lines changed

31 files changed

+1555
-250
lines changed

.eslintrc.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"env": {
33
"browser": true,
4-
"es2020": true,
4+
"es2021": true,
55
"node": true
66
},
77
"extends": [
@@ -12,7 +12,7 @@
1212
"ecmaFeatures": {
1313
"jsx": true
1414
},
15-
"ecmaVersion": 11,
15+
"ecmaVersion": 12,
1616
"sourceType": "module"
1717
},
1818
"plugins": [

README.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
![GitHub package.json version](https://img.shields.io/github/package-json/v/CodeDead/DeadHash-js)
66
![GitHub](https://img.shields.io/github/license/CodeDead/DeadHash-Js)
7-
![GitHub Releases (by Release)](https://img.shields.io/github/downloads/CodeDead/DeadHash-js/2.1.0/total)
7+
![GitHub Releases (by Release)](https://img.shields.io/github/downloads/CodeDead/DeadHash-js/2.1.1/total)
88

9-
DeadHash is a free and open-source utility to calculate file and text hashes. The following hash calculations are supported:
9+
DeadHash is a free and open-source utility to calculate file and text hashes and checksums. The following calculations are supported:
1010

1111
* MD4
1212
* MD5
@@ -16,9 +16,28 @@ DeadHash is a free and open-source utility to calculate file and text hashes. Th
1616
* SHA-384
1717
* SHA-512
1818
* RIPEMD-160
19+
* CRC32
1920

2021
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app) and built using [Electron](https://electronjs.org/).
2122

23+
## Building
24+
25+
In order to produce binary distributable files or to start a development build, you must first issue the following command,
26+
in order to ensure that the React build is up-to-date:
27+
```
28+
yarn react-build
29+
```
30+
31+
After running `yarn react-build`, you can issue the following command in order to produce the binary distributable files:
32+
```
33+
yarn build
34+
```
35+
36+
If you want to start the development version, you can issue the following command, after running `yarn react-build`:
37+
```
38+
yarn start
39+
```
40+
2241
## Learn More
2342

2443
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "deadhash",
3-
"version": "2.1.0",
3+
"version": "2.1.1",
44
"description": "File and text hash calculator",
55
"homepage": "./",
66
"private": true,
@@ -37,14 +37,15 @@
3737
"dependencies": {
3838
"@material-ui/core": "^4.11.3",
3939
"@material-ui/icons": "^4.11.2",
40+
"crc": "^3.8.0",
4041
"cross-env": "^7.0.3",
4142
"electron-is-dev": "^1.2.0",
4243
"react": "^17.0.1",
4344
"react-contexify": "^5.0.0",
4445
"react-dom": "^17.0.1",
4546
"react-router": "^5.2.0",
4647
"react-router-dom": "^5.2.0",
47-
"react-scripts": "^4.0.1"
48+
"react-scripts": "^4.0.2"
4849
},
4950
"scripts": {
5051
"react-start": "react-scripts start",
@@ -70,8 +71,9 @@
7071
},
7172
"devDependencies": {
7273
"concurrently": "^5.3.0",
73-
"electron": "^11.2.1",
74+
"electron": "^11.2.2",
7475
"electron-builder": "^22.9.1",
76+
"eslint": "^7.19.0",
7577
"eslint-config-airbnb": "^18.2.1",
7678
"eslint-plugin-import": "^2.22.1",
7779
"eslint-plugin-jsx-a11y": "^6.4.1",

public/workers/FileWorker/index.html

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
const ipcRenderer = window.require('electron').ipcRenderer;
1010
const fs = window.require('fs');
1111
const crypto = window.require('crypto');
12+
const crc32Calculator = require('crc').crc32;
1213

13-
const fileHash = (filePath, md4, md5, sha1, sha224, sha256, sha384, sha512, ripemd160) => {
14+
const fileHash = (filePath, md4, md5, sha1, sha224, sha256, sha384, sha512, ripemd160, crc32) => {
1415
return new Promise((resolve, reject) => {
1516
let MD4,
1617
MD5,
@@ -19,7 +20,8 @@
1920
SHA256,
2021
SHA384,
2122
SHA512,
22-
RIPEMD160;
23+
RIPEMD160,
24+
crc32Checksum;
2325

2426
if (md4) MD4 = crypto.createHash('md4');
2527
if (md5) MD5 = crypto.createHash('md5');
@@ -30,6 +32,7 @@
3032
if (sha512) SHA512 = crypto.createHash('sha512');
3133
if (ripemd160) RIPEMD160 = crypto.createHash('ripemd160');
3234

35+
3336
try {
3437
const s = fs.createReadStream(filePath.toString());
3538

@@ -42,6 +45,7 @@
4245
if (sha384) SHA384.update(data);
4346
if (sha512) SHA512.update(data);
4447
if (ripemd160) RIPEMD160.update(data);
48+
if (crc32) crc32Checksum = crc32Calculator(data, crc32Checksum);
4549
});
4650

4751
s.on('end', () => {
@@ -103,6 +107,12 @@
103107
.toString()
104108
});
105109
}
110+
if (crc32) {
111+
newHashes.push({
112+
type: 'CRC32',
113+
hash: crc32Checksum.toString(16),
114+
});
115+
}
106116

107117
if (newHashes.length === 0) newHashes = null;
108118

@@ -120,7 +130,7 @@
120130
}
121131

122132
ipcRenderer.on("calculate-file-hash", (e, data) => {
123-
fileHash(data.filePath, data.md4, data.md5, data.sha1, data.sha224, data.sha256, data.sha384, data.sha512, data.ripemd160)
133+
fileHash(data.filePath, data.md4, data.md5, data.sha1, data.sha224, data.sha256, data.sha384, data.sha512, data.ripemd160, data.crc32)
124134
.then(data => {
125135
ipcRenderer.send("file-hash-calculated", data);
126136
})

public/workers/TextWorker/index.html

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
const ipcRenderer = window.require('electron').ipcRenderer;
1010
const crypto = window.require('crypto');
1111

12-
const textHash = (text, md4, md5, sha1, sha224, sha256, sha384, sha512, ripemd160) => {
12+
const textHash = (text, md4, md5, sha1, sha224, sha256, sha384, sha512, ripemd160, crc32) => {
1313
return new Promise((resolve, reject) => {
1414
let newHashes = [];
1515
try {
@@ -85,6 +85,13 @@
8585
.toString()
8686
});
8787
}
88+
if (crc32) {
89+
const { crc32 } = require('crc');
90+
newHashes.push({
91+
type: 'CRC32',
92+
hash: crc32(text).toString(16),
93+
});
94+
}
8895

8996
if (newHashes.length === 0) newHashes = null;
9097

@@ -96,7 +103,7 @@
96103
};
97104

98105
ipcRenderer.on('calculate-text-hash', (e, data) => {
99-
textHash(data.text, data.md4, data.md5, data.sha1, data.sha224, data.sha256, data.sha384, data.sha512, data.ripemd160)
106+
textHash(data.text, data.md4, data.md5, data.sha1, data.sha224, data.sha256, data.sha384, data.sha512, data.ripemd160, data.crc32)
100107
.then(data => {
101108
ipcRenderer.send('text-hash-calculated', data);
102109
})

src/components/App/index.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { createMuiTheme, ThemeProvider } from '@material-ui/core/styles';
55
import Home from '../../routes/Home';
66
import Settings from '../../routes/Settings';
77
import ThemeSelector from '../../utils/ThemeSelector';
8-
import Topbar from '../Topbar';
8+
import TopBar from '../TopBar';
99
import About from '../../routes/About';
1010
import File from '../../routes/File';
1111
import Text from '../../routes/Text';
@@ -71,7 +71,7 @@ const App = () => {
7171
<ThemeProvider theme={theme}>
7272
<BrowserRouter>
7373
<DropZone enabled={enabled} onDrop={onDrop} reRoute="/file">
74-
<Topbar />
74+
<TopBar />
7575
<CssBaseline />
7676
<Switch>
7777
<Route path="/settings">

src/components/Drawerbar/index.jsx renamed to src/components/DrawerBar/index.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const useStyles = makeStyles((theme) => ({
3737

3838
const { ipcRenderer } = window.require('electron');
3939

40-
const Drawerbar = ({ open, onClose }) => {
40+
const DrawerBar = ({ open, onClose }) => {
4141
const [state] = useContext(MainContext);
4242
const language = state.languages[state.languageIndex];
4343
const selectedItem = state.selectedListItem;
@@ -145,4 +145,4 @@ const Drawerbar = ({ open, onClose }) => {
145145
);
146146
};
147147

148-
export default Drawerbar;
148+
export default DrawerBar;

src/components/Topbar/index.jsx renamed to src/components/TopBar/index.jsx

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ import MenuIcon from '@material-ui/icons/Menu';
99
import Menu from '@material-ui/core/Menu';
1010
import MenuItem from '@material-ui/core/MenuItem';
1111
import CloseIcon from '@material-ui/icons/Close';
12+
import Brightness5Icon from '@material-ui/icons/Brightness5';
13+
import Brightness7Icon from '@material-ui/icons/Brightness7';
1214
import MinimizeIcon from '@material-ui/icons/Minimize';
1315
import FullScreenIcon from '@material-ui/icons/Fullscreen';
1416
import FullscreenExitIcon from '@material-ui/icons/FullscreenExit';
15-
import Drawerbar from '../Drawerbar';
16-
import { setLanguageIndex } from '../../reducers/MainReducer/Actions';
17+
import DrawerBar from '../DrawerBar';
18+
import { setLanguageIndex, setThemeStyle } from '../../reducers/MainReducer/Actions';
1719
import { MainContext } from '../../contexts/MainContextProvider';
1820

1921
const drawerWidth = 220;
@@ -45,11 +47,16 @@ const useStyles = makeStyles((theme) => ({
4547

4648
const { ipcRenderer } = window.require('electron');
4749

48-
const Topbar = () => {
50+
const TopBar = () => {
4951
const [state, d1] = useContext(MainContext);
5052

5153
const {
52-
languageIndex, minimizeEnabled, maximizeEnabled, languageEnabled,
54+
languageIndex,
55+
minimizeEnabled,
56+
maximizeEnabled,
57+
languageEnabled,
58+
themeStyle,
59+
themeToggleEnabled,
5360
} = state;
5461
const language = state.languages[languageIndex];
5562

@@ -124,6 +131,13 @@ const Topbar = () => {
124131
ipcRenderer.send('handle-maximize');
125132
};
126133

134+
/**
135+
* Change the theme style
136+
*/
137+
const changeThemeStyle = () => {
138+
d1(setThemeStyle(themeStyle === 'dark' ? 'light' : 'dark'));
139+
};
140+
127141
return (
128142
<div className={classes.root}>
129143
<AppBar
@@ -145,6 +159,12 @@ const Topbar = () => {
145159
{language.appName}
146160
</Typography>
147161

162+
{themeToggleEnabled ? (
163+
<IconButton color="inherit" onClick={changeThemeStyle}>
164+
{themeStyle === 'dark' ? <Brightness5Icon /> : <Brightness7Icon />}
165+
</IconButton>
166+
) : null}
167+
148168
{languageEnabled
149169
? (
150170
<div>
@@ -264,10 +284,10 @@ const Topbar = () => {
264284
</IconButton>
265285
</Toolbar>
266286
</AppBar>
267-
<Drawerbar open={drawerOpen} onClose={() => setDrawerOpen(false)} />
287+
<DrawerBar open={drawerOpen} onClose={() => setDrawerOpen(false)} />
268288
<Toolbar />
269289
</div>
270290
);
271291
};
272292

273-
export default Topbar;
293+
export default TopBar;

src/contexts/CryptoContextReducer/index.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const sha256 = localStorage.sha256 && localStorage.sha256 === 'true' ? true : !l
99
const sha384 = localStorage.sha384 && localStorage.sha384 === 'true' ? true : !localStorage.sha384;
1010
const sha512 = localStorage.sha512 && localStorage.sha512 === 'true' ? true : !localStorage.sha512;
1111
const ripemd160 = localStorage.ripemd160 && localStorage.ripemd160 === 'true' ? true : !localStorage.ripemd160;
12+
const crc32 = localStorage.crc32 && localStorage.crc32 === 'true' ? true : !localStorage.crc32;
1213

1314
const initState = {
1415
md4,
@@ -19,6 +20,7 @@ const initState = {
1920
sha384,
2021
sha512,
2122
ripemd160,
23+
crc32,
2224
fileHashes: null,
2325
textHashes: null,
2426
textInput: '',

src/contexts/MainContextProvider/index.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const autoUpdate = localStorage.autoUpdate && localStorage.autoUpdate === 'true'
2828
const minimizeEnabled = localStorage.minimizeEnabled && localStorage.minimizeEnabled === 'true' ? true : !localStorage.minimizeEnabled;
2929
const maximizeEnabled = localStorage.maximizeEnabled && localStorage.maximizeEnabled === 'true' ? true : !localStorage.maximizeEnabled;
3030
const languageEnabled = localStorage.languageEnabled && localStorage.languageEnabled === 'true' ? true : !localStorage.languageEnabled;
31+
const themeToggleEnabled = localStorage.themeToggleEnabled && localStorage.themeToggleEnabled === 'true' ? true : !localStorage.themeToggleEnabled;
3132
const canDragDrop = localStorage.canDragDrop && localStorage.canDragDrop === 'true' ? true : !localStorage.canDragDrop;
3233

3334
const initState = {
@@ -53,6 +54,7 @@ const initState = {
5354
minimizeEnabled,
5455
maximizeEnabled,
5556
languageEnabled,
57+
themeToggleEnabled,
5658
canDragDrop,
5759
};
5860

src/languages/de_DE/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const de_DE = () => ({
4040
sha512: 'SHA-512',
4141
ripemd160: 'RIPEMD-160',
4242
sha224: 'SHA-224',
43+
crc32: 'CRC32',
4344
file: 'Datei',
4445
fileSubtitle: 'Berechnen Sie Datei-Hashes',
4546
text: 'Text',
@@ -80,6 +81,7 @@ const de_DE = () => ({
8081
dark: 'Dunkel',
8182
orange: 'Orange',
8283
orangeThemeDescription: 'Lass uns Niederländisch werden.',
84+
themeToggleEnabled: 'Thema umschalten',
8385
});
8486

8587
// eslint-disable-next-line camelcase

src/languages/en_US/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const en_US = () => ({
4040
sha512: 'SHA-512',
4141
ripemd160: 'RIPEMD-160',
4242
sha224: 'SHA-224',
43+
crc32: 'CRC32',
4344
file: 'File',
4445
fileSubtitle: 'Calculate file hashes',
4546
text: 'Text',
@@ -80,6 +81,7 @@ const en_US = () => ({
8081
dark: 'Dark',
8182
orange: 'Orange',
8283
orangeThemeDescription: 'Let\'s get Dutch.',
84+
themeToggleEnabled: 'Theme toggle',
8385
});
8486

8587
// eslint-disable-next-line camelcase

src/languages/es_ES/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const es_ES = () => ({
4040
sha512: 'SHA-512',
4141
ripemd160: 'RIPEMD-160',
4242
sha224: 'SHA-224',
43+
crc32: 'CRC32',
4344
file: 'Archivo',
4445
fileSubtitle: 'Calcular hashes de archivos',
4546
text: 'Texto',
@@ -80,6 +81,7 @@ const es_ES = () => ({
8081
dark: 'Oscuro',
8182
orange: 'Naranja',
8283
orangeThemeDescription: 'Vamos a holandeses.',
84+
themeToggleEnabled: 'Alternar tema',
8385
});
8486

8587
// eslint-disable-next-line camelcase

src/languages/fr_FR/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const fr_FR = () => ({
4040
sha512: 'SHA-512',
4141
ripemd160: 'RIPEMD-160',
4242
sha224: 'SHA-224',
43+
crc32: 'CRC32',
4344
file: 'File',
4445
fileSubtitle: 'Calculer les hachages de fichier',
4546
text: 'Texte',
@@ -80,6 +81,7 @@ const fr_FR = () => ({
8081
dark: 'Foncé',
8182
orange: 'Orange',
8283
orangeThemeDescription: 'Il faut que ça Néerlandais.',
84+
themeToggleEnabled: 'Basculer le thème',
8385
});
8486

8587
// eslint-disable-next-line camelcase

0 commit comments

Comments
 (0)