Project

General

Profile

Defect #609

Issue with "wrong" checksums on jpg File

Added by Jay Cee over 11 years ago. Updated over 11 years ago.

Status:
In Progress
Priority:
Normal
Assignee:
-
Start date:
12/13/2012
Due date:
% Done:

0%

Estimated time:
Browser (if web client):

Description

I'm not sure whether this is a bug or whether I'm just doing something wrong in my code, however I get a "wrong" md5 Checksum when doing the following:

var image_byte_array = plugins.http.getMediaData("http://localhost/test.jpg");
var md5_checksum = plugins.it2be_cryptor.MD5;
application.output(md5_checksum);

Running "md5 test.jpg" or "openssl md5 test.jpg" from console - or whatever other md5 calculation tool - all return (the same) different md5 checksum than Cryptor...

Any help with this would be greately appreciated...
-> It's the same for SHA by the way...

Cheers,

Andreas

History

#1

Updated by Jay Cee over 11 years ago

Hmmm seems this Editor made some of the code disappear: This is the actual code:

var image_byte_array = plugins.http.getMediaData("http://localhost/test.jpg"); 
var md5_checksum = plugins.it2be_cryptor.MD5(image_byte_array);
application.output(md5_checksum);

#2

Updated by Servoy Components over 11 years ago

  • Status changed from New to Feedback
#3

Updated by Servoy Components over 11 years ago

  • Status changed from Feedback to In Progress

The Plug-in performs a base64 encoding first.

Hope this helps.

#4

Updated by Jay Cee over 11 years ago

Hi Marcel,

thanks for your reply.
I see - then something else is weird:
openssl enc -base64 -in test.jpg | openssl md5
again returns different checksums than Cryptor

I had a look what happened after the base64 encoding:
These are the first 2 lines of what your plugin puts out:

/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0a
HBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIy
...

And this is what happened when I ran "openssl enc -base64 -in test.jpg"
/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkS
Ew8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJ
...

->The line length isn't identical so all chechksums are different again...

Any help with this... sorry to bother you but could you maybe provide some short code how to do this properly in Servoy?

Cheers,

Andreas

Also available in: Atom PDF