Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 6b639b2f0d5332c2881a6b338a7cc93d > files > 16

euca2ools-1.3.1-10.fc15.src.rpm

--- euca2ools/euca2ools/__init__.py	2010-09-03 16:18:03 +0000
+++ euca2ools/euca2ools/__init__.py	2010-09-20 13:42:56 +0000
@@ -711,10 +711,13 @@
         print 'Encrypting image'
         enc_file = '%s.part' % file.replace('.tar.gz', '')
 
-        key = hex(BN.rand(16 * 8))[2:34].replace('L', 'c')
+        # get 17 bytes of randomness with top bit a '1'.
+        # convert to a hex string like '0x<34 hex chars>L'
+        # then take the last 32 of the hex digits, giving 32 random hex chars
+        key = hex(BN.rand(17 * 8,top=0))[4:36]
         if self.debug:
             print 'Key: %s' % key
-        iv = hex(BN.rand(16 * 8))[2:34].replace('L', 'c')
+        iv = hex(BN.rand(17 * 8,top=0))[4:36]
         if self.debug:
             print 'IV: %s' % iv