public class RouterKeyGenerator extends RoutingKeyGenerator
Constructor and Description |
---|
RouterKeyGenerator(I2PAppContext context) |
Modifier and Type | Method and Description |
---|---|
boolean |
generateDateBasedModData()
Update the current modifier data with some bytes derived from the current
date (yyyyMMdd in GMT)
|
long |
getLastChanged()
The version of the current (today's) mod data.
|
byte[] |
getModData()
The current (today's) mod data.
|
byte[] |
getNextModData()
Tomorrow's mod data.
|
Hash |
getNextRoutingKey(Hash origKey)
Get the routing key using tomorrow's modData, not today's
|
Hash |
getRoutingKey(Hash origKey)
Generate a modified (yet consistent) hash from the origKey by generating the
SHA256 of the targetKey with the current modData appended to it
This makes Sybil's job a lot harder, as she needs to essentially take over the
whole keyspace.
|
Hash |
getRoutingKey(Hash origKey,
long time)
Get the routing key for the specified date, not today's
|
long |
getTimeTillMidnight()
How long until midnight (ms)
|
static void |
main(String[] args) |
getInstance
public RouterKeyGenerator(I2PAppContext context)
public byte[] getModData()
public byte[] getNextModData()
public long getLastChanged()
RoutingKeyGenerator
getLastChanged
in class RoutingKeyGenerator
public long getTimeTillMidnight()
public boolean generateDateBasedModData()
public Hash getRoutingKey(Hash origKey)
getRoutingKey
in class RoutingKeyGenerator
IllegalArgumentException
- if origKey is nullpublic Hash getNextRoutingKey(Hash origKey)
public Hash getRoutingKey(Hash origKey, long time)
time
- Java timepublic static void main(String[] args)