Git Product home page Git Product logo

morph's Introduction

Morph

πŸ”₯ An encrypted, in-memory, key-value store

Uses homomorphic encryption, so the server can’t read data or queries. Powered by HElib and follows the Redis protocol.

Learn how it works.

Designed for research and education, and should not be considered secure. For a more practical approach to key-value store encryption, check out Cloak.

Build Status

Installation

On Mac, run:

brew install ankane/brew/morph --head

On other platforms, build from source.

Getting Started

Generate a key pair

morph-cli keygen

Start the server (in another window)

morph-server

Set a key

morph-cli set hello world

Note: Each key should only be set once, or the value will not be recoverable

Get a key

morph-cli get hello

Set multiple keys

morph-cli mset key1 hello key2 world

Get multiple keys

morph-cli mget key1 key2

Delete all keys

morph-cli flushall

Get the number of keys

morph-cli dbsize

List keys

morph-cli keys "*"

Get info

morph-cli info

Time Complexity

  • set - O(1)
  • get - O(N) where N is the number of keys in the store
  • mset - O(N) where N is the number of keys to set
  • mget - O(N*M) where N is the number of keys to get and M is the number of keys in the store
  • keys - O(N) where N is the number of keys in the store

Clients

C++

Create hello.cpp:

#include <morph/client.h>

int main() {
  auto morph = morph::Client();
  morph.flushall();
  morph.set("hello", "world");
  auto value = morph.get("hello");
  std::cout << value.value_or("(nil)") << std::endl;
}

Compile:

g++ -std=c++17 hello.cpp -lmorph -lpthread -lhelib -lntl -o hello

And run:

./hello

Building from Source

First, install HElib.

On Ubuntu 22.04, use:

sudo apt-get install libntl-dev
git clone --branch v2.3.0 https://github.com/homenc/HElib.git
cd HElib && mkdir build && cd build
cmake ..
make
sudo make install
sudo ldconfig

On Mac, use:

brew install helib

Then run:

git clone https://github.com/ankane/morph.git
cd morph && mkdir build && cd build
cmake ..
make
make install # optional, may need sudo

Credits

Thanks to IBM for HElib and Redis for the protocol/commands. Based on this example.

History

View the changelog

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help:

morph's People

Contributors

ankane avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.