我正在尝试研究一些非常基本的数字,并且需要检查逻辑上是否正确。
查看比特币时,有2 ^ 160个地址。比特币使用Base58编码,因此有24个小写字母,24个大写字母和10个数字。
因此,假设我使用Vanitygen并希望获得一个以1TEST开头的地址,假设我发现以1TEST开头的地址的机会是58 ^ 5中的1。说从1TEST开始的比特币地址数量是2 ^ 160/58 ^ 5正确吗?因此,有2.2 ^ 39个地址的1TEST?
答案 0 :(得分:1)
元:如标签说明所述,这不是编程问题,可能属于bitcoin.SX。而且它绝对与加密无关。
近。首先,比特币的base58实际上是9位字母,24个小写字母,25个大写字母。更重要的是,编码地址以'version' (really type) byte开头,但是前00个字节是经过特殊编码的,因此第一个字符[[1, a], [1, b], [2, b], [2, a], [3, a]]
实际上对应于类型字节00,表示普通的传统密钥哈希(不是测试,不是脚本) ,而不是privatekey)。接下来的4个字符(如果不是以更多的STUD_NUMBER = 2500
def main():
TotCurr, TotCe, again = init()
TotCurr, TotCe = loop(TotCurr, TotCe, again)
dispTot(TotCurr, TotCe)
def init():
TotCurr = 0
TotCe = 0
again = "Y"
return TotCurr, TotCe, again
def loop(TotCurr, TotCe, again):
while again.upper() == "Y":
firstName, lastName, studNum = getInput()
TotCurr, TotCe, studType = calc(studNum, TotCurr, TotCe)
dispDetail(studType)
again = input("Do you want to add another student record? (Y/N): ")
print()
return TotCurr, TotCe
def getInput():
firstName = input("please enter students first name: ")
lastName = input("please enter students last name: ")
studNum = input("please enter the student ID number: ")
return firstName, lastName, studNum
def calc(studNum, TotCurr, TotCe):
if studNum > STUD_NUMBER:
studType = "Curriculum"
TotCurr += 1
else:
studType = "Continuing Education"
TotCe +=1
return TotCurr, TotCe, studType
def dispdetail(studType):
print("This student is currently in the", studType, 'course')
print()
def dispTot(TotCurr, TotCe):
print("Total students in Cuuriculum course", TotCurr)
print("Total students in Continuing education course", TotCe)
main()
enter code here
开头)则表示哈希的高位数字,并且由于1
在范围为1的范围的不平衡部分不能匹配+33个字符,它确实覆盖了空间的1/58 ^ 4的精确部分,即2 ^ 160/58 ^ 4,大约是2 ^ 136.6。