Skip to content

Commit

Permalink
Merge pull request #48 from CodeDead/release/2.1.2
Browse files Browse the repository at this point in the history
Release/2.1.2
  • Loading branch information
CodeDead authored Feb 11, 2021
2 parents 151dbde + 2a41852 commit af5aa92
Show file tree
Hide file tree
Showing 24 changed files with 378 additions and 24 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

![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.1/total)
![GitHub Releases (by Release)](https://img.shields.io/github/downloads/CodeDead/DeadHash-js/2.1.2/total)

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

Expand All @@ -16,6 +16,10 @@ DeadHash is a free and open-source utility to calculate file and text hashes and
* SHA-384
* SHA-512
* RIPEMD-160
* CRC1
* CRC8
* CRC16
* CRC24
* CRC32

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app) and built using [Electron](https://electronjs.org/).
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "deadhash",
"version": "2.1.1",
"version": "2.1.2",
"description": "File and text hash calculator",
"homepage": "./",
"private": true,
Expand Down Expand Up @@ -71,7 +71,7 @@
},
"devDependencies": {
"concurrently": "^5.3.0",
"electron": "^11.2.2",
"electron": "^11.2.3",
"electron-builder": "^22.9.1",
"eslint": "^7.19.0",
"eslint-config-airbnb": "^18.2.1",
Expand Down
51 changes: 43 additions & 8 deletions public/workers/FileWorker/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@
const ipcRenderer = window.require('electron').ipcRenderer;
const fs = window.require('fs');
const crypto = window.require('crypto');
const crc32Calculator = require('crc').crc32;
const crcCalculator = require('crc');

const fileHash = (filePath, md4, md5, sha1, sha224, sha256, sha384, sha512, ripemd160, crc32) => {
const fileHash = (
filePath, md4, md5, sha1, sha224, sha256, sha384, sha512, ripemd160,
crc1, crc8, crc16, crc24, crc32,
) => {
return new Promise((resolve, reject) => {
let MD4,
MD5,
Expand All @@ -21,7 +24,11 @@
SHA384,
SHA512,
RIPEMD160,
crc32Checksum;
crc1Checksum,
crc8Checksum,
crc16Checksum,
crc24Checksum,
crc32Checksum;

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


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

Expand All @@ -45,7 +51,11 @@
if (sha384) SHA384.update(data);
if (sha512) SHA512.update(data);
if (ripemd160) RIPEMD160.update(data);
if (crc32) crc32Checksum = crc32Calculator(data, crc32Checksum);
if (crc1) crc1Checksum = crcCalculator.crc1(data, crc1Checksum);
if (crc8) crc8Checksum = crcCalculator.crc8(data, crc8Checksum);
if (crc16) crc16Checksum = crcCalculator.crc16(data, crc16Checksum);
if (crc24) crc24Checksum = crcCalculator.crc24(data, crc24Checksum);
if (crc32) crc32Checksum = crcCalculator.crc32(data, crc32Checksum);
});

s.on('end', () => {
Expand Down Expand Up @@ -107,6 +117,30 @@
.toString()
});
}
if (crc1) {
newHashes.push({
type: 'CRC1',
hash: crc1Checksum.toString(16),
});
}
if (crc8) {
newHashes.push({
type: 'CRC8',
hash: crc8Checksum.toString(16),
});
}
if (crc16) {
newHashes.push({
type: 'CRC16',
hash: crc16Checksum.toString(16),
});
}
if (crc24) {
newHashes.push({
type: 'CRC24',
hash: crc24Checksum.toString(16),
});
}
if (crc32) {
newHashes.push({
type: 'CRC32',
Expand All @@ -115,12 +149,10 @@
}

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

return resolve(newHashes);
});

s.on('error', error => {

return reject(error);
});
} catch (error) {
Expand All @@ -130,7 +162,10 @@
}

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, data.crc32)
fileHash(
data.filePath, data.md4, data.md5, data.sha1, data.sha224, data.sha256, data.sha384, data.sha512,
data.ripemd160, data.crc1, data.crc8, data.crc16, data.crc24, data.crc32,
)
.then(data => {
ipcRenderer.send("file-hash-calculated", data);
})
Expand Down
39 changes: 36 additions & 3 deletions public/workers/TextWorker/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
const ipcRenderer = window.require('electron').ipcRenderer;
const crypto = window.require('crypto');

