Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ECGroup Python 2.7 bytes fix #85

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions charm/toolbox/ecgroup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
try:
from charm.core.math.elliptic_curve import elliptic_curve,ec_element,ZR,G,init,random,order,getGenerator,bitsize,serialize,deserialize,hashEC,encode,decode,getXY
import charm.core.math.elliptic_curve as ecc
from charm.toolbox import bitstring
except Exception as err:
print(err)
exit(-1)
Expand Down Expand Up @@ -66,7 +67,7 @@ def hash(self, args, target_type=ZR):
if type(i) == ec_element:
s += serialize(i)
elif type(i) == str:
s += bytes(str(i), 'utf8')
s += bitstring.getBytes(str(i), 'utf8')
elif type(i) == bytes:
s += i
else:
Expand Down Expand Up @@ -129,4 +130,4 @@ def GetGranularBenchmarks(self):
def GetBenchmark(self, option):
"""retrieves benchmark results for any of these options:
RealTime, CpuTime, Mul, Div, Add, Sub, Exp, Granular"""
return ecc.GetBenchmark(self.ec_group, option)
return ecc.GetBenchmark(self.ec_group, option)