Search in sources :

Example 1 with MacLayeredOutputStream

use of com.facebook.crypto.benchmarks.mac.streams.MacLayeredOutputStream in project conceal by facebook.

the class CipherWriteBenchmark method timeAESWithHMAC.

public void timeAESWithHMAC(int reps) throws Exception {
    for (int i = 0; i < reps; ++i) {
        Mac mac = mHMAC.getMac();
        MacLayeredOutputStream macOs = new MacLayeredOutputStream(mac, mNullOutputStream);
        OutputStream aes = mAESCipher.getOutputStream(macOs);
        aes.write(mData);
        aes.close();
        mac.doFinal();
    }
}
Also used : MacLayeredOutputStream(com.facebook.crypto.benchmarks.mac.streams.MacLayeredOutputStream) OutputStream(java.io.OutputStream) MacLayeredOutputStream(com.facebook.crypto.benchmarks.mac.streams.MacLayeredOutputStream) NullOutputStream(com.google.common.io.NullOutputStream) Mac(javax.crypto.Mac)

Example 2 with MacLayeredOutputStream

use of com.facebook.crypto.benchmarks.mac.streams.MacLayeredOutputStream in project conceal by facebook.

the class MacBenchmark method timeJavaHmac.

public void timeJavaHmac(int reps) throws Exception {
    for (int i = 0; i < reps; ++i) {
        Mac mac = mHMAC.getMac();
        OutputStream macOutput = new MacLayeredOutputStream(mac, new NullOutputStream());
        macOutput.write(mData);
        macOutput.close();
        mac.doFinal();
    }
}
Also used : MacLayeredOutputStream(com.facebook.crypto.benchmarks.mac.streams.MacLayeredOutputStream) OutputStream(java.io.OutputStream) MacLayeredOutputStream(com.facebook.crypto.benchmarks.mac.streams.MacLayeredOutputStream) NullOutputStream(com.google.common.io.NullOutputStream) Mac(javax.crypto.Mac) NullOutputStream(com.google.common.io.NullOutputStream)

Aggregations

MacLayeredOutputStream (com.facebook.crypto.benchmarks.mac.streams.MacLayeredOutputStream)2 NullOutputStream (com.google.common.io.NullOutputStream)2 OutputStream (java.io.OutputStream)2 Mac (javax.crypto.Mac)2