<commit_before><?php

class OCRA {
	private $suite;
	private $key;
	private $session;
	private $pin;
	private $time = null;

	public function __construct($ocraSuite, $key) {
		$this->suite = $this->_parseSuite($ocraSuite);
		$this->key = $key;
	}

	public function generate($input, $counter = 0) {
		$msg = $this->suite['name']."\0"; // hashed value

		if (isset($this->suite['input']['counter'])) {
			// transform counter in a 64bits big endian int, append to $msg (only works on 64bits servers)
			$msg .= pack('NN', ($counter >> 32) & 0xffffffff, $counter & 0xffffffff);
		}

		// append $input (Q)
		switch($this->suite['input']['format']) {
			case 'n':
				$msg .= str_pad(pack('H*', dechex($input)), 128, "\0", STR_PAD_RIGHT);
				break;
			case 'a':
				if (strlen($input) > 128) $input = substr($input, 0, 128);
				$msg .= str_pad($input, 128, "\0", STR_PAD_RIGHT);
				break;
			case 'h':
				if (strlen($input) > 256) $input = substr($input, 0, 256);
				$msg .= str_pad(pack('H*', $input), 128, "\0", STR_PAD_RIGHT);
		}<commit_msg>cosmetic change<commit_after><?php

class OCRA {
	private $suite;
	private $key;
	private $session;
	private $pin;
	private $time = null;

	public function __construct($ocraSuite, $key) {
		$this->suite = $this->_parseSuite($ocraSuite);
		$this->key = $key;
	}

	public function generate($input, $counter = 0) {
		$msg = $this->suite['name']."\0"; // hashed value

		if (isset($this->suite['input']['counter'])) {
			// transform counter in a 64bits big endian int, append to $msg (only works on 64bits servers)
			$msg .= pack('NN', ($counter >> 32) & 0xffffffff, $counter & 0xffffffff);
		}

		// append $input (Q)
		switch($this->suite['input']['format']) {
			case 'n':
				$msg .= str_pad(pack('H*', dechex($input)), 128, "\0", STR_PAD_RIGHT);
				break;
			case 'a':
				if (strlen($input) > 128) $input = substr($input, 0, 128);
				$msg .= str_pad($input, 128, "\0", STR_PAD_RIGHT);
				break;
			case 'h':
				if (strlen($input) > 256) $input = substr($input, 0, 256);
				$msg .= str_pad(pack('H*', $input), 128, "\0", STR_PAD_RIGHT);
				break;
		}
{'fraction_non_alphanumeric': 0.20665083135391923, 'fraction_numerical': 0.0342042755344418, 'mean_word_length': 3.7539503386004514, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, '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': '3964875', 'n_tokens_mistral': 916, 'n_tokens_neox': 750, 'n_words': 200}