NuParserv003.py 文件源码

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

项目:NuExplorerOS 作者: JetJet13 项目源码 文件源码
def getDifficult(bits):
    step0 = getBigEndian(bits)    
    step1 = "0x"+step0
    step2 = BitArray(step1)
    step3 = step2.hex

    first_pair ="0x" + step3[:2]
    firstPair = BitArray(first_pair)

    second_pair ="0x" + step3[2:8]
    secondPair = BitArray(second_pair)

    firstPairVal = firstPair.int
    secondPairVal = secondPair.int

    formula = 2**(8*(firstPairVal -3))
    bitsDec = secondPairVal * formula

    highestDifficulty = BitArray("0x00000000FFFF0000000000000000000000000000000000000000000000000000")
    highDiffDec = highestDifficulty.int

    answer = float(highDiffDec/bitsDec)
    return answer
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号