hss.py 文件源码

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

项目:hash-sigs 作者: davidmcgrew 项目源码 文件源码
def lmots_sig_to_pub(sig, S, lmots_type, message):
    signature = LmotsSignature.deserialize(sig)
    if (signature.type != lmots_type):
        raise ValueError(err_unknown_typecode)
    n, p, w, ls = lmots_params[lmots_type]
    hashQ = H(S + signature.C + message + D_MESG)
    V = hashQ + checksum(hashQ, w, ls)
    hash = SHA256.new()
    hash.update(S)
    for i, y in enumerate(signature.y):
        tmp = y
        for j in xrange(coef(V, i, w), 2**w - 1):
            tmp = H(S + tmp + u16str(i) + u8str(j) + D_ITER)
        hash.update(tmp)
    hash.update(D_PBLC)
    return hash.digest()

# ***************************************************************
#                                                               |
#               LMS N-time signatures functions                 |
#                                                               |
# ***************************************************************
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号