1 Reply Latest reply on Jul 25, 2013 4:02 PM by areohbee

    Hashing files

    allahmane Level 1

      I want to be able to read the first 500 bytes off of a RAW file (or other files) and get the MD5 hash of them. Can someone provide me perhaps a snippet of code that can do this (or point me in the right direction)? I understand I have to use LrMD5 and probably some method to convert bytes to string so that LrMD5 can accept the argument.


      Thanks! I am using/testing on both Lightroom 4/5 if that makes any difference.

        • 1. Re: Hashing files
          areohbee Level 6

          Lua strings can hold binary data read from files, so really nothing tricky here, e.g.


          local file = io.open( path, 'rb' )

          local data = file:read( 500 )

          local hash = LrMD5.digest( data )

          io.close( file )


          Untested, but should work, no?