Beispiel #1
0
def calc_hdr_hash(blk_hdr):
	#hash1 = hashlib.sha256()
	#hash1.update(blk_hdr)
	#hash1_o = hash1.digest()

	#hash2 = hashlib.sha256()
	#hash2.update(hash1_o)
	#hash2_o = hash2.digest()

	#return hash2_o
        pow_hash = dash_hash.getPoWHash(blk_hdr)
        return pow_hash
def calc_hdr_hash(blk_hdr):
    #hash1 = hashlib.sha256()
    #hash1.update(blk_hdr)
    #hash1_o = hash1.digest()

    #hash2 = hashlib.sha256()
    #hash2.update(hash1_o)
    #hash2_o = hash2.digest()

    #return hash2_o
    pow_hash = dash_hash.getPoWHash(blk_hdr)
    return pow_hash
Beispiel #3
0
import dash_hash as dashhash

__b58chars = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
__b58base = len(__b58chars)

global PUBKEY_ADDRESS
global SCRIPT_ADDRESS
PUBKEY_ADDRESS = 76
SCRIPT_ADDRESS = 16

def rev_hex(s):
    return s.decode('hex')[::-1].encode('hex')


# Dash's X11 Function
HashX11 = lambda x: dashhash.getPoWHash(x)

Hash = lambda x: hashlib.sha256(hashlib.sha256(x).digest()).digest()

hash_encode = lambda x: x[::-1].encode('hex')

hash_decode = lambda x: x.decode('hex')[::-1]


def header_to_string(res):
    pbh = res.get('prev_block_hash')
    if pbh is None:
        pbh = '0'*64

    return int_to_hex4(res.get('version')) \
           + rev_hex(pbh) \
Beispiel #4
0
def polishash(s):
    return dash_hash.getPoWHash(s)
Beispiel #5
0
 def test_dash_hash(self):
     self.pow_hash = hexlify(dash_hash.getPoWHash(self.block_header))
     self.assertEqual(self.pow_hash, self.best_hash)
Beispiel #6
0
def gullhash(s):
    return dash_hash.getPoWHash(s)
Beispiel #7
0
def masterhash(s):
    return dash_hash.getPoWHash(s)
def helpforcancerhash(s):
    return dash_hash.getPoWHash(s)
Beispiel #9
0
def zaaphash(s):
    return dash_hash.getPoWHash(s)
Beispiel #10
0
def ripoffcoinhash(s):
    return dash_hash.getPoWHash(s)
Beispiel #11
0
def exiliumhash(s):
    return dash_hash.getPoWHash(s)
Beispiel #12
0
def dashhash(s):
    return dash_hash.getPoWHash(s)  #To do for Pura - no pura_dash repo!
Beispiel #13
0
def waggoxhash(s):
    return dash_hash.getPoWHash(s)
Beispiel #14
0
def corvushash(s):
    return dash_hash.getPoWHash(s)
Beispiel #15
0
def mocacoinhash(s):
    return dash_hash.getPoWHash(s)
Beispiel #16
0
def fusionhash(s):
    return dash_hash.getPoWHash(s)
Beispiel #17
0
def dashhash(s):
    return dash_hash.getPoWHash(s)
Beispiel #18
0
def unodehash(s):
    return dash_hash.getPoWHash(s)
Beispiel #19
0
 def block_header_hash(chain, header):
     import dash_hash
     return dash_hash.getPoWHash(header)
Beispiel #20
0
def unodehash(s):
    return dash_hash.getPoWHash(s)
def bitrityhash(s):
    return dash_hash.getPoWHash(s)
