com.google.bitcoin.core
Class VersionedChecksummedBytes

java.lang.Object
  extended by com.google.bitcoin.core.VersionedChecksummedBytes
Direct Known Subclasses:
Address, DumpedPrivateKey

public class VersionedChecksummedBytes
extends Object

In Bitcoin the following format is often used to represent some type of key:

[one version byte] [data bytes] [4 checksum bytes]

and the result is then Base58 encoded. This format is used for addresses, and private keys exported using the dumpprivkey command.


Field Summary
protected  byte[] bytes
           
protected  int version
           
 
Constructor Summary
protected VersionedChecksummedBytes(int version, byte[] bytes)
           
protected VersionedChecksummedBytes(String encoded)
           
 
Method Summary
 boolean equals(Object o)
           
 int getVersion()
          Returns the "version" or "header" byte: the first byte of the data.
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

version

protected int version

bytes

protected byte[] bytes
Constructor Detail

VersionedChecksummedBytes

protected VersionedChecksummedBytes(String encoded)
                             throws AddressFormatException
Throws:
AddressFormatException

VersionedChecksummedBytes

protected VersionedChecksummedBytes(int version,
                                    byte[] bytes)
Method Detail

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

getVersion

public int getVersion()
Returns the "version" or "header" byte: the first byte of the data. This is used to disambiguate what the contents apply to, for example, which network the key or address is valid on.

Returns:
A positive number between 0 and 255.


Copyright © 2011. All Rights Reserved.