diff --git a/sapling_generators.py b/sapling_generators.py index 4a313a3..7ebb5ba 100644 --- a/sapling_generators.py +++ b/sapling_generators.py @@ -3,7 +3,7 @@ from binascii import hexlify from pyblake2 import blake2s from sapling_jubjub import Point, JUBJUB_COFACTOR -from sapling_utils import chunk +from tv_output import chunk # First 64 bytes of the BLAKE2s input during group hash. # This is chosen to be some random string that we couldn't have diff --git a/sapling_key_components.py b/sapling_key_components.py index 659c5f0..1bae235 100644 --- a/sapling_key_components.py +++ b/sapling_key_components.py @@ -6,7 +6,8 @@ from sapling_generators import PROVING_KEY_BASE, SPENDING_KEY_BASE, group_hash from sapling_jubjub import Fr from sapling_merkle_tree import MERKLE_DEPTH from sapling_notes import note_commit, note_nullifier -from sapling_utils import chunk, leos2bsp, leos2ip +from sapling_utils import leos2bsp, leos2ip +from tv_output import chunk # # Utilities diff --git a/sapling_signatures.py b/sapling_signatures.py index f249f4e..a8ce8ab 100644 --- a/sapling_signatures.py +++ b/sapling_signatures.py @@ -6,7 +6,8 @@ from pyblake2 import blake2b from sapling_generators import SPENDING_KEY_BASE from sapling_jubjub import Fr, Point, r_j from sapling_key_components import to_scalar -from sapling_utils import cldiv, chunk, leos2ip +from sapling_utils import cldiv, leos2ip +from tv_output import chunk def H(x): diff --git a/sapling_utils.py b/sapling_utils.py index a9d2b7a..8ea08d4 100644 --- a/sapling_utils.py +++ b/sapling_utils.py @@ -3,10 +3,6 @@ def cldiv(n, divisor): return (n + (divisor - 1)) // divisor -def chunk(h): - h = str(h, 'utf-8') - return '0x' + ', 0x'.join([h[i:i+2] for i in range(0, len(h), 2)]) - def i2lebsp(l, x): return [int(c) for c in format(x, '0%sb' % l)[::-1]] diff --git a/tv_output.py b/tv_output.py new file mode 100644 index 0000000..f8c389a --- /dev/null +++ b/tv_output.py @@ -0,0 +1,3 @@ +def chunk(h): + h = str(h, 'utf-8') + return '0x' + ', 0x'.join([h[i:i+2] for i in range(0, len(h), 2)])