No commit activity in last 3 years
No release in over 3 years
With marshalling of digest objects, it is possible to compute the digests over several executions by storing the marshalled object on file or database, this is handy for computing digests for large files that comes in parts.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.0
~> 1.6.4
~> 2.6.0
 Project Readme

digest_extensions¶ ↑

Extension to the Digest module of the ruby standard library to support marshalling

With this gem you can accumulatively compute the digest of a byte sequence over several executions by storing the marshalled digest object in a database:

class FakeDatabase
  attr_accessor :value
end
@db = FakeDatabase.new

def update_digest(part)
  marshalled_digest = Marshal::load(@db.value) # Fetch the last digest from database
  marshalled_digest << part # Compute digest incrementally
  @db.value = Marshal::dump(marshalled_digest) # Store updated digest in database
end

## parts_array is provided; for example as a series of files
## generated with the command split on a larger file.
@db.value = Marshal::dump(Digest::MD5.new) #An initial value
parts_array.each do |part|
  # Assume this method is invoked in a new process each time, and
  # the only thing they share is the database (faked in the example with @db)
  update_digest(part)
end
Marshal::load(@db.value).hexdigest.should == Digest::MD5.hexdigest(parts_array.inject("", :+))

The plan is to have this feature to be included in the ruby standard library.

Known issues¶ ↑

Currently the marshalled values are specific to the underlying native library used to compute the digest values. That means that if you are using a ruby that is compiled with linkage to OpenSSL as the underlying md5 library, then the marshalled values (in the database) cannot be used with a ruby version compiled with linkage to rubys native md5 implementation. So take care of that when you consider upgrading your ruby version.

Contributing to digest_extensions¶ ↑

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it

  • Fork the project

  • Start a feature/bugfix branch

  • Commit and push until you are happy with your contribution

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright © 2011-2012 Jarl Friis. See LICENSE.txt for further details.