Padding

Padding methods for password based encryption
Download

Padding Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Public Domain
  • Publisher Name:
  • Peio Popov
  • Publisher web site:
  • http://peio.org

Padding Tags


Padding Description

Padding methods for password based encryption Padding is a software that provides padding methods for password based encryption.Append and remove padding to/from a string.I. Functions:appendPadding(str, blocksize=AES_blocksize, mode='CMS'): Pad (append padding to) string for use with symmetric encryption algorithm Input: (string) str - String to be padded (int) blocksize - block size of the encryption algorithm. Usually 8 or 16 bytes (string) mode - padding scheme one in (CMS, Bit, ZeroLen, Null, Space, Random) Return:(string) Padded string according to chosen padding moderemovePadding(str, blocksize=AES_blocksize, mode='CMS'): Remove padding from string Input: (str) str - String to be padded (int) blocksize - block size of the algorithm. Usually 8 or 16 bytes (string) mode - padding scheme one in (CMS, Bit, ZeroLen, Null, Space, Random) Return:(string) Decrypted string without paddingII. Blocksizes:DES (Triple DES), CAST5 and Blowfish have block size of 64 bits = 8 bytesDES_blocksize = 8CAST5_blocksize = 8Blowfish_blocksize = 8AES has fixed block size of 128 bits = 16 bytes and this is the default blocksizeAES_blocksize = 16III. Mode:MODES ={(0,'CMS') : 'Pad with bytes all of the same value as the number of padding bytes. Default mode used in Cryptographic Message Syntax (CMS as defined in RFC 5652, PKCS#5, PKCS#7 and RFC 1423 PEM)',(1,'Bit') : 'BitPadding: Pad with 0x80 (10000000) followed by zero (null) bytes. Described in ANSI X.923 and ISO/IEC 9797-1',(2,'ZeroLen') : 'Pad with zeroes except make the last byte equal to the number (length) of padding bytes',(3,'Null') : 'Pad with null bytes. Only for encrypting of text data.',(4,'Space') : 'Pad with spaces. Only for encrypting of text data.',(5,'Random') : 'ISO 10126 Padding (withdrawn in 2007): Pad with random bytes + last byte equal to the number of padding bytes' }CMS mode is the default oneExamples in the README.txt file Requirements: · Python


Padding Related Software