Has anyone successfully got the MD5 checksum of a ...
# suitescript
e
Has anyone successfully got the MD5 checksum of a file from a file cabinet? The native methods were deprecated and I am using CryptoJS external library but for some reason the base64 string that we get with
getContents
in SS 2.0 is different for what I need. I'm sending a file to AWS S3 and the hash I get does not match the expected.
b
what does your code look like
e
I have tried many stuff, some of them are commented.
MR_MD5.js
b
you've tried too many things in the beginning, i would only expect solutions based on
Copy code
var wordArray = CryptoJS.enc.Base64.parse(content);
to get the bas64 encoding correct
otherwise, the output of your hash should also be base64, not hex
e
Yeah, I'm trying to understand the type of data FileReader (Web API) or Buffer (node.js) returns when reading a file, those implementations return the expected hash but when trying on NetSuite with the getContents something is different and I'm not able to figure it out
b
fileReader uses typed arrays for binary content, node uses buffers
netsuite does neither and just uses a base64 string for binary content
cryptojs word arrays are most similar to buffers
e
great! I will try to see what I can find with these clarifications, thanks battk!