Format the docstring in pyelliptic.ecc.ECC
This commit is contained in:
parent
3216382158
commit
a044c23efb
|
@ -24,22 +24,24 @@ class ECC(object):
|
||||||
>>> bob = pyelliptic.ECC(curve='sect571r1')
|
>>> bob = pyelliptic.ECC(curve='sect571r1')
|
||||||
|
|
||||||
>>> ciphertext = alice.encrypt("Hello Bob", bob.get_pubkey())
|
>>> ciphertext = alice.encrypt("Hello Bob", bob.get_pubkey())
|
||||||
>>> print bob.decrypt(ciphertext)
|
>>> print(bob.decrypt(ciphertext))
|
||||||
|
|
||||||
>>> signature = bob.sign("Hello Alice")
|
>>> signature = bob.sign("Hello Alice")
|
||||||
>>> # alice's job :
|
# alice's job :
|
||||||
>>> print pyelliptic.ECC(
|
>>> print(pyelliptic.ECC(
|
||||||
>>> pubkey=bob.get_pubkey()).verify(signature, "Hello Alice")
|
>>> pubkey=bob.get_pubkey()).verify(signature, "Hello Alice"))
|
||||||
|
|
||||||
>>> # ERROR !!!
|
# ERROR !!!
|
||||||
>>> try:
|
>>> try:
|
||||||
>>> key = alice.get_ecdh_key(bob.get_pubkey())
|
>>> key = alice.get_ecdh_key(bob.get_pubkey())
|
||||||
>>> except:
|
>>> except:
|
||||||
>>> print("For ECDH key agreement, the keys must be defined on the same curve !")
|
>>> print(
|
||||||
|
>>> "For ECDH key agreement, the keys must be defined"
|
||||||
|
>>> " on the same curve!")
|
||||||
|
|
||||||
>>> alice = pyelliptic.ECC(curve='sect571r1')
|
>>> alice = pyelliptic.ECC(curve='sect571r1')
|
||||||
>>> print alice.get_ecdh_key(bob.get_pubkey()).encode('hex')
|
>>> print(alice.get_ecdh_key(bob.get_pubkey()).encode('hex'))
|
||||||
>>> print bob.get_ecdh_key(alice.get_pubkey()).encode('hex')
|
>>> print(bob.get_ecdh_key(alice.get_pubkey()).encode('hex'))
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -53,7 +55,7 @@ class ECC(object):
|
||||||
curve='sect283r1',
|
curve='sect283r1',
|
||||||
): # pylint: disable=too-many-arguments
|
): # pylint: disable=too-many-arguments
|
||||||
"""
|
"""
|
||||||
For a normal and High level use, specifie pubkey,
|
For a normal and High level use, specify pubkey,
|
||||||
privkey (if you need) and the curve
|
privkey (if you need) and the curve
|
||||||
"""
|
"""
|
||||||
if isinstance(curve, str):
|
if isinstance(curve, str):
|
||||||
|
|
Reference in New Issue
Block a user