force key length to 8, pad if less and truncate if more
git-svn-id: file:///home/svn/framework3/trunk@11131 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
10892a3fc3
commit
20dc5d57cf
|
@ -33,6 +33,9 @@ class Cipher
|
|||
|
||||
def self.mangle_password(password)
|
||||
key = password || ''
|
||||
key.slice!(8,key.length) if key.length > 8
|
||||
key << "\x00" * (8 - key.length) if key.length < 8
|
||||
|
||||
# We have to mangle the key so the LSB are kept vs the MSB
|
||||
[key.unpack('B*').first.scan(/.{8}/).map! { |e| e.reverse }.join].pack('B*')
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue