module Twofish::Mode
Encryption modes.
The only currently implemented modes are ECB
(Electronic Code Book) and CBC
(Cipher Block Chaining).
Constants
- ALL
Array of all known modes.
- CBC
Cipher block chaining mode.
- DEFAULT
Default mode (
ECB
).- ECB
Electronic code book mode.
Public Class Methods
validate(mode)
click to toggle source
Takes a string or symbol and returns the lowercased symbol representation if this is a recognized mode. Otherwise, throws ArgumentError.
# File lib/twofish/mode.rb, line 24 def self.validate(mode) mode_sym = mode.nil? ? DEFAULT : mode.to_s.downcase.to_sym raise ArgumentError, "unknown cipher mode #{mode.inspect}" unless ALL.include? mode_sym mode_sym end