예제 #1
0
    def sign(self, key):
        """Sign this transaction with a private key.

        A potentially already existing signature would be overridden.
        """
        rawhash = utils.sha3(rlp.encode(self, UnsignedTransaction))
        self.v, self.r, self.s = ecdsa_raw_sign(rawhash, key)
        self.sender = utils.privtoaddr(key)
        return self
예제 #2
0
    def sign(self, key):
        """Sign this transaction with a private key.

        A potentially already existing signature would be overridden.
        """
        rawhash = utils.sha3(rlp.encode(self, UnsignedTransaction))
        self.v, self.r, self.s = ecdsa_raw_sign(rawhash, key)
        self.sender = utils.privtoaddr(key)
        return self
예제 #3
0
    def sign(self, key):
        """Sign this transaction with a private key.

        A potentially already existing signature would be overridden.
        """
        if key in (0, '', '\x00' * 32):
            raise InvalidTransaction("Zero privkey cannot sign")
        rawhash = utils.sha3(rlp.encode(self, UnsignedTransaction))
        self.v, self.r, self.s = ecdsa_raw_sign(rawhash, key)
        self.sender = utils.privtoaddr(key)
        return self
예제 #4
0
    def sign(self, privkey):
        """Sign this with a private key"""
        if self.v:
            raise InvalidSignature("already signed")

        if privkey in (0, '', '\x00' * 32):
            raise InvalidSignature("Zero privkey cannot sign")
        rawhash = sha3(rlp.encode(self, self.__class__.exclude(['v', 'r', 's'])))
        self.v, self.r, self.s = ecdsa_raw_sign(rawhash, privkey)
        self._sender = None
        return self
예제 #5
0
def make_ticket(privkey, value):
    value_enc = utils.zpad(utils.encode_int(value), 32)
    h = utils.sha3(value_enc)
    v, r, s = ecdsa_raw_sign(h, privkey)
    return (value, v, r, s)
예제 #6
0
파일: crypto.py 프로젝트: zilm13/pydevp2p
def ecdsa_sign(message, privkey):
    s = _encode_sig(*ecdsa_raw_sign(message, privkey))
    return s
예제 #7
0
def ecdsa_sign(message, privkey):
    s = _encode_sig(*ecdsa_raw_sign(message, privkey))
    return s
예제 #8
0
def make_ticket(privkey, value):
    value_enc = utils.zpad(utils.encode_int(value), 32)
    h = utils.sha3(value_enc)
    v, r, s = ecdsa_raw_sign(h, privkey)
    return (value, v, r, s)