JHUISI / charm

Charm: A Framework for Rapidly Prototyping Cryptosystems
http://charm-crypto.io
GNU Lesser General Public License v3.0
542 stars 166 forks source link

SecretUtil object has no attribute 'verbose' #241

Open andreaferretti opened 4 years ago

andreaferretti commented 4 years ago

It appears that SecretUtil tries to access a variable member verbose, which is never set, causing a failure during SecretUtil.recoverSecret(). Here is an example that will trigger the failure

from charm.toolbox.pairinggroup import PairingGroup
from charm.toolbox.secretutil import SecretUtil

pairing_group = PairingGroup('BN254')
secret_util = SecretUtil(pairing_group)
policy = secret_util.createPolicy('a and (b or c)')
shares = secret_util.calculateSharesDict(15, policy)
secret_util.recoverSecret(shares)

This results in

AttributeError                            Traceback (most recent call last)
<ipython-input-1-a10aff91f822> in <module>
      6 policy = secret_util.createPolicy('a and (b or c)')
      7 shares = secret_util.calculateSharesDict(15, policy)
----> 8 secret_util.recoverSecret(shares)

~/.bin/miniconda3/envs/charm/lib/python3.6/site-packages/Charm_Crypto-0.50-py3.6-macosx-10.9-x86_64.egg/charm/toolbox/secretutil.py in recoverSecret(self, shares)
     48         if user indeed has at least k of n shares, then secret will be recovered."""
     49         list = shares.keys()
---> 50         if self.verbose: print(list)
     51         coeff = self.recoverCoefficients(list)
     52         secret = 0

AttributeError: 'SecretUtil' object has no attribute 'verbose'
abhishekbisht1429 commented 1 year ago

Hi @andreaferretti , did you find any solution to this problem ?

andreaferretti commented 1 year ago

No, sorry