Method: NCipher.encode

Defined in:
lib/n_cipher.rb

.encode(string) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/n_cipher.rb', line 9

def encode(string)
  string
    .to_str
    .unpack('U*')
    .map {|char| char.to_s(NCipher.config.seed.length) }
    .map {|char| char.gsub(/./, convert_table(:for => :encode)) }
    .join(NCipher.config.delimiter)
end