- Timestamp:
- 02/11/13 16:27:42 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/bletchley/blobtools.py
r28 r34 32 32 class DataEncoding(object): 33 33 charset = frozenset('') 34 extraneous_chars = '' 34 35 dialect = None 35 36 name = None … … 104 105 self.pad = '=' 105 106 107 if 'newline' in dialect: 108 self.extraneous_chars = '\r\n' 109 106 110 self.charset = frozenset('ABCDEFGHIJKLMNOPQRSTUVWXYZ' 107 111 +'abcdefghijklmnopqrstuvwxyz0123456789' 108 +self.c62+self.c63+self.pad )112 +self.c62+self.c63+self.pad+self.extraneous_chars) 109 113 110 114 def _guessPadLength(self, nopad_len): … … 115 119 116 120 def extraTests(self, blob): 121 for c in self.extraneous_chars: 122 blob = blob.replace(c, '') 123 117 124 nopad = blob.rstrip(self.pad) 118 125 padlen_guess = self._guessPadLength(len(nopad)) … … 129 136 130 137 def decode(self, blob): 138 for c in self.extraneous_chars: 139 blob = blob.replace(c, '') 140 131 141 if self.dialect.endswith('nopad'): 132 142 if self.pad in blob: … … 292 302 (base64Encoding, 'rfc3548', 200), 293 303 (base64Encoding, 'rfc3548-nopad', 201), 304 (base64Encoding, 'rfc3548-newline', 202), 294 305 (base64Encoding, 'filename', 210), 295 306 (base64Encoding, 'filename-nopad', 211),
Note: See TracChangeset
for help on using the changeset viewer.