lib/symmetric_encryption/header.rb in symmetric-encryption-4.3.2 vs lib/symmetric_encryption/header.rb in symmetric-encryption-4.3.3
- old
+ new
@@ -165,32 +165,32 @@
flags = buffer.getbyte(offset)
offset += 1
self.compress = (flags & FLAG_COMPRESSED) != 0
- if (flags & FLAG_IV) != 0
- self.iv, offset = read_string(buffer, offset)
- else
+ if (flags & FLAG_IV).zero?
self.iv = nil
+ else
+ self.iv, offset = read_string(buffer, offset)
end
- if (flags & FLAG_KEY) != 0
+ if (flags & FLAG_KEY).zero?
+ self.key = nil
+ else
encrypted_key, offset = read_string(buffer, offset)
self.key = cipher.binary_decrypt(encrypted_key)
- else
- self.key = nil
end
- if (flags & FLAG_CIPHER_NAME) != 0
- self.cipher_name, offset = read_string(buffer, offset)
- else
+ if (flags & FLAG_CIPHER_NAME).zero?
self.cipher_name = nil
+ else
+ self.cipher_name, offset = read_string(buffer, offset)
end
- if (flags & FLAG_AUTH_TAG) != 0
- self.auth_tag, offset = read_string(buffer, offset)
- else
+ if (flags & FLAG_AUTH_TAG).zero?
self.auth_tag = nil
+ else
+ self.auth_tag, offset = read_string(buffer, offset)
end
offset
end