From: ruby gem Date: 2012-05-08T13:45:33+09:00 Subject: Re: proper way to create truly new dup/cloned object? okay -w doesn't show any warning about this so it isn't that. I have also observed that .xor! with dup works as expected in some cases. Here is an example showing where it works as expected require 'xor' require 'openssl' @a = "aaaaaaa" b = @a.dup puts @a puts b b.xor!("bbbbbbb") puts @a puts b #outputs aaaaaaa aaaaaaa aaaaaaa however, here is what I have simplified my script that I need to work to require 'xor' require 'openssl' @sha256 = OpenSSL::Digest::SHA256.new @l = @sha256.digest("whatever") @sha256.reset cloned_l = @l.dup subkey = @sha256.digest("whatever2") puts @l puts cloned_l cloned_l.xor!(subkey) puts @l puts cloned_l #outputs �s��2�Y���%�\m �C�"�O �s��2�Y���%�\m �C�"�O XA'pP� �7B�,��vd��,]|R>�f XA'pP� �7B�,��vd��,]|R>�f I am absolutely lost on why it is not working correctly here because it seems to be the same exact pattern to me?! Can anyone see what is going wrong? -- Posted via http://www.ruby-forum.com/.