From 1d5c905ba05cfd57a171fd6629837ee40a045ab6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luiz=20Am=C3=A9rico=20Pereira=20C=C3=A2mara?= Date: Sun, 28 Mar 2021 09:54:40 -0300 Subject: [PATCH] Use crypto-js instead of crypto in attachments --- lib/mixins/attachments.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/mixins/attachments.js b/lib/mixins/attachments.js index 890ce27..7cf2fe3 100644 --- a/lib/mixins/attachments.js +++ b/lib/mixins/attachments.js @@ -1,5 +1,5 @@ -const fs = require('fs'); -const { createHash } = require('crypto'); +import fs from 'fs'; +import CryptoJS from 'crypto-js'; export default { /** @@ -63,9 +63,9 @@ export default { } // add checksum and size information - const checksum = createHash('md5') - .update(data) - .digest('hex'); + const checksum = CryptoJS.MD5( + CryptoJS.lib.WordArray.create(new Uint8Array(data)) + ); refBody.Params.CheckSum = new String(checksum); refBody.Params.Size = data.byteLength;