def Verify(**kwargs):
'''
Verification for the signature
i/p:
msg: the string sent by the sender
(z,c): vectors in Zq, the signature
A : numpy array, Verification Key dimension nxm
T : the matrix AS mod q ,it is used in the Verification of the signature
'''
msg, z, c, A, T, sd, eta, m, k, q = kwargs['msg'], kwargs['z'], kwargs['c'], kwargs['A'], kwargs['T'], kwargs['sd'], kwargs['eta'], kwargs['m'], kwargs['k'], kwargs['q']
norm_bound = eta * sd * np.sqrt(m)
# checks for norm of z being small and that H(Az-Tc mod q,msg) hashes to c
vec = util.vector_to_Zq(np.array(np.matmul(A,z) - np.matmul(T,c)), q)
hashedList = util.hash_to_baseb(vec, msg, 3, k)
print hashedList, c
if np.sqrt(z.dot(z)) <= norm_bound and np.array_equal(c, hashedList):
return True
else:
return False
评论列表
文章目录