Skip to content

Commit

Permalink
Use crypto-js instead of crypto in attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
blikblum committed Mar 28, 2021
1 parent 3cd88b2 commit 1d5c905
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/mixins/attachments.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const fs = require('fs');
const { createHash } = require('crypto');
import fs from 'fs';
import CryptoJS from 'crypto-js';

export default {
/**
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 1d5c905

Please sign in to comment.