- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2017 11:04 AM
Hi all,
I m using GlideDigest to caclulate MD5hash in my scoped application.. i m in Istanbul release. Here is the code which i m using to calculate MD5Hash.. It generates different value for MD5Hash for my file. Please help me to understand what i m doing wrong over here.
var attachmentSysid='';
var ga=new GlideRecord('sys_attachment');
ga.addQuery('table_sys_id',current.sys_id);
ga.query();
while(ga.next()){
attachmentSysid=ga.sys_id;
}
var inputStream = new GlideSysAttachment().getContentStream(attachmentSysid);
var digest = new GlideDigest();
var test=digest.getMD5Base64FromInputStream(inputStream);
gs.addInfoMessage(test);
This is the link i have referred
https://developer.servicenow.com/app.do#!/api_doc?v=jakarta&id=c_GlideDigestScopedAPI
And earlier i tried with GlideCheckSum but since it needs to be whitelisted in order for it to be used and also it will work only in scoped application, i happened to go with this approach.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2017 10:36 AM
Instead of getMD5Base64FromInputStream i used getMD5HexFromInputStream
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2017 10:16 AM
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2017 10:24 AM
if you have connected to my instance, this is the sysid of the record in the sys_attachment table
6130120d0f030300c5f7cd8ce1050e89
you can check the expectedMD%hash value in any website.. its coming as F6780CA6A9381BCF3DB36AED0F97DFCF

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2017 10:33 AM
Try now
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2017 10:36 AM
Instead of getMD5Base64FromInputStream i used getMD5HexFromInputStream
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2017 10:38 AM