Hi Vinny, hi Barry,
 
In my first test I assumed that Base64 was used on Prod to encode the binary data of the md5 hash (as base64 is meant for encoding raw 8bit binary data). So I tried to decode it to a byte array, assuming it would be the md5 hash and encoding it with hex encoding. But as mentioned the result was not what I was getting on the Dev server.
I just did some more testing and - thanks to Barry - I found out that the encoding on Prod seems to happen in these steps:
1. calculate MD5 hash of the file, results in 16 bytes
2. convert those 16 bytes into a hex encoded String/char array (32 chars)
3. convert those 32 chars into bytes using ASCII
4. encode those 32 bytes using Base64
 
So what I will do on Prod is decoding using base64 and put the resulting byte array into a String, using ASCII encoding. The result should be what I get on Dev.
 
Thanks again to both of you!
Kind regards,
Stephan
 
 
Gesendet: Dienstag, 11. März 2014 um 20:20 Uhr
Von: "Vinny P" <[email protected]>
An: [email protected]
Betreff: Re: Re: [google-appengine] How is MD5 hash of a blobstore blob encoded?
The reason I asked for an empty file's MD5 is to compare them and see if there was a wrong hash being generated, since d41d8cd98f00b204e9800998ecf8427e is the correct "blank" MD5. But as Barry noted, it looks like both implementations are generating the correct MD5 sums, the only difference seems to be that Prod base64 encodes the hash.
 
In your original post, you wrote that "decoding it with Base64 does not match with what I get locally." Can you share the test file you used in your first trial? If you can't share the test file (which is not a problem at all) can you try repeating the test with a large file?
 
-----------------
-Vinny P
Technology & Media Advisor
Chicago, IL
 
App Engine Code Samples: http://www.learntogoogleit.com
 

On Tuesday, March 11, 2014 1:28:58 PM UTC-5, Stephan wrote:
Hi Vinny,
 
Thanks for your time.
 
I've uploaded an empty file and here is what I get from BlobInfo.getMd5Hash():
 
Development Server: d41d8cd98f00b204e9800998ecf8427e
AppEngine Prod: ZDQxZDhjZDk4ZjAwYjIwNGU5ODAwOTk4ZWNmODQyN2U=
 
Hope you can shed some light on this.
I don't expect that it will be fixed in the near future but I really need to know the encoding and hashing algorithm that is used on GAE production, so if someone could take a look into the code would be great.
 
Kind regards,
Stephan
 
 
Gesendet: Dienstag, 11. März 2014 um 04:38 Uhr
Von: "Vinny P" <[email protected]>
An: "[email protected]" <[email protected]>
Betreff: Re: [google-appengine] How is MD5 hash of a blobstore blob encoded?
On Mon, Mar 10, 2014 at 6:27 AM, Stephan Hartmann <[email protected]> wrote:
On the development server BlobInfo.getMd5Hash() returns a String (why not binary array?) that seems to be the hex endoded hash value. I can proof this true with hashing the file locally.
However on Appengine getMd5Hash() returns something different.
It seems to be Base64 encoded, but decoding it with Base64 does not match with what I get locally.
 
 
Can you try uploading an empty file to both your development environment and production App Engine, and seeing what the MD5 hash for each comes out to be?
 
 
-----------------
-Vinny P
Technology & Media Advisor
Chicago, IL
 
App Engine Code Samples: http://www.learntogoogleit.com
 

 

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/d/optout.

 

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/d/optout.

Reply via email to