java.lang.Comparable<HashCash>
public class HashCash extends java.lang.Object implements java.lang.Comparable<HashCash>
修飾子とタイプ | フィールド | 説明 |
---|---|---|
static int |
DefaultVersion |
コンストラクタ | 説明 |
---|---|
HashCash(java.lang.String cash) |
Parses and validates a HashCash.
|
修飾子とタイプ | メソッド | 説明 |
---|---|---|
int |
compareTo(HashCash other) |
Compares the value of two HashCashes
|
boolean |
equals(java.lang.Object obj) |
Two objects are considered equal if they are both of type HashCash and have an identical string representation
|
static long |
estimateTime(int value) |
Estimates how many milliseconds it would take to mint a cash of the specified value.
|
static int |
estimateValue(int secs) |
Estimates what value (e.g.
|
java.util.Calendar |
getDate() |
The minting date
|
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getExtensions() |
Extra data encoded in the HashCash
|
java.lang.String |
getResource() |
The primary resource being protected
|
int |
getValue() |
The value of the HashCash (e.g.
|
int |
getVersion() |
Which version of HashCash is used here
|
int |
hashCode() |
Implemented based on definition of equals()
|
static HashCash |
mintCash(java.lang.String resource,
int value) |
Mints a version 1 HashCash using now as the date
|
static HashCash |
mintCash(java.lang.String resource,
int value,
int version) |
Mints a HashCash using now as the date
|
static HashCash |
mintCash(java.lang.String resource,
java.util.Calendar date,
int value) |
Mints a version 1 HashCash
|
static HashCash |
mintCash(java.lang.String resource,
java.util.Calendar date,
int value,
int version) |
Mints a HashCash
|
static HashCash |
mintCash(java.lang.String resource,
java.util.Map<java.lang.String,java.util.List<java.lang.String>> extensions,
int value) |
Mints a version 1 HashCash using now as the date
|
static HashCash |
mintCash(java.lang.String resource,
java.util.Map<java.lang.String,java.util.List<java.lang.String>> extensions,
int value,
int version) |
Mints a HashCash using now as the date
|
static HashCash |
mintCash(java.lang.String resource,
java.util.Map<java.lang.String,java.util.List<java.lang.String>> extensions,
java.util.Calendar date,
int value) |
Mints a version 1 HashCash
|
static HashCash |
mintCash(java.lang.String resource,
java.util.Map<java.lang.String,java.util.List<java.lang.String>> extensions,
java.util.Calendar date,
int value,
int version) |
Mints a HashCash
|
java.lang.String |
toString() |
Returns the canonical string representation of the HashCash
|
public static final int DefaultVersion
public HashCash(java.lang.String cash) throws java.security.NoSuchAlgorithmException
java.security.NoSuchAlgorithmException
- If SHA1 is not a supported Message Digestpublic static HashCash mintCash(java.lang.String resource, int value) throws java.security.NoSuchAlgorithmException
resource
- the string to be encoded in the HashCashjava.security.NoSuchAlgorithmException
- If SHA1 is not a supported Message Digestpublic static HashCash mintCash(java.lang.String resource, int value, int version) throws java.security.NoSuchAlgorithmException
resource
- the string to be encoded in the HashCashversion
- Which version to mint. Only valid values are 0 and 1java.security.NoSuchAlgorithmException
- If SHA1 is not a supported Message Digestpublic static HashCash mintCash(java.lang.String resource, java.util.Calendar date, int value) throws java.security.NoSuchAlgorithmException
resource
- the string to be encoded in the HashCashjava.security.NoSuchAlgorithmException
- If SHA1 is not a supported Message Digestpublic static HashCash mintCash(java.lang.String resource, java.util.Calendar date, int value, int version) throws java.security.NoSuchAlgorithmException
resource
- the string to be encoded in the HashCashversion
- Which version to mint. Only valid values are 0 and 1java.security.NoSuchAlgorithmException
- If SHA1 is not a supported Message Digestpublic static HashCash mintCash(java.lang.String resource, java.util.Map<java.lang.String,java.util.List<java.lang.String>> extensions, int value) throws java.security.NoSuchAlgorithmException
resource
- the string to be encoded in the HashCashextensions
- Extra data to be encoded in the HashCashjava.security.NoSuchAlgorithmException
- If SHA1 is not a supported Message Digestpublic static HashCash mintCash(java.lang.String resource, java.util.Map<java.lang.String,java.util.List<java.lang.String>> extensions, int value, int version) throws java.security.NoSuchAlgorithmException
resource
- the string to be encoded in the HashCashextensions
- Extra data to be encoded in the HashCashversion
- Which version to mint. Only valid values are 0 and 1java.security.NoSuchAlgorithmException
- If SHA1 is not a supported Message Digestpublic static HashCash mintCash(java.lang.String resource, java.util.Map<java.lang.String,java.util.List<java.lang.String>> extensions, java.util.Calendar date, int value) throws java.security.NoSuchAlgorithmException
resource
- the string to be encoded in the HashCashextensions
- Extra data to be encoded in the HashCashjava.security.NoSuchAlgorithmException
- If SHA1 is not a supported Message Digestpublic static HashCash mintCash(java.lang.String resource, java.util.Map<java.lang.String,java.util.List<java.lang.String>> extensions, java.util.Calendar date, int value, int version) throws java.security.NoSuchAlgorithmException
resource
- the string to be encoded in the HashCashextensions
- Extra data to be encoded in the HashCashversion
- Which version to mint. Only valid values are 0 and 1java.security.NoSuchAlgorithmException
- If SHA1 is not a supported Message Digestpublic boolean equals(java.lang.Object obj)
equals
クラス内 java.lang.Object
public int hashCode()
hashCode
クラス内 java.lang.Object
public java.lang.String toString()
toString
クラス内 java.lang.Object
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getExtensions()
public java.lang.String getResource()
public java.util.Calendar getDate()
public int getValue()
public int getVersion()
public static long estimateTime(int value) throws java.security.NoSuchAlgorithmException
java.security.NoSuchAlgorithmException
- If SHA1 is not a supported Message Digestpublic static int estimateValue(int secs) throws java.security.NoSuchAlgorithmException
java.security.NoSuchAlgorithmException
- If SHA1 is not a supported Message Digest