First release, remove not used lines from gitignore
This commit is contained in:
parent
c0bfb3b062
commit
d28e1cb4a6
85 changed files with 7205 additions and 50 deletions
26
src/Crypt/CryptBitcoin.py
Normal file
26
src/Crypt/CryptBitcoin.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
from src.lib.BitcoinECC import BitcoinECC
|
||||
import hashlib
|
||||
|
||||
|
||||
def newPrivatekey(): # Return new private key
|
||||
bitcoin = BitcoinECC.Bitcoin()
|
||||
bitcoin.GeneratePrivateKey()
|
||||
return bitcoin.PrivateEncoding()
|
||||
|
||||
|
||||
def privatekeyToAddress(privatekey): # Return address from private key
|
||||
bitcoin = BitcoinECC.Bitcoin()
|
||||
bitcoin.BitcoinAddressFromPrivate(privatekey)
|
||||
return bitcoin.BitcoinAddresFromPublicKey()
|
||||
|
||||
|
||||
def sign(data, privatekey): # Return sign to data using private key
|
||||
bitcoin = BitcoinECC.Bitcoin()
|
||||
bitcoin.BitcoinAddressFromPrivate(privatekey)
|
||||
sign = bitcoin.SignECDSA(data)
|
||||
return sign
|
||||
|
||||
|
||||
def verify(data, address, sign): # Verify data using address and sign
|
||||
bitcoin = BitcoinECC.Bitcoin()
|
||||
return bitcoin.VerifyMessageFromBitcoinAddress(address, data, sign)
|
18
src/Crypt/CryptHash.py
Normal file
18
src/Crypt/CryptHash.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
import hashlib
|
||||
|
||||
def sha1sum(file, blocksize=65536):
|
||||
if hasattr(file, "endswith"): # Its a string open it
|
||||
file = open(file, "rb")
|
||||
hash = hashlib.sha1()
|
||||
for block in iter(lambda: file.read(blocksize), ""):
|
||||
hash.update(block)
|
||||
return hash.hexdigest()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import cStringIO as StringIO
|
||||
a = StringIO.StringIO()
|
||||
a.write("hello!")
|
||||
a.seek(0)
|
||||
print hashlib.sha1("hello!").hexdigest()
|
||||
print sha1sum(a)
|
0
src/Crypt/__init__.py
Normal file
0
src/Crypt/__init__.py
Normal file
Loading…
Add table
Add a link
Reference in a new issue