0.0
No release in over 3 years
Low commit activity in last 3 years
RSA accumulator implementation for Ruby.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 12.3.3
~> 3.0

Runtime

>= 0
 Project Readme

RSA Accumulator for Ruby Build Status Gem Version MIT License

Cryptographic accumulator based on the strong RSA assumption BBF18 in Ruby.

Installation

Add this line to your application's Gemfile:

gem 'rsa-accumulator'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rsa-accumulator

Usage

Setup accumulator

First, initialize the accumulator. Since the accumulator uses groups of unknown order, it can be generated in following ways:

require 'rsa-accumulator'

# using RSA modulus published by RSA Laboratory
acc = RSA::Accumulator.generate_rsa2048

# using Random RSA modulus with a specified bit length(default value is )
acc = RSA::Accumulator.generate_random(2048)

Adding elements and membership proof

You can add arbitrary String data to the accumulator.

acc.add('a', 'b')
proof = acc.add('c')

You can use inclusion proof to prove that an element exists in an accumulator.

acc.member?(proof)

Non membership proof

You can generate non-membership proof and prove that the elements does not exist in the accumulator.

members = %w(a b)
non_members = %w(c, d)
acc.add(*members)
proof = acc.prove_non_membership(members, non_members)
acc.non_member?(non_members, proof)
=> true

Delete element from accumulator

You can remove elements from the accumulator by providing the inclusion proof.

acc.add('a', 'b')
proof = acc.add('c')
acc.delete(proof)

acc.member?(proof)
=> false

Holding the product of all elements

This feature is experimental and has not been checked against large amounts of data.

acc = RSA::Accumulator.generate_rsa2048(hold_elements: true)
acc.add('a', 'b', 'c')
acc.add('d', 'e')

# acc has product of all elements in acc#products, so you can get membership proof.
proof = acc.prove_membership('b')