Method: RbNaCl::SimpleBox#box
- Defined in:
- lib/rbnacl/simple_box.rb
#box(message) ⇒ String Also known as: encrypt
Encrypts the message with a random nonce
Encrypts the message with a random nonce, then returns the ciphertext with the nonce prepended. Optionally encodes the message using an encoder.
76 77 78 79 80 |
# File 'lib/rbnacl/simple_box.rb', line 76 def box() nonce = generate_nonce cipher_text = @box.box(nonce, ) nonce + cipher_text end |