Ejemplo n.º 1
0
    def hash_message(self, message):
        """Returns the hash of the message."""

        message_hash = crackcoin.hasher(message).hexdigest()
        e = int(message_hash, 16)

        return e
Ejemplo n.º 2
0
def createTransactionConfirmation(transactionHash, timestamp):
    ''' create confirmation for transaction with difficulty 1 '''

    difficulty = 1
    transactionValue = transactionHash + timestamp

    while True:

        addition = urandom(VALIDATION_ADDITION_LENGTH).encode('hex')
        solution = crackcoin.hasher(transactionValue + addition).hexdigest()

        if solution.count('0') == difficulty:

            crackcoin.network.broadcastConfirmation(transactionHash,
                                                    difficulty, addition)
            crackcoin.db.doQuery(
                'INSERT INTO confirmations (transactionHash, difficulty, addition, solution) VALUES (?, ?, ?, ?)',
                (transactionHash, difficulty, addition, solution),
                result='none')

            break
Ejemplo n.º 3
0
def publicKeyToAddress(compressedPublicKey):
    ''' Generate address from public key '''

    h = crackcoin.hasher(compressedPublicKey).digest()
    return wallet_prefix + "c" + crackcoin.encoder.b58encode(h)