You can clone with
Cannot retrieve contributors at this time
# Symmetric crypto lets you scramble some data with one shared key. It is faster# than asymmetric crypto, but has the downside that you can only share the data# with trusted parties, so the key has to be pre-shared somehow, unlike async# crypto.require "openssl"secret = "fd5d148867091d7595c388ac0dc50bb465052b764c4db8b4b4c3448b52ee0b33df16975830acca82"data = "This is some data"# You can list available chiphers.#p OpenSSL::Cipher.ciphers# The chiphers take the format name-keylength-modecipher = OpenSSL::Cipher.new("AES-128-CBC")# An alternative way of creating the object would becipher = OpenSSL::Cipher::AES.new(128, :CBC)# The API is very imperative, as it binds pretty directly to the underlying C# libraries. This call sets the object in encryption mode.cipher.encryptcipher.key = secretencrypted = cipher.update(data) + cipher.finalp encrypted# => ...some unreadable binary stuff...# Time to decrypt it. We need to create a new object.decipher = OpenSSL::Cipher::AES.new(128, :CBC)decipher.decryptdecipher.key = secretdecrypted = decipher.update(encrypted) + decipher.finalp decrypted# => "This is some data"