Changeset - b9f1f39cd7af
[Not reviewed]
default
0 2 0
Laman - 4 years ago 2020-04-13 13:53:07

check for non-unique shares on joining
2 files changed with 6 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/condensed.py
Show inline comments
 
@@ -60,6 +60,9 @@ def reconstruct_raw(*shares):
 

	
 
	:param shares: (((int) i, (bytes) share), ...)
 
	:return: (bytes) reconstructed secret. Too few shares returns garbage."""
 
	if len({x for (x, _) in shares}) < len(shares):
 
		raise SException("Found a non-unique share. Please check your inputs.")
 

	
 
	secret_len = len(shares[0][1])
 
	res = [None]*secret_len
 
	for i in range(secret_len):
src/shamira.py
Show inline comments
 
@@ -40,6 +40,9 @@ def reconstruct_raw(*shares):
 

	
 
	:param shares: (((int) i, (bytes) share), ...)
 
	:return: (bytes) reconstructed secret. Too few shares return garbage."""
 
	if len({x for (x, _) in shares}) < len(shares):
 
		raise MalformedShare("Found a non-unique share. Please check your inputs.")
 

	
 
	secret_len = len(shares[0][1])
 
	res = [None]*secret_len
 
	for i in range(secret_len):
0 comments (0 inline, 0 general)