<commit_before><?php

namespace Blocktrail\SDK\V3Crypt;

use BitWasp\Buffertools\Buffer;
use BitWasp\Buffertools\BufferInterface;

class KeyDerivation
{
    const HASHER = 'sha512';
    const DEFAULT_ITERATIONS = 35000;
    const SUBKEY_ITERATIONS = 1;
    const KEYLEN_BITS = 256;

    /**
     * @param BufferInterface $password
     * @param BufferInterface $salt
     * @param int $iterations
     * @return BufferInterface
     */
    public static function compute(BufferInterface $password, BufferInterface $salt, $iterations) {
        if (!($iterations >= 0 && $iterations < pow(2, 32))) {
            throw new \RuntimeException('Iterations must be a number between 1 and 2^32');
        }

        if ($iterations < 0) {
            throw new \RuntimeException('Iteration count should be at least 1');
        }

        if ($salt->getSize() === 0) {
            throw new \RuntimeException('Salt must not be empty');
        }

        if ($salt->getSize() > 0x80) {
            throw new \RuntimeException('Sanity check: Invalid salt, length can never be greater than 128');
        }

        return new Buffer(hash_pbkdf2(self::HASHER, $password->getBinary(), $salt->getBinary(), $iterations, self::KEYLEN_BITS / 8, true));
    }
}<commit_msg>removed duplicate check<commit_after><?php

namespace Blocktrail\SDK\V3Crypt;

use BitWasp\Buffertools\Buffer;
use BitWasp\Buffertools\BufferInterface;

class KeyDerivation
{
    const HASHER = 'sha512';
    const DEFAULT_ITERATIONS = 35000;
    const SUBKEY_ITERATIONS = 1;
    const KEYLEN_BITS = 256;

    /**
     * @param BufferInterface $password
     * @param BufferInterface $salt
     * @param int $iterations
     * @return BufferInterface
     */
    public static function compute(BufferInterface $password, BufferInterface $salt, $iterations) {
        if (!($iterations >= 0 && $iterations < pow(2, 32))) {
            throw new \RuntimeException('Iterations must be a number between 1 and 2^32');
        }

        if ($salt->getSize() === 0) {
            throw new \RuntimeException('Salt must not be empty');
        }

        if ($salt->getSize() > 0x80) {
            throw new \RuntimeException('Sanity check: Invalid salt, length can never be greater than 128');
        }

        return new Buffer(hash_pbkdf2(self::HASHER, $password->getBinary(), $salt->getBinary(), $iterations, self::KEYLEN_BITS / 8, true));
    }
}
{'fraction_non_alphanumeric': 0.11901789429879317, 'fraction_numerical': 0.025801081980857263, 'mean_word_length': 2.8899676375404533, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 15, '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': '750881', 'n_tokens_mistral': 762, 'n_tokens_neox': 690, 'n_words': 198}