Search in sources :

Example 1 with MacLayeredInputStream

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

the class CipherReadBenchmark method timeAESWithHmacRead.

public void timeAESWithHmacRead(int reps) throws Exception {
    for (int i = 0; i < reps; ++i) {
        ByteArrayInputStream cipheredInput = new ByteArrayInputStream(mAESCipherText);
        Mac mac = mHMAC.getMac();
        InputStream macStream = new MacLayeredInputStream(mac, cipheredInput);
        InputStream input = mAESCipher.getInputStream(macStream);
        readFully(input, new NullOutputStream());
        mac.doFinal();
        input.close();
    }
}
Also used : MacLayeredInputStream(com.facebook.crypto.benchmarks.mac.streams.MacLayeredInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) MacLayeredInputStream(com.facebook.crypto.benchmarks.mac.streams.MacLayeredInputStream) InputStream(java.io.InputStream) Mac(javax.crypto.Mac) NullOutputStream(com.google.common.io.NullOutputStream)

Aggregations

MacLayeredInputStream (com.facebook.crypto.benchmarks.mac.streams.MacLayeredInputStream)1 NullOutputStream (com.google.common.io.NullOutputStream)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 Mac (javax.crypto.Mac)1