示例#1
0
 def test_encrypt_decrypt(self):
     s = os.urandom(500)
     length = len(s)
     encrypted_message = encrypt_message(self.address, s)
     message = decrypt_message(self.address, encrypted_message)
     self.assertEqual(s, message[:length])
示例#2
0
#!/usr/bin/env python

import sys

from coinmessage import encrypt_message


USAGE = """%s <bitcoin address> <message>""" % sys.argv[0]

if __name__ == '__main__':
    if len(sys.argv) != 3:
        sys.exit(USAGE)

    bitcoin_address, message = sys.argv[1:]

    if len(bitcoin_address) != 34:
        sys.exit(USAGE)

    print encrypt_message(bitcoin_address, message)