locked
Algorithm used for generating ETag property for Azure Blob RRS feed

  • Question

  • Which Algorithm is used to generate the ETag for a block blob in Azure?

    I have a file (which is updated frequently) in my local system. I am uploading the file periodically to block blob. So I want to compare the files in block blob and local system and upload only if the file in local system is changed.

    I suppose this can be done through ETag. If I am able to generate the ETag for the file in Local system, I can compare the two etags. 

    Any hint about the Algo?

    Is there any other way to do it?

    Thanks in Advance

    Thursday, January 31, 2013 5:36 AM

Answers

  • Based on my knowledge, the algorithm to generate ETag is not publicly available. One possible way for you to achieve this would be to compare the modified date of the blob (which will be in UTC) and the modified date of the local file (though it's not failsafe). Yet another way would be to calculate the MD5 Hash of the local file and compare it with Content-MD5 property of the blob. A third way would be for you to manage a database of sort locally which will keep the ETag of the blob. You can perform conditional updates by specifying this ETag value. See this link for more details on conditional updates: http://msdn.microsoft.com/en-us/library/windowsazure/dd179371.aspx.

    Hope this helps.

    • Proposed as answer by navcode Thursday, January 31, 2013 11:19 AM
    • Marked as answer by Qin Dian Tang - MSFT Thursday, February 7, 2013 1:39 AM
    Thursday, January 31, 2013 6:46 AM