home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / var / lib / python-support / python2.6 / gdata / tlslite / utils / TripleDES.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-04-20  |  1.4 KB  |  35 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. '''Abstract class for 3DES.'''
  5. from compat import *
  6.  
  7. class TripleDES:
  8.     
  9.     def __init__(self, key, mode, IV, implementation):
  10.         if len(key) != 24:
  11.             raise ValueError()
  12.         len(key) != 24
  13.         if mode != 2:
  14.             raise ValueError()
  15.         mode != 2
  16.         if len(IV) != 8:
  17.             raise ValueError()
  18.         len(IV) != 8
  19.         self.isBlockCipher = True
  20.         self.block_size = 8
  21.         self.implementation = implementation
  22.         self.name = '3des'
  23.  
  24.     
  25.     def encrypt(self, plaintext):
  26.         if not len(plaintext) % 8 == 0:
  27.             raise AssertionError
  28.  
  29.     
  30.     def decrypt(self, ciphertext):
  31.         if not len(ciphertext) % 8 == 0:
  32.             raise AssertionError
  33.  
  34.  
  35.