小编cal*_*pto的帖子

将32位数字分成单个字段

是否有蟒蛇一个快速的方法来分割32位的变量,比如a1a2a3a4a1,a2,a3,a4快?我已经通过将值更改为十六进制然后拆分它来完成它,但似乎浪费时间做int- > string- > int.

python

3
推荐指数
3
解决办法
6628
查看次数

我的ripemd160 python代码出了什么问题?

我尝试的一切都给了我错误的输出值.我甚至复制了C代码并更改了它们,以便它们可以在python中工作,我仍然得到错误的输出.怎么了?

import os, math

def makehex(value,size=8):
    value = hex(value)[2:]
    if value[-1] == 'L':
        value = value[0:-1]
    while len(value)<size:
        value = '0' + value
    return value

def makebin(value,size=32):
    value = bin(value)[2:]
    while len(value)<size:
        value = '0' + value
    return value

def ROL(value,n):
    return (value << n) | (value >> 32-n)

def little_end(string,base = 16):
    t = ''
    if base == 2:
        s= 8
    if base == 16:
        s = 2
    for x in range(len(string)/s):
        t = string[s*x:s*(x+1)] + t
    return t …
Run Code Online (Sandbox Code Playgroud)

python cryptography ripemd

1
推荐指数
1
解决办法
1605
查看次数

标签 统计

python ×2

cryptography ×1

ripemd ×1