Author

Topic: compressed pubkey version (Read 647 times)

legendary
Activity: 1260
Merit: 1019
January 05, 2015, 07:04:46 PM
#4
sry amaclin, i post some info...

Public key is a pair [x,y]
if 'y' is even - use 0x02
if 'y' is odd - use 0x03


Code:
buf [0] = 0x02 + ( buf [64] & 1 );
sr. member
Activity: 375
Merit: 255
January 05, 2015, 06:57:18 PM
#3
sry amaclin, i post some info...
legendary
Activity: 1260
Merit: 1019
January 05, 2015, 06:54:54 PM
#2
How to know when to use version 02 or 03 in a compressed pubkey?

Code:
const QByteArray MyKey32::getPublicKeyClassic ( ) const
{
  quint8 buf [65];
  getPublicKey ( buf );
//buf [0] = 0x04;
  return QByteArray ( (const char*)buf, 65 );
}
//--------------------------------------------------------------
const QByteArray MyKey32::getPublicKeyCompressed ( ) const
{
  quint8 buf [65];
  getPublicKey ( buf );
  buf [0] = 0x02 + ( buf [64] & 1 );
  return QByteArray ( (const char*)buf, 33 );
}
sr. member
Activity: 375
Merit: 255
January 05, 2015, 06:49:26 PM
#1
How to know when to use version 02 or 03 in a compressed pubkey?

let me explain:
in the bitcoin qt, i type the command dumpprivkey in my address 1Cue...
he gave me the key Kw...
but making some tests, with version 02, i got the address 1Nra...
and with the version 03, the 1Cue...
Jump to: