Esempio n. 1
0
def decode(s, storage=BIT_STORAGE, alpha=ALPHABET):
  """
    Accepts any iterable object, you can override storage and alpha
    keywords to change to another language set and storage mechanism

    Returns a string/bytes
  """
  n = [ord(a) for a in s if a != TWUUENC_START and a != TWUUENC_START_ZLIB]
  bs = BitString()
  for a in n:
    for pos,l in enumerate(alpha):
      if a == l:
        bs.append(BitString(uint=pos, length=storage))
  bs.seekbyte(0)
  return bs.readbytes(len(bs)/8).data.rstrip('\0')