<commit_before>#![no_std]
#![feature(test)]
//#[macro_use]
//extern crate crypto_tests;
extern crate threefish;

extern crate test;
extern crate block_cipher_trait;
extern crate generic_array;

use test::Bencher;
use block_cipher_trait::BlockCipher;
use generic_array::GenericArray;

#[bench]
pub fn encrypt_1_256(bh: &mut Bencher) {
    let key = Default::default();
    let tweak = Default::default();
    let state = threefish::Threefish256::new(&key, &tweak);
    let input = &[1u8; 32];
    let mut output = GenericArray::default();

    bh.iter(|| {
        state.encrypt_block(GenericArray::from_slice(input), &mut output);
    });
    bh.bytes = 32u64;
}

#[bench]
pub fn encrypt_2_512(bh: &mut Bencher) {
    let key = [0u8; 64];
    let tweak = Default::default();
    let state = threefish::Threefish512::new(&key, &tweak);
    let input = &[1u8; 64];
    let mut output = GenericArray::default();

    bh.iter(|| {
        state.encrypt_block(GenericArray::from_slice(input), &mut output);
    });
    bh.bytes = 64u64;
}

#[bench]
pub fn encrypt_3_1024(bh: &mut Bencher) {
    let key = [0u8; 128];
    let tweak = Default::default();
    let state = threefish::Threefish1024::new(&key, &tweak);
    let input = &[1u8; 128];
    let mut output = GenericArray::default();

    bh.iter(|| {
        state.encrypt_block(GenericArray::from_slice(input), &mut output);
    });
    bh.bytes = 128u64;
}
<commit_msg>threefish: fix benches for new API<commit_after>#![no_std]
#![feature(test)]
//#[macro_use]
//extern crate crypto_tests;
extern crate threefish;

extern crate test;
extern crate block_cipher_trait;
extern crate generic_array;

use test::Bencher;
use block_cipher_trait::BlockCipher;
use generic_array::GenericArray;

#[bench]
pub fn encrypt_1_256(bh: &mut Bencher) {
    let key = Default::default();
    let tweak = Default::default();
    let state = threefish::Threefish256::with_tweak(&key, &tweak);
    let input = &[1u8; 32];
    bh.iter(|| {
        state.encrypt_block(mut GenericArray::from_slice(input));
    });
    bh.bytes = 32u64;
}

#[bench]
pub fn encrypt_2_512(bh: &mut Bencher) {
    let key = Default::default();
    let tweak = Default::default();
    let state = threefish::Threefish512::with_tweak(&key, &tweak);
    let input = &[1u8; 64];
    bh.iter(|| {
        state.encrypt_block(mut GenericArray::from_slice(input));
    });
    bh.bytes = 64u64;
}

#[bench]
pub fn encrypt_3_1024(bh: &mut Bencher) {
    let key = Default::default();
    let tweak = Default::default();
    let state = threefish::Threefish1024::with_tweak(&key, &tweak);
    let input = &[1u8; 128];
    bh.iter(|| {
        state.encrypt_block(mut GenericArray::from_slice(input));
    });
    bh.bytes = 128u64;
}

{'fraction_non_alphanumeric': 0.1583180987202925, 'fraction_numerical': 0.03912248628884826, 'mean_word_length': 4.020183486238532, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3504074', 'n_tokens_mistral': 1054, 'n_tokens_neox': 963, 'n_words': 220}