Changeset 71


Ignore:
Timestamp:
08/26/14 18:37:44 (10 years ago)
Author:
tim
Message:

chosenct and http2py convenience fixes

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/bin/bletchley-http2py

    r70 r71  
    124124
    125125# from bletchley import blobtools,buffertools
     126# from bletchley import chosenct
    126127# from bletchley.CBC import *
    127128
     
    222223
    223224
    224 def fetch(data):
     225def fetch(data, other=None):
    225226    ret_val = False
    226227    connection = newConnection()
     
    250251# Byte-by-byte probing of ciphertext
    251252# ciphertext = blobtools.decode('{ encoding }', data)
    252 # result = chosenct.probe_bytes(fetch, data, [1,2,4,8,16,32,64,128], max_threads=5)
     253# result = chosenct.probe_bytes(fetch, ciphertext, [1,2,4,8,16,32,64,128], max_threads=5)
    253254# print(result.toHTML())
    254255''')
  • trunk/lib/bletchley/chosenct.py

    r65 r71  
    7575
    7676    def _generate_colors(self, s):
     77        if isinstance(s, str):
     78            s = s.encode('utf-8')
    7779        base=bytes(hashlib.md5(s).digest()[0:6])
    7880        color1 = "#%.2X%.2X%.2X" % tuple(base[:3])
     
    9698                message = self._raw_table[offset][v]
    9799                bg,fg = self._generate_colors(message)
    98                 message = message.decode('utf-8')
     100                if not isinstance(message, str):
     101                    message = message.decode('utf-8')
    99102
    100103                truncated = message[0:maxlen]
Note: See TracChangeset for help on using the changeset viewer.