lib/rmega/crypto/aes_ctr.rb in rmega-0.1.5 vs lib/rmega/crypto/aes_ctr.rb in rmega-0.1.6
- old
+ new
@@ -8,9 +8,11 @@
def decrypt(key, nonce, data)
raise "invalid nonce" if nonce.size != 4 or !nonce.respond_to?(:pack)
raise "invalid key" if key.size != 4 or !key.respond_to?(:pack)
+ nonce = nonce.dup
+
mac = [nonce[0], nonce[1], nonce[0], nonce[1]]
enc = nil
a32 = Utils.str_to_a32 data
len = a32.size - 3
last_i = 0