Beispiel #22
0
def generate_hashes_from_block(data_block, algorithm):
    #   if algorithm == 'scrypt':
    #     return scrypt.hash(data_block,data_block,1024,1,1,32)[::-1]
    #   elif algorithm == 'SHA256':
    #     return hashlib.sha256(hashlib.sha256(data_block).digest()).digest()[::-1]
    # elif algorithm == 'X11':
    #   try:
    #     import xcoin_hash
    #     header_hash = xcoin_hash.getPoWHash(data_block)[::-1]
    #   except ImportError:
    #     sys.exit("Cannot run X11 algorithm: module xcoin_hash not found")

    # elif algorithm == 'X11':
    #   try:
    #     import x11_hash
    #     header_hash = x11_hash.getPoWHash(data_block)[::-1]
    #   except ImportError:
    #     sys.exit("Cannot run X11 algorithm: module x11_hash not found")

    if algorithm == 'X11':
        try:
            import dash_hash
            return dash_hash.getPoWHash(data_block)[::-1]
        except ImportError:
            sys.exit("Cannot run X11 algorithm: module dash_hash not found")

    # elif algorithm == 'X11':
    #   try:
    #     header_hash = coinhash.X11Hash(data_block)[::-1]
    #   except ImportError:
    #     sys.exit("Cannot run X11 algorithm: module dash_hash not found")

    elif algorithm == 'X13':
        try:
            import x13_hash
            return x13_hash.getPoWHash(data_block)[::-1]
        except ImportError:
            sys.exit("Cannot run X13 algorithm: module x13_hash not found")
    elif algorithm == 'X15':
        try:
            import x15_hash
            return x15_hash.getPoWHash(data_block)[::-1]
        except ImportError:
            sys.exit("Cannot run X15 algorithm: module x15_hash not found")
    elif algorithm == 'quark':
        try:
            import quark_hash
            return quark_hash.getPoWHash(data_block)[::-1]
        except ImportError:
            sys.exit("Cannot run quark algorithm: module quark_hash not found")

    elif algorithm == 'lyra2re':
        try:
            return mixhash.Lyra2re(data_block)[::-1]
        except ImportError:
            sys.exit(
                "Cannot run quark algorithm: module mixhash.Lyra2re not found")
    elif algorithm == 'lyra2re2':
        try:
            return mixhash.Lyra2re2(data_block)[::-1]
        except ImportError:
            sys.exit(
                "Cannot run quark algorithm: module mixhash.Lyra2re not found")

    elif algorithm == 'keccak':
        try:
            return mixhash.Keccak(data_block)[::-1]
        except ImportError:
            sys.exit(
                "Cannot run quark algorithm: module mixhash.Keccak not found")

    elif algorithm == 'neoscrypt':
        try:
            return mixhash.Neoscrypt(data_block)[::-1]
        except ImportError:
            sys.exit(
                "Cannot run quark algorithm: module mixhash.Neoscrypt not found"
            )

    elif algorithm == 'qubit':
        try:
            return mixhash.Qubit(data_block)[::-1]
        except ImportError:
            sys.exit(
                "Cannot run quark algorithm: module mixhash.Qubit not found")
Beispiel #23
0
def securetaghash(s):
    return dash_hash.getPoWHash(s)
Beispiel #24
0
def dashhash(s):
    return dash_hash.getPoWHash(s)
Beispiel #25
0
def chickendinnerhash(s):
    return dash_hash.getPoWHash(s)
Beispiel #26
0
def gobytehash(s):
    return dash_hash.getPoWHash(s)
Beispiel #27
0
 def test_dash_hash(self):
     self.pow_hash = hexlify(dash_hash.getPoWHash(self.block_header))
     self.assertEqual(self.pow_hash, self.best_hash)
def acedhash(s):
    return dash_hash.getPoWHash(s)
Beispiel #29
0
    s = "0"*(2*length - len(s)) + s
    return rev_hex(s)


def var_int(i):
    if i < 0xfd:
        return int_to_hex(i)
    elif i <= 0xffff:
        return "fd" + int_to_hex(i, 2)
    elif i <= 0xffffffff:
        return "fe" + int_to_hex(i, 4)
    else:
        return "ff" + int_to_hex(i, 8)

# Dash's X11 Function
HashX11 = lambda x: dashhash.getPoWHash(x)

Hash = lambda x: hashlib.sha256(hashlib.sha256(x).digest()).digest()

hash_encode = lambda x: x[::-1].encode('hex')

hash_decode = lambda x: x.decode('hex')[::-1]


def header_to_string(res):
    pbh = res.get('prev_block_hash')
    if pbh is None:
        pbh = '0'*64

    return int_to_hex(res.get('version'), 4) \
        + rev_hex(pbh) \