Sha256: aaed78de49e9f97a054143dd6af7ce90d8a7c8547ffe228c06b0760889d6fff3
Contents?: true
Size: 1020 Bytes
Versions: 3
Compression:
Stored size: 1020 Bytes
Contents
require 'base64' require 'sym/crypt' module Sym module Crypt # {Sym::Crypt::CipherHandler} contains cipher-related utilities necessary to create # ciphers, and seed them with the salt or iV vector. It also defines the # internal structure {Sym::Crypt::CipherHandler::CipherStruct} which is a key # struct used in constructing cipher and saving it with the data packet. module CipherHandler CipherStruct = Struct.new(:cipher, :iv, :salt) def create_cipher(direction:, cipher_name:, iv: nil, salt: nil) cipher = NEW_CIPHER_PROC.call(cipher_name) cipher.send(direction) iv ||= cipher.random_iv cipher.iv = iv CipherStruct.new(cipher, iv, salt) end def update_cipher(cipher, value) data = cipher.update(value) data << cipher.final data end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sym-crypt-1.2.0 | lib/sym/crypt/cipher_handler.rb |
sym-crypt-1.1.1 | lib/sym/crypt/cipher_handler.rb |
sym-crypt-1.0.0 | lib/sym/crypt/cipher_handler.rb |