an interface to libQRNG and my first mruby gem
C Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
README.md
TODO.md
mrbgem.rake

README.md

mruby-libqrng

An interface to libQRNG for mruby.

Prerequisites

conf.cflags << '-I"/path/to/libQRNG"'
conf.ldflags << '-L"/path/to/libQRNG"'

Installation

Usage

qrng = QRNG.new 'AzureDiamond', 'hunter2', true  # username, password, use ssl (optional)
pw = qrng.password 13, 'ABCdef123'  # password_length, tobeused_password_chars (optional)
puts pw  # => 2dBfCC123CfeC
int = qrng.data :int  # :byte (String), :int (Fixnum), :double (Float [between 0 and 1])
puts int  # => 2143097836
int = qrng.data :int, 3
puts int  # => [-984391892, 1743334411, -1048288211]
qrng.disconnect

q = QRNG.new 'AzureDiamond', 'hunter2' do |qrng|
  puts qrng.connected?  # => true
  puts qrng.ssl? # => false
  floats = qrng[:double, 0xffff]
  puts floats  # => numbers, numbers everywhere
end
puts q.connected?  # => false

License

MIT License (http://opensource.org/licenses/MIT)