Bitcoin Forum
December 14, 2017, 07:12:49 PM *
News: Latest stable version of Bitcoin Core: 0.15.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Regular expression for private key base 58?  (Read 3691 times)
cilphex
Jr. Member
*
Offline Offline

Activity: 59



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.

1513278769
Hero Member
*
Offline Offline

Posts: 1513278769

View Profile Personal Message (Offline)

Ignore
1513278769
Reply with quote  #2

1513278769
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1513278769
Hero Member
*
Offline Offline

Posts: 1513278769

View Profile Personal Message (Offline)

Ignore
1513278769
Reply with quote  #2

1513278769
Report to moderator
1513278769
Hero Member
*
Offline Offline

Posts: 1513278769

View Profile Personal Message (Offline)

Ignore
1513278769
Reply with quote  #2

1513278769
Report to moderator
1513278769
Hero Member
*
Offline Offline

Posts: 1513278769

View Profile Personal Message (Offline)

Ignore
1513278769
Reply with quote  #2

1513278769
Report to moderator
jackjack
Legendary
*
Offline Offline

Activity: 1134


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:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!