Method: Ppp::Generator#initialize
- Defined in:
- lib/ppp/generator.rb
#initialize(sha256_key, opts = {}) ⇒ Generator
Returns a new instance of Generator.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/ppp/generator.rb', line 15 def initialize sha256_key, opts={} raise NotHexKey.new( sha256_key ) if @@HEX_PATTERN.match( sha256_key ).nil? @seed = sha256_key = { :length => 4, :alphabet => :conservative }.merge opts @length = [ :length ] @alphabet = process_alphabet( [ :alphabet ] ).split( '' ).uniq.join raise ArgumentError.new( "alphabet cannot contain null character" ) if alphabet.include? ?\0 end |