const textHash = (text, md4, md5, sha1, sha224, sha256, sha384, sha512, ripemd160, crc32) => {
const textHash = (
text, md4, md5, sha1, sha224, sha256, sha384, sha512, ripemd160,
crc1, crc8, crc16, crc24, crc32,
) => {
return new Promise((resolve, reject) => {
let newHashes = [];
try {
Expand Down Expand Up @@ -85,6 +88,34 @@
.toString()
});
}
if (crc1) {
const { crc1 } = require('crc');
newHashes.push({
type: 'CRC1',
hash: crc1(text).toString(16),
});
}
if (crc8) {
const { crc8 } = require('crc');
newHashes.push({
type: 'CRC8',
hash: crc8(text).toString(16),
});
}
if (crc16) {
const { crc16 } = require('crc');
newHashes.push({
type: 'CRC16',
hash: crc16(text).toString(16),
});
}
if (crc24) {
const { crc24 } = require('crc');
newHashes.push({
type: 'CRC24',
hash: crc24(text).toString(16),
});
}
if (crc32) {
const { crc32 } = require('crc');
newHashes.push({
Expand All @@ -94,7 +125,6 @@
}

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

return resolve(newHashes);
} catch (ex) {
return reject(ex);
Expand All @@ -103,7 +133,10 @@
};

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, data.crc32)
textHash(
data.text, data.md4, data.md5, data.sha1, data.sha224, data.sha256, data.sha384, data.sha512, data.ripemd160,
data.crc1, data.crc8, data.crc16, data.crc24, data.crc32,
)
.then(data => {
ipcRenderer.send('text-hash-calculated', data);
})
Expand Down
8 changes: 8 additions & 0 deletions src/contexts/CryptoContextReducer/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ 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 crc1 = !!(localStorage.crc1 && localStorage.crc1 === 'true');
const crc8 = !!(localStorage.crc8 && localStorage.crc8 === 'true');
const crc16 = !!(localStorage.crc16 && localStorage.crc16 === 'true');
const crc24 = !!(localStorage.crc24 && localStorage.crc24 === 'true');
const crc32 = localStorage.crc32 && localStorage.crc32 === 'true' ? true : !localStorage.crc32;

const initState = {
Expand All @@ -20,6 +24,10 @@ const initState = {
sha384,
sha512,
ripemd160,
crc1,
crc8,
crc16,
crc24,
crc32,
fileHashes: null,
textHashes: null,
Expand Down
11 changes: 11 additions & 0 deletions src/languages/de_DE/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ const de_DE = () => ({
sha512: 'SHA-512',
ripemd160: 'RIPEMD-160',
sha224: 'SHA-224',
crc1: 'CRC1',
crc8: 'CRC8',
crc16: 'CRC16',
crc24: 'CRC24',
crc32: 'CRC32',
file: 'Datei',
fileSubtitle: 'Berechnen Sie Datei-Hashes',
Expand Down Expand Up @@ -82,6 +86,13 @@ const de_DE = () => ({
orange: 'Orange',
orangeThemeDescription: 'Lass uns Niederländisch werden.',
themeToggleEnabled: 'Thema umschalten',
cyclicRedundancyCheck: 'Zyklische Redundanzprüfung',
deepOrange: 'Tiefes Orange',
deepOrangeDescription: 'Für den Fall, dass Orange nicht genug war.',
amber: 'Amber',
amberDescription: 'Nicht selektives Gelb.',
brown: 'Braun',
brownDescription: 'Besser als ein Brownout.',
});

// eslint-disable-next-line camelcase
Expand Down
11 changes: 11 additions & 0 deletions src/languages/en_US/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ const en_US = () => ({
sha512: 'SHA-512',
ripemd160: 'RIPEMD-160',
sha224: 'SHA-224',
crc1: 'CRC1',
crc8: 'CRC8',
crc16: 'CRC16',
crc24: 'CRC24',
crc32: 'CRC32',
file: 'File',
fileSubtitle: 'Calculate file hashes',
Expand Down Expand Up @@ -82,6 +86,13 @@ const en_US = () => ({
orange: 'Orange',
orangeThemeDescription: 'Let\'s get Dutch.',
themeToggleEnabled: 'Theme toggle',
cyclicRedundancyCheck: 'Cyclic redundancy check',
deepOrange: 'Deep orange',
deepOrangeDescription: 'In case orange wasn\'t enough.',
amber: 'Amber',
amberDescription: 'Not selective yellow.',
brown: 'Brown',
brownDescription: 'Better than a brownout.',
});

// eslint-disable-next-line camelcase
Expand Down
11 changes: 11 additions & 0 deletions src/languages/es_ES/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ const es_ES = () => ({
sha512: 'SHA-512',
ripemd160: 'RIPEMD-160',
sha224: 'SHA-224',
crc1: 'CRC1',
crc8: 'CRC8',
crc16: 'CRC16',
crc24: 'CRC24',
crc32: 'CRC32',
file: 'Archivo',
fileSubtitle: 'Calcular hashes de archivos',
Expand Down Expand Up @@ -82,6 +86,13 @@ const es_ES = () => ({
orange: 'Naranja',
orangeThemeDescription: 'Vamos a holandeses.',
themeToggleEnabled: 'Alternar tema',
cyclicRedundancyCheck: 'Verificación de redundancia cíclica',
deepOrange: 'Naranja intenso',
deepOrangeDescription: 'En caso de que el naranja no fuera suficiente.',
amber: 'Ámbar',
amberDescription: 'No selectivo amarillo.',
brown: 'Marrón',
brownDescription: 'Mejor que un apagón.',
});

// eslint-disable-next-line camelcase
Expand Down
11 changes: 11 additions & 0 deletions src/languages/fr_FR/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ const fr_FR = () => ({
sha512: 'SHA-512',
ripemd160: 'RIPEMD-160',
sha224: 'SHA-224',
crc1: 'CRC1',
crc8: 'CRC8',
crc16: 'CRC16',
crc24: 'CRC24',
crc32: 'CRC32',
file: 'File',
fileSubtitle: 'Calculer les hachages de fichier',
Expand Down Expand Up @@ -82,6 +86,13 @@ const fr_FR = () => ({
orange: 'Orange',
orangeThemeDescription: 'Il faut que ça Néerlandais.',
themeToggleEnabled: 'Basculer le thème',
cyclicRedundancyCheck: 'Contrôle de redondance cyclique',
deepOrange: 'Orange foncé',
deepOrangeDescription: 'Au cas où l\'orange ne suffirait pas.',
amber: 'Ambre',
amberDescription: 'Jaune non sélectif.',
brown: 'Marron',
brownDescription: 'Mieux qu\'une baisse de tension.',
});

// eslint-disable-next-line camelcase
Expand Down
11 changes: 11 additions & 0 deletions src/languages/it_IT/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ const it_IT = () => ({
sha512: 'SHA-512',
ripemd160: 'RIPEMD-160',
sha224: 'SHA-224',
crc1: 'CRC1',
crc8: 'CRC8',
crc16: 'CRC16',
crc24: 'CRC24',
crc32: 'CRC32',
file: 'File',
fileSubtitle: 'Calcola gli hash dei file',
Expand Down Expand Up @@ -82,6 +86,13 @@ const it_IT = () => ({
orange: 'Arancia',
orangeThemeDescription: 'Prendiamo l\'olandese.',
themeToggleEnabled: 'Commutazione del tema',
cyclicRedundancyCheck: 'Controllo di ridondanza ciclico',
deepOrange: 'Arancio intenso',
deepOrangeDescription: 'Nel caso l\'arancione non fosse abbastanza.',
amber: 'Ambra',
amberDescription: 'Giallo non selettivo.',
brown: 'Marrone',
brownDescription: 'Meglio di un brownout.',
});

// eslint-disable-next-line camelcase
Expand Down
11 changes: 11 additions & 0 deletions src/languages/jp_JP/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ const jp_JP = () => ({
sha512: 'SHA-512',
ripemd160: 'RIPEMD-160',
sha224: 'SHA-224',
crc1: 'CRC1',
crc8: 'CRC8',
crc16: 'CRC16',
crc24: 'CRC24',
crc32: 'CRC32',
file: 'ファイル',
fileSubtitle: 'ファイルハッシュの計算',
Expand Down Expand Up @@ -82,6 +86,13 @@ const jp_JP = () => ({
orange: 'オレンジ',
orangeThemeDescription: 'オランダ語を取得しましょう。',
themeToggleEnabled: 'テーマの切り替え',
cyclicRedundancyCheck: '巡回冗長検査',
deepOrange: '濃いオレンジ',
deepOrangeDescription: 'オレンジでは不十分な場合に備えて。',
amber: 'アンバー',
amberDescription: '選択的ではない黄色。',
brown: '褐色',
brownDescription: '電圧低下よりも優れています。',
});

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

0 comments on commit af5aa92

Please sign in to comment.