Class: Crypt::BlockTEA
- Inherits:
-
Object
- Object
- Crypt::BlockTEA
- Defined in:
- lib/crypt/block_tea.rb
Constant Summary collapse
- DELTA =
0x9E3779B9
Instance Method Summary collapse
- #decrypt(ciphertext) ⇒ Object
- #encrypt(plaintext) ⇒ Object
-
#initialize(password) ⇒ BlockTEA
constructor
A new instance of BlockTEA.
Constructor Details
#initialize(password) ⇒ BlockTEA
Returns a new instance of BlockTEA.
5 6 7 |
# File 'lib/crypt/block_tea.rb', line 5 def initialize(password) @password = password end |
Instance Method Details
#decrypt(ciphertext) ⇒ Object
16 17 18 19 |
# File 'lib/crypt/block_tea.rb', line 16 def decrypt(ciphertext) raise StandardError, "Nothing to decrypt" if ciphertext.length == 0 decryption_algorithm(ciphertext) end |
#encrypt(plaintext) ⇒ Object
10 11 12 13 |
# File 'lib/crypt/block_tea.rb', line 10 def encrypt(plaintext) raise StandardError, "Nothing to encrypt" if plaintext.length == 0 encryption_algorithm(plaintext) end |