Project

digester

0.0
No commit activity in last 3 years
No release in over 3 years
Digester builds consistent MD5 signatures for arbitrary Ruby data structures.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0
~> 2.13

Runtime

 Project Readme

Digester

Use Digester anytime you want to use a complex data structure as a primary key in a database or a lookup key in a Hash or a key-value store.

Digester creates an MD5 digest for Ruby data structures in a consistent algorithmic manner such that two identical data structures generate the same digests regardless of how they were created.

This way it is also possible to compare data structures and digests across different programming languages. At Swoop, we use consistent data structure digests to implement variations of content addressable storage across S3, Redis and MongoDB with Ruby, Python and Java clients.

Installation

Add this line to your application's Gemfile:

gem 'digester'

And then execute:

$ bundle

Or install it yourself as:

$ gem install digester

Usage

require 'digester'
data = {x: {y: { z: [1, 2, 3]}}}
Digester::Digester.new.digest(data)
 => "d5221448a0765677cbce09eebd557c61"
Digester::Digester.digest(data, {upcase: true})
 => "D5221448A0765677CBCE09EEBD557C61"

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request