Class: Cipher::ChaoCipher

Inherits:
Substitution show all
Includes:
Crypto
Defined in:
lib/cipher.rb

Overview

ChaoCipher

Cipher invented in 1917 but only recently released. See www.mountainvistasoft.com/chaocipher/index.htm Key schedule in lib/key.rb

Constant Summary

Constant Summary

Constants included from Crypto

Crypto::BASE

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Methods included from Crypto

#addmod10, #chainadd, #expand5to10, #find_hole, #keyshuffle, #normalize, #p1_encode, #str_to_numeric, #submod10

Methods inherited from Substitution

#decode, #encode

Methods inherited from SimpleCipher

#decode, #encode

Constructor Details

- (ChaoCipher) initialize(pw, cw, flag = false)

initialize



366
367
368
369
370
371
372
# File 'lib/cipher.rb', line 366

def initialize(pw, cw, flag = false)
  if flag then
    pw = keyshuffle(pw, Key::ChaoKey::BASE)
    cw = keyshuffle(cw, Key::ChaoKey::BASE)
  end
  @key = Key::ChaoKey.new(pw, cw)
end

Instance Attribute Details

- (Object) key (readonly)

Returns the value of attribute key



362
363
364
# File 'lib/cipher.rb', line 362

def key
  @key
end