Method: RbNaCl::Util.zeros
- Defined in:
- lib/rbnacl/util.rb
.zeros(n = 32) ⇒ String
Returns a string of n zeros
Lots of the functions require us to create strings to pass into functions of a specified size.
22 23 24 25 26 27 |
# File 'lib/rbnacl/util.rb', line 22 def zeros(n = 32) zeros = "\0" * n # make sure they're 8-bit zeros, not 7-bit zeros. Otherwise we might get # encoding errors later zeros.respond_to?(:force_encoding) ? zeros.force_encoding("ASCII-8BIT") : zeros end |