mouchicc

Test-case

Dec 14th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3. import os, binascii
  4. import bitcoin as btc
  5. import random, time, sys, copy
  6. import borromean_signature as brs
  7. import range_proof as rp
  8. import MLSAG_RS as mlsag
  9. import stealth_addresses as sa
  10. from classes import *
  11. import itertools
  12.  
  13. # TOCHANGE
  14. MESSAGE = 'abc'
  15.  
  16. # Include borromean verification?
  17. incl_ver = True
  18.  
  19. # Some data
  20. RM = []
  21. self_keypair = Keypair()
  22. pid = os.urandom(32)
  23.  
  24. # 3) Normally we get these from the blockchain
  25. # Now we create 'amount_rm' amount of ring members
  26. def generate_ring_members(amount_rm):
  27. RM = [None] * amount_rm
  28. for r in range(amount_rm):
  29. valid = False
  30. while not valid:
  31. rnd = 50
  32. R_RP = brs.sign_brs2(rnd, MESSAGE)
  33. R_C = rp.sumCi(R_RP.cs)
  34. # Quick verification of Borromean signature
  35. if incl_ver and not brs.ver_brs(MESSAGE, R_RP.vks, R_RP.sig):
  36. # print binascii.hexlify(z)
  37. print R_RP.vks
  38. print binascii.hexlify(R_RP.sig)
  39. print ("R_C:", R_C)
  40. print '!!! Verification of BorSig for ' + str(r) + ' failed (' + str(rnd) + ')!!!'
  41. else:
  42. valid = True
  43.  
  44. return RM
  45.  
  46. if __name__ == '__main__':
  47. generate_ring_members(100)
Advertisement
Add Comment
Please, Sign In to add comment