当前位置: 首页>>代码示例>>Python>>正文


Python MiniNero.hashToPoint_cn方法代码示例

本文整理汇总了Python中MiniNero.hashToPoint_cn方法的典型用法代码示例。如果您正苦于以下问题:Python MiniNero.hashToPoint_cn方法的具体用法?Python MiniNero.hashToPoint_cn怎么用?Python MiniNero.hashToPoint_cn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MiniNero的用法示例。


在下文中一共展示了MiniNero.hashToPoint_cn方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: MLSAG_Ver

# 需要导入模块: import MiniNero [as 别名]
# 或者: from MiniNero import hashToPoint_cn [as 别名]
def MLSAG_Ver(pk, keyimage, c1, s ):
    rows = len(pk)
    cols = len(pk[0])
    print("verifying MLSAG sig of dimensions ",rows ,"x ", cols)
    L = [[None]*cols]
    R = [[None]*cols]
    pj = ''.join(pk[0])
    for i in range(1, rows):
      L.append([None] * cols)
      R.append([None] * cols)
      pj = pj + ''.join(pk[i])
    c= [None]*(cols+1) #you do an extra one, and then check the wrap around 
    HP = [[MiniNero.hashToPoint_cn(i) for i in pk[0]]]
    for j in range(1, rows):
      HP.append([MiniNero.hashToPoint_cn(i) for i in pk[j]])
    c[0] = c1
    j = 0
    while j < cols:
      tohash = pj
      for i in range(0, rows):
        L[i][j] = MiniNero.addKeys(MiniNero.scalarmultBase(s[i][j]), MiniNero.scalarmultKey(pk[i][j], c[j]))
        R[i][j] = MiniNero.addKeys(MiniNero.scalarmultKey(HP[i][j], s[i][j]), MiniNero.scalarmultKey(keyimage[i], c[j]))
        tohash = tohash + L[i][j] + R[i][j]
      j = j + 1
      c[j] = MiniNero.cn_fast_hash(tohash)

    rv = (c[0] == c[cols])
    print("c", c)
    print("sig verifies?", rv)
    
    return rv
开发者ID:Coder420,项目名称:MiniNero,代码行数:33,代码来源:MLSAG.py

示例2: keyImage

# 需要导入模块: import MiniNero [as 别名]
# 或者: from MiniNero import hashToPoint_cn [as 别名]
def keyImage(x, rows):
    HP = keyVector(rows)
    KeyImage = keyVector(rows)
    for i in range(0, rows):
      HP[i] = MiniNero.hashToPoint_cn(MiniNero.scalarmultBase(x[i]))
      KeyImage[i] = MiniNero.scalarmultKey(HP[i], x[i])
    return KeyImage
开发者ID:Coder420,项目名称:MiniNero,代码行数:9,代码来源:MLSAG.py

示例3: MLSAG_Sign

# 需要导入模块: import MiniNero [as 别名]
# 或者: from MiniNero import hashToPoint_cn [as 别名]
def MLSAG_Sign(pk, xx, index):
    rows = len(xx)
    cols = len(pk[0])
    print("Generating MLSAG sig of dimensions ",rows ,"x ", cols)
    L = [[None] * cols] #list of keyvectors? except it's indexed by cols... it's kind of internal actually
    R = [[None] * cols]
    s = [[PaperWallet.skGen() for i in range(0, cols)] ] #first index is rows, second is cols, wonder if I should switch that..
    HP = [[MiniNero.hashToPoint_cn(i) for i in pk[0]]]

    pj = ''.join(pk[0])  
    for i in range(1, rows):
      L.append([None] * cols)
      R.append([None] * cols)
      s.append([PaperWallet.skGen() for j in range(0, cols)])
      HP.append([MiniNero.hashToPoint_cn(j) for j in pk[i]]) 
      pj = pj + ''.join(pk[i])

    c= [None] * cols #1-dimensional
    keyimage = keyImage(xx, rows) #ok
    for i in range(0, rows):
      L[i][index] = MiniNero.scalarmultBase(s[i][index]) #aG
      R[i][index] = MiniNero.scalarmultKey(HP[i][index], s[i][index]) #aH
    j = (index + 1) % cols
    tohash = pj
    for i in range(0, rows):
      tohash = tohash + L[i][index] + R[i][index]
    c[j] = MiniNero.cn_fast_hash(tohash)
    while j != index:
      tohash = pj
      for i in range(0, rows):
        L[i][j] = MiniNero.addKeys(MiniNero.scalarmultBase(s[i][j]), MiniNero.scalarmultKey(pk[i][j], c[j])) #Lj = sG + cxG
        R[i][j] = MiniNero.addKeys(MiniNero.scalarmultKey(HP[i][j], s[i][j]), MiniNero.scalarmultKey(keyimage[i], c[j])) #Rj = sH + cxH
        tohash = tohash + L[i][j] + R[i][j]
      j = (j + 1) % cols
      c[j] = MiniNero.cn_fast_hash(tohash)
    for i in range(0, rows):
      s[i][index] = MiniNero.sc_mulsub_keys(s[i][index], c[index], xx[i]) #si = a - c x so a = s + c x
    return keyimage, c[0], s
开发者ID:Coder420,项目名称:MiniNero,代码行数:40,代码来源:MLSAG.py

示例4: keyImageV

# 需要导入模块: import MiniNero [as 别名]
# 或者: from MiniNero import hashToPoint_cn [as 别名]
def keyImageV(x):
    #takes as input a keyvector, returns the keyimage-vector
    return [MiniNero.scalarmultKey(MiniNero.hashToPoint_cn(MiniNero.scalarmultBase(xx)), xx) for xx in x]
开发者ID:Coder420,项目名称:MiniNero,代码行数:5,代码来源:MLSAG2.py

示例5: hashKeyVector

# 需要导入模块: import MiniNero [as 别名]
# 或者: from MiniNero import hashToPoint_cn [as 别名]
def hashKeyVector(v):
    return [MiniNero.hashToPoint_cn(vi) for vi in v]
开发者ID:Coder420,项目名称:MiniNero,代码行数:4,代码来源:MLSAG2.py


注:本文中的MiniNero.hashToPoint_cn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。