module CryptBufferConcern::ByteExpander

Private Instance Methods

expand_bytes(input,total) click to toggle source
# File lib/crypto-toolbox/crypt_buffer/concerns/byte_expander.rb, line 4
def expand_bytes(input,total)
  if input.length >= total
    input
  else
    n = total / input.length
    rest = total % input.length
    
    # expand the input to the full length of the internal data
    (input * n) + input[0,rest]
  end
end