Bitcoin Forum
December 14, 2024, 09:36:09 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: PyBTC Bitcoin Address's Generator (offline) and More  (Read 951 times)
MGF15 (OP)
Newbie
*
Offline Offline

Activity: 5
Merit: 6


View Profile
December 10, 2015, 04:46:50 PM
Merited by ABCbits (6)
 #1

Hello all this my first Post Here  Cheesy Cheesy

PyBTC it's Simple (script & library)

Bitcoin Address's Generator (offline) , Base58Check (WIF) Encode/Decode , WIF to Bitcoin Address

Ex for using as library
Code:
    >>> from PyBTC import Addr
    >>> Addr('0000000000000000000000000000000000000000000000000000000000000002')
    '1LagHJk2FyCV2VzrNHVqg3gYG4TSYwDV4m'

WIF
Code:
    >>> from PyBTC import WIF
    >>> WIF('0000000000000000000000000000000000000000000000000000000000000002')
    '5HpHagT65TZzG1PH3CSu63k8DbpvD8s5ip4nEB3kEsreAvUcVfH'

Ex as script

Code:

PyBTC.py -a
Address :  1LTUNrDmDZTDJxy3PviZxjwDJpvUr2YRu7
Privkey :  3427e5ca8a4b34f2c057b6ebd4372b6a86b6c8ad16831cce7cf5b53bcefc637e
WIF     :  5JDFqFTFDEfvzuxrQrSrvnrTHJKqeTdcNTxWMCQ2VotLZTfPw7v

source  Grin https://github.com/MGF15/PyBTC/
cr1776
Legendary
*
Offline Offline

Activity: 4256
Merit: 1313


View Profile
December 10, 2015, 05:13:15 PM
 #2

One concern I'd have is with the PRNG that is in use.  

:-)
e.g.
Code:
def rankey():
rand = random.randint(0x00000,0xfffff)
key = sha256(str(rand).encode('hex')).hexdigest()
return key

Hello all this my first Post Here  Cheesy Cheesy

PyBTC it's Simple (script & library)
...

MGF15 (OP)
Newbie
*
Offline Offline

Activity: 5
Merit: 6


View Profile
December 10, 2015, 05:35:18 PM
 #3

 Cheesy Cheesy

i'm a n00b its jsut random kay and encode it in hex and sha256 to get 32-bit key and use it as a private key Smiley
Newar
Legendary
*
Offline Offline

Activity: 1358
Merit: 1001


https://gliph.me/hUF


View Profile
December 10, 2015, 05:36:23 PM
 #4


May be helpful: https://bitcointalk.org/index.php?topic=361092.0

OTC rating | GPG keyid 1DC91318EE785FDE | Gliph: lightning bicycle tree music | Mycelium, a swift & secure Bitcoin client for Android | LocalBitcoins
MGF15 (OP)
Newbie
*
Offline Offline

Activity: 5
Merit: 6


View Profile
December 10, 2015, 05:43:12 PM
 #5

also you can use your private key  Wink so don't worry
cr1776
Legendary
*
Offline Offline

Activity: 4256
Merit: 1313


View Profile
December 10, 2015, 06:13:49 PM
 #6

also you can use your private key  Wink so don't worry

You should not rely on this code if the part I am looking it is accurate.
You are picking a number between 0 and 0xfffff (1,048,575)
Code:
rand = random.randint(0x00000,0xfffff)

That is not large enough and could be searched in seconds - meaning your coins will be stolen.

You should fix the code.
MGF15 (OP)
Newbie
*
Offline Offline

Activity: 5
Merit: 6


View Profile
December 10, 2015, 06:20:37 PM
 #7

oh  Shocked thanx i'll fix it
cr1776
Legendary
*
Offline Offline

Activity: 4256
Merit: 1313


View Profile
December 10, 2015, 06:56:43 PM
 #8

oh  Shocked thanx i'll fix it

If you look at the link Newar sent, I think it has a reasonable PRNG in there - I didn't look to see though.

This is a good way to learn about bitcoin, for sure.  ;-)
MGF15 (OP)
Newbie
*
Offline Offline

Activity: 5
Merit: 6


View Profile
December 10, 2015, 07:09:13 PM
 #9

 Grin Done update it

Code:
def rankey():
r = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ~!@#$%^&*()"0123456789'
rand = random.sample(r,64)
k = ''.join(rand)
key = sha256(k).hexdigest()
return key
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!