public class RouterKeyGenerator extends RoutingKeyGenerator
| Constructor and Description |
|---|
RouterKeyGenerator(I2PAppContext context)Constructor that initializes GMT date formatter and generates current routing key modifier data. |
| 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()Time the routing key modifier data was last regenerated. |
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) |
getInstancepublic RouterKeyGenerator(I2PAppContext context)
public boolean generateDateBasedModData()
public long getLastChanged()
getLastChanged in class RoutingKeyGeneratorpublic byte[] getModData()
public byte[] getNextModData()
public Hash getNextRoutingKey(Hash origKey)
public Hash getRoutingKey(Hash origKey)
getRoutingKey in class RoutingKeyGeneratorIllegalArgumentException - if origKey is nullpublic Hash getRoutingKey(Hash origKey, long time)
time - Java timepublic long getTimeTillMidnight()
public static void main(String[] args)