import print function from future

pull/1/head
Pavol Rusnak 8 years ago
parent 1fe94e7fa5
commit 54c8bfd1d4
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

@ -1,4 +1,5 @@
#!/usr/bin/env python
from __future__ import print_function
from trezorlib.client import TrezorClient
from trezorlib.transport_hid import HidTransport

@ -1,4 +1,6 @@
#!/usr/bin/env python
from __future__ import print_function
__doc__ = '''
Use this script to cross-check that TREZOR generated valid
mnemonic sentence for given internal (TREZOR-generated)
@ -42,7 +44,7 @@ def generate_entropy(strength, internal_entropy, external_entropy):
raise Exception("External entropy too short")
entropy = hashlib.sha256(internal_entropy + external_entropy).digest()
entropy_stripped = entropy[:strength / 8]
entropy_stripped = entropy[:strength // 8]
if len(entropy_stripped) * 8 != strength:
raise Exception("Entropy length mismatch")
@ -56,7 +58,7 @@ def main():
trzr = binascii.unhexlify(input("Please enter TREZOR-generated entropy (in hex): ").strip())
word_count = int(input("How many words your mnemonic has? "))
strength = word_count * 32 / 3
strength = word_count * 32 // 3
entropy = generate_entropy(strength, trzr, comp)

@ -1,4 +1,5 @@
#!/usr/bin/python
from __future__ import print_function
import binascii
import os
import random
@ -78,7 +79,7 @@ class MyTXAPIBitcoin(object):
i.script_sig = os.urandom(100)
i.sequence = 0xffffffff
if (nr % 50 == 0):
print nr
print(nr)
myout = random.randint(0, txsize-1)
segwit = 1 #random.randint(0,1)
for vout in range(txsize):
@ -118,8 +119,8 @@ class MyTXAPIBitcoin(object):
prev_hash=txhash,
prev_index = myout
))
#print binascii.hexlify(txser)
#print binascii.hexlify(txhash)
#print(binascii.hexlify(txser))
#print(binascii.hexlify(txhash))
self.txs[binascii.hexlify(txhash)] = t
self.outputs = [
@ -137,7 +138,7 @@ class MyTXAPIBitcoin(object):
def get_tx(self, txhash):
t = self.txs[txhash]
#print t
#print(t)
return t
def main():
@ -149,11 +150,11 @@ def main():
# Check whether we found any
if len(devices) == 0:
print 'No TREZOR found'
print('No TREZOR found')
return
# Use first connected device
print devices[0][0]
print(devices[0][0])
# transport = BridgeTransport(devices[0][0])
transport = HidTransport(devices[0])
@ -164,14 +165,14 @@ def main():
# client.set_tx_api(TXAPITestnet())
txstore.set_client(client)
txstore.set_publickey(client.get_public_node(client.expand_path("44'/0'/0'")))
print "creating input txs"
print("creating input txs")
txstore.create_inputs(numinputs, sizeinputtx)
print "go"
print("go")
client.set_tx_api(txstore)
# client.set_tx_api(MyTXAPIBitcoin())
# Print out TREZOR's features and settings
print client.features
print(client.features)
# Get the first address of first BIP44 account
# (should be the same address as shown in mytrezor.com)
@ -215,7 +216,7 @@ def main():
# (signatures, serialized_tx) = client.sign_tx('Testnet', inputs, outputs)
(signatures, serialized_tx) = client.sign_tx('Bitcoin', txstore.get_inputs(), txstore.get_outputs())
print 'Transaction:', binascii.hexlify(serialized_tx)
print('Transaction:', binascii.hexlify(serialized_tx))
client.close()

@ -1,3 +1,5 @@
from __future__ import print_function
import unittest
import config

@ -1,3 +1,5 @@
from __future__ import print_function
import sys
sys.path = ['../',] + sys.path

@ -1,3 +1,5 @@
from __future__ import print_function
import unittest
import common
import time

@ -1,3 +1,5 @@
from __future__ import print_function
import unittest
import common
import binascii

@ -1,3 +1,5 @@
from __future__ import print_function
import unittest
import common
import math

@ -1,3 +1,5 @@
from __future__ import print_function
import unittest
import common

@ -1,3 +1,5 @@
from __future__ import print_function
import unittest
import common
import binascii

@ -1,3 +1,5 @@
from __future__ import print_function
import unittest
import common
import binascii

@ -1,3 +1,5 @@
from __future__ import print_function
import time
import unittest
import common

@ -1,3 +1,5 @@
from __future__ import print_function
import unittest
import common
import binascii

@ -1,4 +1,5 @@
#!/usr/bin/env python
from __future__ import print_function
'''
Use TREZOR as a hardware key for opening EncFS filesystem!

@ -1,4 +1,5 @@
#!/usr/bin/env python
from __future__ import print_function
import os
import binascii
import argparse

@ -1,3 +1,5 @@
from __future__ import print_function
import os
import sys
import time

@ -1,3 +1,5 @@
from __future__ import print_function
from . import messages_pb2 as proto
from .transport import NotImplementedException

@ -1,3 +1,5 @@
from __future__ import print_function
import sys
import math
import operator

@ -1,3 +1,5 @@
from __future__ import print_function
'''PipeTransport implements fake wire transport over local named pipe.
Use this transport for talking with trezor simulator.'''

@ -1,3 +1,5 @@
from __future__ import print_function
'''SerialTransport implements wire transport over serial port.'''
# Local serial port loopback: socat PTY,link=COM8 PTY,link=COM9

@ -1,3 +1,5 @@
from __future__ import print_function
'''SocketTransport implements TCP socket interface for Transport.'''
import socket

Loading…
Cancel
Save