Bitcoin Forum
May 06, 2024, 09:50:24 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Regular expression for private key base 58?  (Read 3841 times)
cilphex (OP)
Member
**
Offline Offline

Activity: 62
Merit: 45



View Profile WWW
May 24, 2013, 03:20:16 AM
 #1

I'm writing a bitcoin app and would like to validate addresses somehow.  I found this regex for public addresses:

/^[13n][1-9A-Za-z][^OIl]{20,40}/

But I'm looking for one for base 58 private keys as well.  (Base 58 is the import format right?)

I don't know a lot about the rules for these keys/addresses.  If I did I'd just write the regexes myself.  Any help is much appreciated.
1715032224
Hero Member
*
Offline Offline

Posts: 1715032224

View Profile Personal Message (Offline)

Ignore
1715032224
Reply with quote  #2

1715032224
Report to moderator
1715032224
Hero Member
*
Offline Offline

Posts: 1715032224

View Profile Personal Message (Offline)

Ignore
1715032224
Reply with quote  #2

1715032224
Report to moderator
"In a nutshell, the network works like a distributed timestamp server, stamping the first transaction to spend a coin. It takes advantage of the nature of information being easy to spread but hard to stifle." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715032224
Hero Member
*
Offline Offline

Posts: 1715032224

View Profile Personal Message (Offline)

Ignore
1715032224
Reply with quote  #2

1715032224
Report to moderator
jackjack
Legendary
*
Offline Offline

Activity: 1176
Merit: 1233


May Bitcoin be touched by his Noodly Appendage


View Profile
May 24, 2013, 03:00:37 PM
 #2

Is that regex working? I'd put some parentheses

/^5[1-9A-Za-z][^OIl]{20,50}/
or
/^5([1-9A-Za-z][^OIl]){20,50}/

Try with some private keys from https://www.bitaddress.org/

Own address: 19QkqAza7BHFTuoz9N8UQkryP4E9jHo4N3 - Pywallet support: 1AQDfx22pKGgXnUZFL1e4UKos3QqvRzNh5 - Bitcointalk++ script support: 1Pxeccscj1ygseTdSV1qUqQCanp2B2NMM2
Pywallet: instructions. Encrypted wallet support, export/import keys/addresses, backup wallets, export/import CSV data from/into wallet, merge wallets, delete/import addresses and transactions, recover altcoins sent to bitcoin addresses, sign/verify messages and files with Bitcoin addresses, recover deleted wallets, etc.
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!