feat: update demo

This commit is contained in:
sangge 2023-10-18 17:27:52 +08:00
parent 6c1fefd9d3
commit 854bb17cac

View File

@ -2,8 +2,7 @@ from tpre import *
# 1 # 1
pk_a, sk_a = GenerateKeyPair(1, ()) pk_a, sk_a = GenerateKeyPair(1, ())
m = b'hello world' m = b"hello world"
m = int.from_bytes(m)
# 2 # 2
capsule_ct = Encrypt(pk_a, m) capsule_ct = Encrypt(pk_a, m)
@ -11,8 +10,8 @@ capsule_ct = Encrypt(pk_a, m)
# 3 # 3
pk_b, sk_b = GenerateKeyPair(1, ()) pk_b, sk_b = GenerateKeyPair(1, ())
N = 20 N = 5
T = 10 T = 2
# 5 # 5
rekeys = GenerateReKey(sk_a, pk_b, N, T) rekeys = GenerateReKey(sk_a, pk_b, N, T)
@ -28,4 +27,4 @@ for rekey in rekeys:
cfrags = mergecfrag(cfrag_cts) cfrags = mergecfrag(cfrag_cts)
m = DecryptFrags(sk_b, pk_b, pk_a, cfrags) m = DecryptFrags(sk_b, pk_b, pk_a, cfrags)
print(m)