protected function truncate($hash)
	{
		$truncated_hash = 0;
		$offset = ord(substr($hash, -1)) & 0xF;

		// Truncate hash using supplied sha1 hash
		for ($i = 0; $i < 4; ++$i)
		{
			$truncated_hash <<= 8;
			$truncated_hash  |= ord($hash[$offset + $i]);
		}

		// Truncate to a smaller number of digits.
		$truncated_hash &= 0x7FFFFFFF;
		$truncated_hash %= self::VERIFICATION_CODE_MODULUS;

		return $truncated_hash;
	}