<commit_before>// Copyright (c) 2017 <NAME>
//
// This software may be modified and distributed under the terms
// of the MIT license.  See the LICENSE file for details.

#include <upp11.h>

using namespace std;

UP_SUITE_BEGIN(gost89)
UP_SUITE_BEGIN(ProceduralImitTest)

class Key final {
public:
	explicit Key(const void *key)
		: sbox()
	{
		memcpy(key_, key, sizeof(key_));
		memset(mask_, 0, sizeof(mask_));
	}

	virtual void set_sbox(const void *box) {
		const uint8_t *sptr = static_cast<const uint8_t *>(box);
		expand_tab(sptr, 0, &sbox[0]);
		expand_tab(sptr, 1, &sbox[256]);
		expand_tab(sptr, 2, &sbox[512]);
		expand_tab(sptr, 3, &sbox[768]);
	}

private:
	friend class ImitContext;

	void expand_tab(const uint8_t sbox[64], size_t offset, uint8_t tab[256]) {
		for (size_t i = 0; i < 256; i++) {
			tab[i] = (sbox[(i / 16) * 4 + offset] & 0xf0)
				+ (sbox[(i % 16) * 4 + offset] & 0x0f);
		}<commit_msg>#291: more todo<commit_after>// Copyright (c) 2017 <NAME>
//
// This software may be modified and distributed under the terms
// of the MIT license.  See the LICENSE file for details.

#include <upp11.h>

using namespace std;

// @todo #291 ProceduralImitTest move to benchmark utility,
//  for comparsion with us. This is not a test.

UP_SUITE_BEGIN(gost89)
UP_SUITE_BEGIN(ProceduralImitTest)

class Key final {
public:
	explicit Key(const void *key)
		: sbox()
	{
		memcpy(key_, key, sizeof(key_));
		memset(mask_, 0, sizeof(mask_));
	}

	virtual void set_sbox(const void *box) {
		const uint8_t *sptr = static_cast<const uint8_t *>(box);
		expand_tab(sptr, 0, &sbox[0]);
		expand_tab(sptr, 1, &sbox[256]);
		expand_tab(sptr, 2, &sbox[512]);
		expand_tab(sptr, 3, &sbox[768]);
	}

private:
	friend class ImitContext;

	void expand_tab(const uint8_t sbox[64], size_t offset, uint8_t tab[256]) {
		for (size_t i = 0; i < 256; i++) {
			tab[i] = (sbox[(i / 16) * 4 + offset] & 0xf0)
				+ (sbox[(i % 16) * 4 + offset] & 0x0f);
		}
{'fraction_non_alphanumeric': 0.1504879301489471, 'fraction_numerical': 0.050333846944016436, 'mean_word_length': 4.05974025974026, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, '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': '109284', 'n_tokens_mistral': 885, 'n_tokens_neox': 777, 'n_words': 218}