代码拉取完成,页面将自动刷新
/*
* smallprimes.c: implementation of the array of small primes defined
* in sshkeygen.h.
*/
#include <assert.h>
#include "ssh.h"
#include "sshkeygen.h"
/* The real array that stores the primes. It has to be writable in
* this module, but outside this module, we only expose the
* const-qualified pointer 'smallprimes' so that nobody else can
* accidentally overwrite it. */
static unsigned short smallprimes_array[NSMALLPRIMES];
const unsigned short *const smallprimes = smallprimes_array;
void init_smallprimes(void)
{
if (smallprimes_array[0])
return; /* already done */
bool A[65536];
for (size_t i = 2; i < lenof(A); i++)
A[i] = true;
for (size_t i = 2; i < lenof(A); i++) {
if (!A[i])
continue;
for (size_t j = 2*i; j < lenof(A); j += i)
A[j] = false;
}
size_t pos = 0;
for (size_t i = 2; i < lenof(A); i++) {
if (A[i]) {
assert(pos < NSMALLPRIMES);
smallprimes_array[pos++] = i;
}
}
assert(pos == NSMALLPRIMES);
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。