Project

ore-rs

0.0
Repository is archived
No release in over a year
Ruby bindings for the ore.rs Order-Revealing Encryption library
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 0.1
 Project Readme

Ruby bindings for the ore.rs Order-Revealing Encryption Rust library.

Installation

For the most common platforms, we provide "native" gems (which have the shared object that provides the cryptographic primitives pre-compiled). At present, we provide native gems for:

  • Linux x86_64 and aarch64
  • macOS x86_64 and arm64

On these platforms, you can just install the ore-rs gem via your preferred method, and it should "just work". If it doesn't, please report that as a bug.

For other platforms, you will need to install the source gem, which requires that you have Rust 1.57.0 or later installed. On ARM-based platforms, you must use Rust nightly, for SIMD intrinsics support.

Installing from Git

If you have a burning need to install directly from a checkout of the git repository, you can do so by running bundle install && rake install. As this is a source-based installation, you will need to have Rust installed, as described above.

Usage

First off, load the library:

require "ore-rs"

Then create a new encryptor:

enc = ORE::AES128.new(key1, key2, 64, 8)

Encrypt a couple of ciphertexts:

ct1 = enc.encrypt(42)
ct2 = enc.encrypt(420)

Finally, compare them:

ct1 < ct2   # => true
ct1 > ct2   # => false

If you need to store a ciphertext, you can turn it into a binary string:

File.write("/tmp/ciphertext", ct1.to_s)

To turn a binary string back into a ciphertext, just create a new ciphertext with it:

ct3 = ORE::AES128::Ciphertext.new(File.binread("/tmp/ciphertext"), 8)

Contributing

Please see CONTRIBUTING.md.