Project

ruby_nacl

0.0
No commit activity in last 3 years
No release in over 3 years
Provides a ruby interface to DJB's NaCl library.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 1.4.2
 Project Readme

About Ruby_NaCl

Ruby_NaCl is a Ruby gem that provides a wrapper around DJB's awesome NaCl library.

What is NaCl?

NaCl (pronounced "salt") is a new easy-to-use high-speed software library for network communication, encryption, decryption, signatures, etc written by Daniel J. Bernstein.

Install the gem

  1. git clone http://github.com/CaffeinatedMind/Ruby_NaCl.git
  2. cd Ruby_NaCl
  3. git submodule init
  4. git submodule update
  5. gem build ruby_nacl.gemspec
  6. gem install ruby_nacl-0.1.0.gem

"Hello, World" example

require 'ruby_nacl'

sender = NaCl.new
receiver = NaCl.new

sender.set_remote_nonce(receiver.nonce)
receiver.set_remote_nonce(sender.nonce)

sender.set_remote_key(receiver.public_key)
receiver.set_remote_key(sender.public_key)

receiver.set_secret(sender.secret)

message = "Hello world!"
encrypted_message = sender.public_encrypt(message)
decrypted_message = receiver.public_decrypt(encrypted_message)
puts decrypted_message

License

Ruby_NaCl is licensed under the Ruby License.