forked from I2P_Developers/i2p.i2p
2005-07-04 jrandom
* Within the tunnel, use xor(IV, msg[0:16]) as the flag to detect dups,
rather than the IV by itself, preventing an attack that would let
colluding internal adversaries tag a message to determine that they are
in the same tunnel. Thanks dvorak for the catch!
* Drop long inactive profiles on startup and shutdown
* /configstats.jsp: web interface to pick what stats to log
* Deliver more session tags to account for wider window sizes
* Cache some intermediate values in our HMACSHA256 and BC's HMAC
* Track the client send rate (stream.sendBps and client.sendBpsRaw)
* UrlLauncher: adjust the browser selection order
* I2PAppContext: hooks for dummy HMACSHA256 and a weak PRNG
* StreamSinkClient: add support for sending an unlimited amount of data
* Migrate the tests out of the default build jars
2005-06-22 Comwiz
* Migrate the core tests to junit
This commit is contained in:
@@ -32,12 +32,19 @@ package net.i2p.crypto;
|
||||
import net.i2p.I2PAppContext;
|
||||
import net.i2p.data.Hash;
|
||||
import net.i2p.data.SessionKey;
|
||||
import java.util.Properties;
|
||||
|
||||
public class HMACSHA256Bench {
|
||||
public static void main(String args[]) {
|
||||
I2PAppContext ctx = I2PAppContext.getGlobalContext();
|
||||
public static void main(String args[]) {
|
||||
runTest(new I2PAppContext());
|
||||
Properties props = new Properties();
|
||||
props.setProperty("i2p.fakeHMAC", "true");
|
||||
runTest(new I2PAppContext(props));
|
||||
|
||||
}
|
||||
private static void runTest(I2PAppContext ctx) {
|
||||
SessionKey key = ctx.keyGenerator().generateSessionKey();
|
||||
Hash asdfs = HMACSHA256Generator.getInstance().calculate(key, "qwerty".getBytes());
|
||||
Hash asdfs = ctx.hmac().calculate(key, "qwerty".getBytes());
|
||||
|
||||
int times = 100000;
|
||||
long shorttime = 0;
|
||||
|
||||
Reference in New Issue
Block a user