def hash_to_baseb(matrix, message, b, k):
'''
i/p:
matrix : numpy array to be hashed
message : string that the sender sends
o/p:
list with k elements each b/w 0 to b-1
'''
hexval = hl.sha512(np.array_str(matrix) + message).hexdigest() # returns a string with 128 hex digits
return np.array(map(int, list(b2b(hexval, 16, b)[:k]))) # returns first k digits from hexval in a list
# this list of symbols allows conversion of numbers represented until base 36
评论列表
文章目录