Class: ORE::AES128::Ciphertext
- Inherits:
-
Object
- Object
- ORE::AES128::Ciphertext
- Includes:
- Comparable
- Defined in:
- lib/ore/aes128/ciphertext.rb
Overview
An ORE ciphertext produced by an AES128 cipher.
Class Method Summary collapse
-
.new(ct, n) ⇒ Object
Create a ciphertext object from a serialized form.
Instance Method Summary collapse
Class Method Details
.new(ct, n) ⇒ Object
Create a ciphertext object from a serialized form.
ORE ciphertexts can be serialized (using #to_s), and then deserialized by passing them into this constructor.
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ore/aes128/ciphertext.rb', line 22 def self.new(ct, n) unless ct.is_a?(String) raise ArgumentError, "Ciphertext must be a string" end unless n == 8 raise ArgumentError, "Only a block count of 8 is currently supported" end _new(ct, n) end |
Instance Method Details
#<=>(other) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/ore/aes128/ciphertext.rb', line 38 def <=>(other) unless other.is_a?(ORE::AES128::Ciphertext) raise ArgumentError, "Cannot compare an ORE ciphertext to anything other than another ciphertext" end _cmp(other) end |
#to_s ⇒ Object
34 35 36 |
# File 'lib/ore/aes128/ciphertext.rb', line 34 def to_s _serialize end |