예제 #1
0
function scorePublicKey($public_key, $score_key = FALSE)
{
    $current_generation_block = transaction_cycle(0, TRUE);
    TKRandom::seed($current_generation_block);
    $public_key_score = 0;
    $tkrandom_num = 0;
    $character = 0;
    if ($score_key == TRUE) {
        $output_score_key;
        // Output what is being used to score the keys
        for ($i = 0; $i < 18; $i++) {
            $tkrandom_num = TKRandom::num(1, 35);
            $output_score_key .= "[{$tkrandom_num}=" . base_convert($tkrandom_num, 10, 36) . "]";
            // Base 10 to Base 36 conversion
        }
        return $output_score_key;
    }
    for ($i = 0; $i < 18; $i++) {
        $tkrandom_num = TKRandom::num(1, 35);
        $character = base_convert($tkrandom_num, 10, 36);
        // Base 10 to Base 36 conversion
        $public_key_score += getCharFreq($public_key, $character);
    }
    return $public_key_score;
}
예제 #2
0
function scorePublicKey($public_key)
{
    $current_generation_block = transaction_cycle(0, TRUE);
    TKRandom::seed($current_generation_block);
    $public_key_score = 0;
    $tkrandom_num = 0;
    $character = 0;
    for ($i = 0; $i < 18; $i++) {
        $tkrandom_num = TKRandom::num(1, 35);
        $character = base_convert($tkrandom_num, 10, 36);
        // Base 10 to Base 36 conversion
        $public_key_score += getCharFreq($public_key, $character);
    }
    return $public_key_score;
}