From: roob noob Date: 2012-05-17T08:17:28+09:00 Subject: Re: what is going wrong here? The case of the noob not understanding initialize irb(main):001:0> require 'openssl' => true irb(main):002:0> message = "whatever" => "whatever" irb(main):003:0> @sha256 = OpenSSL::Digest::SHA256.new => # irb(main):004:0> @cipher = OpenSSL::Cipher::Cipher.new("AES-256-CTR") => # irb(main):005:0> 2.times do irb(main):006:1* key = @sha256.digest("whatever") irb(main):007:1> @sha256.reset irb(main):008:1> @cipher.encrypt irb(main):009:1> @cipher.key = key irb(main):010:1> ciphertext = @cipher.update(message) irb(main):011:1> ciphertext << @cipher.final irb(main):012:1> @cipher.reset irb(main):013:1> puts ciphertext irb(main):014:1> end �a�xtT�� 9]K���/ => 2 -- Posted via http://www.ruby-forum.com/.