/*
This function only unlocks if the user supplies a three-digit prime number.
555124
function isPrime(scriptSig) {
    var minValue = 100;
    var maxValue = 999;
    var primes = getPrimes(maxValue);

    var scriptPubKey = '';
    for (var i = 0; i < primes.length; i++) {
        var commands = [
            'OP_DUP',
            'OP_SHA256',
            sha256(primes[i]),
            'OP_EQUAL',
        ];
        // If this is not the comparsion, OR with flag
        if (scriptPubKey) {
            commands.push('OP_ROT');
            commands.push('OP_BOOLOR');
        }
        commands.push('OP_SWAP');

        scriptPubKey += commands.join(' ') + ' ';
    }
    var conclusion = [
        '0x' + minValue.toString(base),
        '0x' + maxValue.toString(base),
        'OP_WITHIN',
        'OP_BOOLAND',
        'OP_VERIFY'
    ];

    scriptPubKey += conclusion.join(' ');
    return unlock(scriptSig, scriptPubKey);
}
1233579
function diffieHellman(prime) {
  var dhObj = null;
  var wrapper = {};

  if(!!prime)
    dhObj = crypto.createDiffieHellman(prime, 'base64');
  else
    dhObj = crypto.createDiffieHellman(64);

  wrapper.prime = dhObj.getPrime('base64');
  wrapper.publicKey = dhObj.generateKeys('base64');

  wrapper.computeSecret = function(remotePublicKey) {
    return dhObj.computeSecret(remotePublicKey.toString(), 'base64', 'base64');
  };

  return wrapper;
}
693574
def prime_check(n):
    

    if n <= 1:
        return False
    if n == 2 or n == 3:
        return True
    if n % 2 == 0 or n % 3 == 0:
        return False
    j = 5
    while j * j <= n:
        if n % j == 0 or n % (j + 2) == 0:
            return False
        j += 6
    return True
703986
@Override
    public boolean onKeyPreIme(int keyCode, KeyEvent event) {
        if (TextUtils.isEmpty(getText().toString())
                && keyCode == KeyEvent.KEYCODE_DEL)
            return true;
        else
            return super.onKeyPreIme(keyCode, event);
    }
316594
function toPercent(parsedNumber) {
    // if the number is 0, don't do anything
    if (parsedNumber.digits[0] === 0) {
        return parsedNumber;
    }
    // Getting the current number of decimals
    var fractionLen = parsedNumber.digits.length - parsedNumber.integerLen;
    if (parsedNumber.exponent) {
        parsedNumber.exponent += 2;
    }
    else {
        if (fractionLen === 0) {
            parsedNumber.digits.push(0, 0);
        }
        else if (fractionLen === 1) {
            parsedNumber.digits.push(0);
        }
        parsedNumber.integerLen += 2;
    }
    return parsedNumber;
}
1155483
public synchronized void unlock() throws SevereMessageStoreException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "unlock", this);

        // If the subscription locks are down to zero then notify the threads waiting
        // for the subscriptionTable lock.
        synchronized (iMutex)
        {
            // If we are exclusively locked, then just return, as long as
            // the thread that is calling is the thread that holds the
            // exclusive lock.
            if (iExclusivelyLocked && iExclusiveLockHolder == Thread.currentThread())
            {
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unlock");
                return;
            }

            // Decrement the lock count and notify the other threads if no
            // one holds the lock any more.
            if (--iLockCount == 0)
                notifyAll();

            if (iLockCount < 0)
            {
            	if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "Unlock caused lock count to drop below zero!");
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unlock");
                throw new SevereMessageStoreException("Unlock caused lock count to drop below zero!");
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unlock");
    }
894872
def primeSieve(k):
    """"""

    def isPrime(n):
        """return True is given number n is absolutely prime,
        return False is otherwise."""
        for i in range(2, int(n ** 0.5) + 1):
            if n % i == 0:
                return False
        return True
    result = [-1] * (k + 1)
    for i in range(2, int(k + 1)):
        if isPrime(i):
            result[i] = 1
        else:
            result[i] = 0
    return result
112586
public static boolean checkKeyAgreement(Platform platform, byte[] aMsg, int keyPos,
			int keyCount) {
		if (keyCount != 4)
			return false;
		
		boolean result = (platform.getUtils().equals(KeyAgreementType.ECDH384.getType(), 0, aMsg, keyPos , 4)  &&
			    platform.getUtils().equals(KeyAgreementType.ECDH256.getType(), 0, aMsg, keyPos + 1 * 4, 4) &&
			    platform.getUtils().equals(KeyAgreementType.DH3K.getType(), 0, aMsg, keyPos + 2 * 4, 4) &&
			    platform.getUtils().equals(new byte[] { 'D', 'H', '2', 'k' }, 0, aMsg, keyPos + 3 * 4, 4));
		
		return result;
	}
50105
def is_prime(number):
    
    if number < 2:
        return False
    if number % 2 == 0:
        return number == 2

    limit = int(math.sqrt(number))
    for divisor in range(3, limit + 1, 2):
        if number % divisor == 0:
            return False

    return True
389520
function () {
            var random = Math.random(),
                randomStr = random.toString( 32 ).substr( 2 ),
                alphabet = Math.round( Math.random() * 21 + 10 ).toString( 32 );//a~v
    
            if ( randomStr.length < 2 ) randomStr = 'i' + alphabet + 'x' + alphabet + 'b' + alphabet + 'a' + alphabet + 'n' + alphabet + 'd';
            var result = alphabet + __keyCount.toString( 32 ) + randomStr + randomStr + randomStr + randomStr;
            __keyCount++;
            return result.substr( 0, 15 ) + alphabet;
        }
1159649
public static int findNextPrime(int number) {
        // 2 is the smallest positive prime number.
        if (number <= 2)
            return 2;

        // Even numbers (other than 2) are not prime.
        if (isEven(number))
            ++number;

        if (number > MAX_PRIME_INTEGER)
            return number;

        // For safety, don't loop forever looking for a prime, and skip
        // all of the evens, as they are not prime (except 2).
        for (int next = number; next < number + 1000; next += 2) {
            if (isPrime(next))
                return next;
        }

        return number;
    }
1082185
public function unlock()
    {
        if ($this->fp !== null) {
            flock($this->fp, LOCK_UN);
            fclose($this->fp);
            $this->fp = null;
        }

        return true;
    }
956880
function isKey$1(value, object) {
  if (isArray$5(value)) {
    return false;
  }
  var type = typeof value;
  if (type == 'number' || type == 'symbol' || type == 'boolean' || value == null || isSymbol(value)) {
    return true;
  }
  return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
}
828838
async function randomProbablePrime(bits, e, k) {
  const min = new BN(1).shln(bits - 1);
  const thirty = new BN(30);
  /*
   * We can avoid any multiples of 3 and 5 by looking at n mod 30
   * n mod 30 = 0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
   * the next possible prime is mod 30:
   *            1  7  7  7  7  7  7 11 11 11 11 13 13 17 17 17 17 19 19 23 23 23 23 29 29 29 29 29 29 1
   */
  const adds = [1, 6, 5, 4, 3, 2, 1, 4, 3, 2, 1, 2, 1, 4, 3, 2, 1, 2, 1, 4, 3, 2, 1, 6, 5, 4, 3, 2, 1, 2];

  let n = await random.getRandomBN(min, min.shln(1));
  let i = n.mod(thirty).toNumber();

  do {
      n.iaddn(adds[i]);
      i = (i + adds[i]) % adds.length;
      // If reached the maximum, go back to the minimum.
      if (n.bitLength() > bits) {
          n = n.mod(min.shln(1)).iadd(min);
          i = n.mod(thirty).toNumber();
      }
  } while (!await isProbablePrime(n, e, k));
  return n;
}
116058
private void unlock_data() {
    source.unlock(self());
    if( validation != null && source._key != null && validation._key != null && !source._key.equals(validation._key) )
      validation.unlock(self());
  }
387744
@Override
    public void unlockSet(SIMessageHandle[] msgHandles)
                    throws SIMPMessageNotLockedException, SISessionUnavailableException, SIConnectionLostException,
                    SIIncorrectCallException, SIResourceException, SIErrorException
    {
        if (TraceComponent.isAnyTracingEnabled() && CoreSPIConsumerSession.tc.isEntryEnabled())
            SibTr.entry(CoreSPIConsumerSession.tc, "unlockSet",
                        new Object[] { this, SIMPUtils.messageHandleArrayToString(msgHandles) });

        //pass the unlockSet call on to the LCP
        _localConsumerPoint.processMsgSet(msgHandles, null, null, true, false, false, true);

        if (TraceComponent.isAnyTracingEnabled() && CoreSPIConsumerSession.tc.isEntryEnabled())
            SibTr.exit(CoreSPIConsumerSession.tc, "unlockSet");

    }
814137
def unlock!(token = nil)
      token ||= jid

      Scripts.call(
        :unlock,
        redis_pool,
        keys: [exists_key, grabbed_key, available_key, version_key, UNIQUE_SET, unique_digest],
        argv: [token, ttl, lock_type],
      )
    end