Class: Zip::TraditionalEncrypter
Overview
Instance Method Summary
collapse
#gp_flags, #header_bytesize, #initialize
Instance Method Details
#data_descriptor(crc32, compressed_size, uncompressed_size) ⇒ Object
58
59
60
|
# File 'lib/zip/crypto/traditional_encryption.rb', line 58
def data_descriptor(crc32, compressed_size, uncompressed_size)
[0x08074b50, crc32, compressed_size, uncompressed_size].pack('VVVV')
end
|
#encrypt(data) ⇒ Object
54
55
56
|
# File 'lib/zip/crypto/traditional_encryption.rb', line 54
def encrypt(data)
data.unpack('C*').map { |x| encode x }.pack('C*')
end
|
44
45
46
47
48
49
50
51
52
|
# File 'lib/zip/crypto/traditional_encryption.rb', line 44
def (mtime)
[].tap do ||
( - 2).times do
<< Random.rand(0..255)
end
<< (mtime.to_binary_dos_time & 0xff)
<< (mtime.to_binary_dos_time >> 8)
end.map { |x| encode x }.pack('C*')
end
|
#reset! ⇒ Object
62
63
64
|
# File 'lib/zip/crypto/traditional_encryption.rb', line 62
def reset!
reset_keys!
end
|