Skip to content

Commit cfacb83

Browse files
authored
Fix Android receiver tab (replace MD5 library) (#3184)
Replace MD5 library
1 parent ff5913b commit cfacb83

File tree

4 files changed

+12
-788
lines changed

4 files changed

+12
-788
lines changed

.eslintrc.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ module.exports = {
22
parserOptions: {
33
ecmaVersion: 2020,
44
sourceType: "module",
5-
allowImportExportEverywhere: true,
65
},
76
extends: ["plugin:vue/recommended"],
87
env: {

package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"@panter/vue-i18next": "^0.15.2",
5656
"bluebird": "^3.7.2",
5757
"bonjour": "^3.5.0",
58+
"crypto-es": "^1.2.7",
5859
"djv": "^2.1.4",
5960
"dompurify": "^2.4.0",
6061
"i18next": "^19.0.0",
@@ -67,7 +68,6 @@
6768
"jquery-ui-npm": "^1.12.0",
6869
"lru_map": "^0.3.3",
6970
"marked": "^4.1.1",
70-
"md5.js": "^1.3.5",
7171
"multicast-dns": "^7.2.5",
7272
"multiple-select": "^1.5.2",
7373
"nw-vue-devtools-prebuilt": "^0.0.10",
@@ -82,8 +82,6 @@
8282
},
8383
"devDependencies": {
8484
"@babel/core": "^7.19.3",
85-
"@babel/eslint-parser": "^7.19.1",
86-
"@babel/preset-env": "^7.20.2",
8785
"@quanle94/innosetup": "^6.0.2",
8886
"@rollup/plugin-alias": "^4.0.2",
8987
"@rollup/plugin-commonjs": "^24.0.0",
@@ -94,7 +92,6 @@
9492
"@storybook/addon-links": "^6.5.12",
9593
"@storybook/vue": "^6.5.12",
9694
"babel-loader": "^8.2.5",
97-
"babelify": "^10.0.0",
9895
"chai": "^4.3.6",
9996
"command-exists": "^1.2.9",
10097
"cordova-lib": "^11.0.0",

src/js/tabs/receiver.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { i18n } from "../localization";
22
import GUI from '../gui';
33

4-
const MD5 = require('md5.js');
4+
import { MD5 } from 'crypto-es/lib/md5.js';
55

66
const receiver = {
77
rateChartHeight: 117,
@@ -32,10 +32,8 @@ receiver.initialize = function (callback) {
3232

3333
if (text) {
3434
const bindingPhraseFull = `-DMY_BINDING_PHRASE="${text}"`;
35-
const md5stream = new MD5();
36-
md5stream.end(bindingPhraseFull);
37-
const buffer = md5stream.read().subarray(0, 6);
38-
uidBytes = Uint8Array.from(buffer);
35+
const hash = MD5(bindingPhraseFull).toString();
36+
uidBytes = Uint8Array.from(Buffer.from(hash, 'hex')).subarray(0, 6);
3937
}
4038

4139
return uidBytes;

0 commit comments

Comments
 (0)