示例#1
0
def DecryptHash(key, ciphertext):
    """Decrypt a hash with a private key."""
    encrypted = base64.b64decode(ciphertext)
    plaintext = key.decrypt(compat.stringToBytes(encrypted))
    if plaintext:
        return compat.bytesToString(plaintext)
    else:
        # decryption failed
        return None
示例#2
0
def DecryptHash(key, ciphertext):
  """Decrypt a hash with a private key."""
  encrypted = base64.b64decode(ciphertext)
  plaintext = key.decrypt(compat.stringToBytes(encrypted))
  if plaintext:
    return compat.bytesToString(plaintext)
  else:
    # decryption failed
    return None
示例#3
0
def filter(packetNo, data, source, target):
    bytes = stringToBytes(data)
    if packetNo == 0 and 'Client2Server' in str(source):
        pass
    elif packetNo == 1 and 'Client2Server' not in str(source):
        print "server says hello"
        print bytes
        
    result = bytesToString(bytes)
    target.write(result)
    return result