Skip to content

Commit

Permalink
Merge pull request #38 from CodeDead/release/2.1.1
Browse files Browse the repository at this point in the history
Release/2.1.1
  • Loading branch information
CodeDead authored Feb 4, 2021
2 parents a04df05 + 886c80d commit 151dbde
Show file tree
Hide file tree
Showing 31 changed files with 1,555 additions and 250 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"env": {
"browser": true,
"es2020": true,
"es2021": true,
"node": true
},
"extends": [
Expand All @@ -12,7 +12,7 @@
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 11,
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
Expand Down
23 changes: 21 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

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

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

* MD4
* MD5
Expand All @@ -16,9 +16,28 @@ DeadHash is a free and open-source utility to calculate file and text hashes. Th
* SHA-384
* SHA-512
* RIPEMD-160
* CRC32

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

## Building

In order to produce binary distributable files or to start a development build, you must first issue the following command,
in order to ensure that the React build is up-to-date:
```
yarn react-build
```

After running `yarn react-build`, you can issue the following command in order to produce the binary distributable files:
```
yarn build
```

If you want to start the development version, you can issue the following command, after running `yarn react-build`:
```
yarn start
```

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "deadhash",
"version": "2.1.0",
"version": "2.1.1",
"description": "File and text hash calculator",
"homepage": "./",
"private": true,
Expand Down Expand Up @@ -37,14 +37,15 @@
"dependencies": {
"@material-ui/core": "^4.11.3",
"@material-ui/icons": "^4.11.2",
"crc": "^3.8.0",
"cross-env": "^7.0.3",
"electron-is-dev": "^1.2.0",
"react": "^17.0.1",
"react-contexify": "^5.0.0",
"react-dom": "^17.0.1",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"react-scripts": "^4.0.1"
"react-scripts": "^4.0.2"
},
"scripts": {
"react-start": "react-scripts start",
Expand All @@ -70,8 +71,9 @@
},
"devDependencies": {
"concurrently": "^5.3.0",
"electron": "^11.2.1",
"electron": "^11.2.2",
"electron-builder": "^22.9.1",
"eslint": "^7.19.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jsx-a11y": "^6.4.1",
Expand Down
16 changes: 13 additions & 3 deletions public/workers/FileWorker/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
const ipcRenderer = window.require('electron').ipcRenderer;
const fs = window.require('fs');
const crypto = window.require('crypto');
const crc32Calculator = require('crc').crc32;

const fileHash = (filePath, md4, md5, sha1, sha224, sha256, sha384, sha512, ripemd160) => {
const fileHash = (filePath, md4, md5, sha1, sha224, sha256, sha384, sha512, ripemd160, crc32) => {
return new Promise((resolve, reject) => {
let MD4,
MD5,
Expand All @@ -19,7 +20,8 @@
SHA256,
SHA384,
SHA512,
RIPEMD160;
RIPEMD160,
crc32Checksum;

if (md4) MD4 = crypto.createHash('md4');
if (md5) MD5 = crypto.createHash('md5');
Expand All @@ -30,6 +32,7 @@
if (sha512) SHA512 = crypto.createHash('sha512');
if (ripemd160) RIPEMD160 = crypto.createHash('ripemd160');


try {
const s = fs.createReadStream(filePath.toString());

Expand All @@ -42,6 +45,7 @@
if (sha384) SHA384.update(data);
if (sha512) SHA512.update(data);
if (ripemd160) RIPEMD160.update(data);
if (crc32) crc32Checksum = crc32Calculator(data, crc32Checksum);
});

s.on('end', () => {
Expand Down Expand Up @@ -103,6 +107,12 @@
.toString()
});
}
if (crc32) {
newHashes.push({
type: 'CRC32',
hash: crc32Checksum.toString(16),
});
}

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

Expand All @@ -120,7 +130,7 @@
}

ipcRenderer.on("calculate-file-hash", (e, data) => {
fileHash(data.filePath, data.md4, data.md5, data.sha1, data.sha224, data.sha256, data.sha384, data.sha512, data.ripemd160)
fileHash(data.filePath, data.md4, data.md5, data.sha1, data.sha224, data.sha256, data.sha384, data.sha512, data.ripemd160, data.crc32)
.then(data => {
ipcRenderer.send("file-hash-calculated", data);
})
Expand Down
11 changes: 9 additions & 2 deletions public/workers/TextWorker/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
const ipcRenderer = window.require('electron').ipcRenderer;
const crypto = window.require('crypto');

const textHash = (text, md4, md5, sha1, sha224, sha256, sha384, sha512, ripemd160) => {
const textHash = (text, md4, md5, sha1, sha224, sha256, sha384, sha512, ripemd160, crc32) => {
return new Promise((resolve, reject) => {
let newHashes = [];
try {
Expand Down Expand Up @@ -85,6 +85,13 @@
.toString()
});
}
if (crc32) {
const { crc32 } = require('crc');
newHashes.push({
type: 'CRC32',
hash: crc32(text).toString(16),
});
}

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

Expand All @@ -96,7 +103,7 @@
};

ipcRenderer.on('calculate-text-hash', (e, data) => {
textHash(data.text, data.md4, data.md5, data.sha1, data.sha224, data.sha256, data.sha384, data.sha512, data.ripemd160)
textHash(data.text, data.md4, data.md5, data.sha1, data.sha224, data.sha256, data.sha384, data.sha512, data.ripemd160, data.crc32)
.then(data => {
ipcRenderer.send('text-hash-calculated', data);
})
Expand Down
4 changes: 2 additions & 2 deletions src/components/App/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { createMuiTheme, ThemeProvider } from '@material-ui/core/styles';
import Home from '../../routes/Home';
import Settings from '../../routes/Settings';
import ThemeSelector from '../../utils/ThemeSelector';
import Topbar from '../Topbar';
import TopBar from '../TopBar';
import About from '../../routes/About';
import File from '../../routes/File';
import Text from '../../routes/Text';
Expand Down Expand Up @@ -71,7 +71,7 @@ const App = () => {
<ThemeProvider theme={theme}>
<BrowserRouter>
<DropZone enabled={enabled} onDrop={onDrop} reRoute="/file">
<Topbar />
<TopBar />
<CssBaseline />
<Switch>
<Route path="/settings">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const useStyles = makeStyles((theme) => ({

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

const Drawerbar = ({ open, onClose }) => {
const DrawerBar = ({ open, onClose }) => {
const [state] = useContext(MainContext);
const language = state.languages[state.languageIndex];
const selectedItem = state.selectedListItem;
Expand Down Expand Up @@ -145,4 +145,4 @@ const Drawerbar = ({ open, onClose }) => {
);
};

export default Drawerbar;
export default DrawerBar;
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ import MenuIcon from '@material-ui/icons/Menu';
import Menu from '@material-ui/core/Menu';
import MenuItem from '@material-ui/core/MenuItem';
import CloseIcon from '@material-ui/icons/Close';
import Brightness5Icon from '@material-ui/icons/Brightness5';
import Brightness7Icon from '@material-ui/icons/Brightness7';
import MinimizeIcon from '@material-ui/icons/Minimize';
import FullScreenIcon from '@material-ui/icons/Fullscreen';
import FullscreenExitIcon from '@material-ui/icons/FullscreenExit';
import Drawerbar from '../Drawerbar';
import { setLanguageIndex } from '../../reducers/MainReducer/Actions';
import DrawerBar from '../DrawerBar';
import { setLanguageIndex, setThemeStyle } from '../../reducers/MainReducer/Actions';
import { MainContext } from '../../contexts/MainContextProvider';

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

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

const Topbar = () => {
const TopBar = () => {
const [state, d1] = useContext(MainContext);

const {
languageIndex, minimizeEnabled, maximizeEnabled, languageEnabled,
languageIndex,
minimizeEnabled,
maximizeEnabled,
languageEnabled,
themeStyle,
themeToggleEnabled,
} = state;
const language = state.languages[languageIndex];

Expand Down Expand Up @@ -124,6 +131,13 @@ const Topbar = () => {
ipcRenderer.send('handle-maximize');
};

/**
* Change the theme style
*/
const changeThemeStyle = () => {
d1(setThemeStyle(themeStyle === 'dark' ? 'light' : 'dark'));
};

return (
<div className={classes.root}>
<AppBar
Expand All @@ -145,6 +159,12 @@ const Topbar = () => {
{language.appName}
</Typography>

{themeToggleEnabled ? (
<IconButton color="inherit" onClick={changeThemeStyle}>
{themeStyle === 'dark' ? <Brightness5Icon /> : <Brightness7Icon />}
</IconButton>
) : null}

{languageEnabled
? (
<div>
Expand Down Expand Up @@ -264,10 +284,10 @@ const Topbar = () => {
</IconButton>
</Toolbar>
</AppBar>
<Drawerbar open={drawerOpen} onClose={() => setDrawerOpen(false)} />
<DrawerBar open={drawerOpen} onClose={() => setDrawerOpen(false)} />
<Toolbar />
</div>
);
};

export default Topbar;
export default TopBar;
2 changes: 2 additions & 0 deletions src/contexts/CryptoContextReducer/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const sha256 = localStorage.sha256 && localStorage.sha256 === 'true' ? true : !l
const sha384 = localStorage.sha384 && localStorage.sha384 === 'true' ? true : !localStorage.sha384;
const sha512 = localStorage.sha512 && localStorage.sha512 === 'true' ? true : !localStorage.sha512;
const ripemd160 = localStorage.ripemd160 && localStorage.ripemd160 === 'true' ? true : !localStorage.ripemd160;
const crc32 = localStorage.crc32 && localStorage.crc32 === 'true' ? true : !localStorage.crc32;

const initState = {
md4,
Expand All @@ -19,6 +20,7 @@ const initState = {
sha384,
sha512,
ripemd160,
crc32,
fileHashes: null,
textHashes: null,
textInput: '',
Expand Down
2 changes: 2 additions & 0 deletions src/contexts/MainContextProvider/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const autoUpdate = localStorage.autoUpdate && localStorage.autoUpdate === 'true'
const minimizeEnabled = localStorage.minimizeEnabled && localStorage.minimizeEnabled === 'true' ? true : !localStorage.minimizeEnabled;
const maximizeEnabled = localStorage.maximizeEnabled && localStorage.maximizeEnabled === 'true' ? true : !localStorage.maximizeEnabled;
const languageEnabled = localStorage.languageEnabled && localStorage.languageEnabled === 'true' ? true : !localStorage.languageEnabled;
const themeToggleEnabled = localStorage.themeToggleEnabled && localStorage.themeToggleEnabled === 'true' ? true : !localStorage.themeToggleEnabled;
const canDragDrop = localStorage.canDragDrop && localStorage.canDragDrop === 'true' ? true : !localStorage.canDragDrop;

const initState = {
Expand All @@ -53,6 +54,7 @@ const initState = {
minimizeEnabled,
maximizeEnabled,
languageEnabled,
themeToggleEnabled,
canDragDrop,
};

Expand Down
2 changes: 2 additions & 0 deletions src/languages/de_DE/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const de_DE = () => ({
sha512: 'SHA-512',
ripemd160: 'RIPEMD-160',
sha224: 'SHA-224',
crc32: 'CRC32',
file: 'Datei',
fileSubtitle: 'Berechnen Sie Datei-Hashes',
text: 'Text',
Expand Down Expand Up @@ -80,6 +81,7 @@ const de_DE = () => ({
dark: 'Dunkel',
orange: 'Orange',
orangeThemeDescription: 'Lass uns Niederländisch werden.',
themeToggleEnabled: 'Thema umschalten',
});

// eslint-disable-next-line camelcase
Expand Down
2 changes: 2 additions & 0 deletions src/languages/en_US/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const en_US = () => ({
sha512: 'SHA-512',
ripemd160: 'RIPEMD-160',
sha224: 'SHA-224',
crc32: 'CRC32',
file: 'File',
fileSubtitle: 'Calculate file hashes',
text: 'Text',
Expand Down Expand Up @@ -80,6 +81,7 @@ const en_US = () => ({
dark: 'Dark',
orange: 'Orange',
orangeThemeDescription: 'Let\'s get Dutch.',
themeToggleEnabled: 'Theme toggle',
});

// eslint-disable-next-line camelcase
Expand Down
2 changes: 2 additions & 0 deletions src/languages/es_ES/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const es_ES = () => ({
sha512: 'SHA-512',
ripemd160: 'RIPEMD-160',
sha224: 'SHA-224',
crc32: 'CRC32',
file: 'Archivo',
fileSubtitle: 'Calcular hashes de archivos',
text: 'Texto',
Expand Down Expand Up @@ -80,6 +81,7 @@ const es_ES = () => ({
dark: 'Oscuro',
orange: 'Naranja',
orangeThemeDescription: 'Vamos a holandeses.',
themeToggleEnabled: 'Alternar tema',
});

// eslint-disable-next-line camelcase
Expand Down
2 changes: 2 additions & 0 deletions src/languages/fr_FR/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const fr_FR = () => ({
sha512: 'SHA-512',
ripemd160: 'RIPEMD-160',
sha224: 'SHA-224',
crc32: 'CRC32',
file: 'File',
fileSubtitle: 'Calculer les hachages de fichier',
text: 'Texte',
Expand Down Expand Up @@ -80,6 +81,7 @@ const fr_FR = () => ({
dark: 'Foncé',
orange: 'Orange',
orangeThemeDescription: 'Il faut que ça Néerlandais.',
themeToggleEnabled: 'Basculer le thème',
});

// eslint-disable-next-line camelcase
Expand Down
Loading

0 comments on commit 151dbde

Please sign in to comment.