From: roob noob Date: 2012-05-17T08:32:23+09:00 Subject: ruby openssl bug, reset cipher fails This is mentioned in this thread http://www.ruby-forum.com/topic/4293246#1061067 but I thought it was a different problem then so the thread isn't named correctly. Hopefully this will get the attention of people interested more in OpenSSL than in helping noobs understand initialize. ruby 1.9.3p125 [x86_64-linux] 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/.