def test_entropy(client, entropy_length):
    with client:
        client.set_expected_responses(
            [m.ButtonRequest(code=m.ButtonRequestType.ProtectCall), m.Entropy()]
        )
        ent = misc.get_entropy(client, entropy_length)
        assert len(ent) == entropy_length
        print("{} bytes: entropy = {}".format(entropy_length, entropy(ent)))
Exemplo n.º 2
0
 def test_entropy(self):
     for l in [
             0, 1, 2, 3, 4, 5, 8, 9, 16, 17, 32, 33, 64, 65, 128, 129, 256,
             257, 512, 513, 1024
     ]:
         with self.client:
             self.client.set_expected_responses([
                 proto.ButtonRequest(
                     code=proto.ButtonRequestType.ProtectCall),
                 proto.Entropy()
             ])
             ent = self.client.get_entropy(l)
             assert len(ent) == l
             print('entropy = ', entropy(ent))
 def test_get_entropy(self, client):
     with client:
         client.set_expected_responses(
             [proto.ButtonRequest(), proto.Entropy()])
         misc.get_entropy(client, 10)
Exemplo n.º 4
0
 def test_get_entropy(self):
     with self.client:
         self.setup_mnemonic_pin_passphrase()
         self.client.set_expected_responses(
             [proto.ButtonRequest(), proto.Entropy()])
         self.client.get_entropy(10)