util.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:Lattice-Based-Signatures 作者: krishnacharya 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号