首页 > 其他分享 >BIKE def.h

BIKE def.h

时间:2024-05-10 15:56:54浏览次数:10  
标签:... VA ARGS BIKE MSG BITS def define

/******************************************************************************

  • BIKE -- Bit Flipping Key Encapsulation
  • Copyright (c) 2021 Nir Drucker, Shay Gueron, Rafael Misoczki, Tobias Oder,
  • Tim Gueneysu, Jan Richter-Brockmann.
  • Contact: [email protected], [email protected],
  • [email protected], [email protected], [email protected],
  • [email protected].
  • Permission to use this code for BIKE is granted.
  • Redistribution and use in source and binary forms, with or without
  • modification, are permitted provided that the following conditions are met:
    • Redistributions of source code must retain the above copyright notice,
  • this list of conditions and the following disclaimer.
    • Redistributions in binary form must reproduce the above copyright
  • notice, this list of conditions and the following disclaimer in the
  • documentation and/or other materials provided with the distribution.
    • The names of the contributors may not be used to endorse or promote
  • products derived from this software without specific prior written
  • permission.
  • THIS SOFTWARE IS PROVIDED BY THE AUTHORS ""AS IS"" AND ANY
  • EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  • IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  • PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS CORPORATION OR
  • CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  • EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  • PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  • PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  • LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  • NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  • SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    ******************************************************************************/

ifndef DEFS_H_INCLUDED

define DEFS_H_INCLUDED

////////////////////////////////////////////
// BIKE main parameters
///////////////////////////////////////////

// UNCOMMENT TO SELECT THE NIST SECURITY LEVEL 1, 3 OR 5:

define PARAM64 // NIST LEVEL 1

//#define PARAM96 // NIST LEVEL 3
// #define PARAM128 // NIST LEVEL 5

// UNCOMMENT TO ENABLE BANDWIDTH OPTIMISATION FOR BIKE-3:
//#define BANDWIDTH_OPTIMIZED

// BIKE shared-secret size:

define ELL_BITS 256ULL

define ELL_SIZE (ELL_BITS/8)

////////////////////////////////////////////
// Implicit Parameters (do NOT edit below)
///////////////////////////////////////////

// select the max between a and b:

define MAX(a,b) ((a)>(b))?(a):(b)

// LEVEL-5 Security parameters:

ifdef PARAM128

define R_BITS 40973ULL

define DV 137ULL

define T1 264ULL

define VAR_TH_FCT(x) (MAX(17.8785 + 0.00402312 * (x), 69))

// Parameters for BGF Decoder:

define tau 3

define NbIter 5

// LEVEL-3 Security parameters:

elif defined(PARAM96)

define R_BITS 24659ULL

define DV 103ULL

define T1 199ULL

define VAR_TH_FCT(x) (MAX(15.2588 + 0.005265 * (x), 52))

// Parameters for BGF Decoder:

define tau 3

define NbIter 5

// LEVEL-1 security parameters:

elif defined(PARAM64)

define R_BITS 11003ULL

define DV 67LL

define T1 135ULL

define VAR_TH_FCT(x) (MAX(13.530 + 0.0069722 * (x), 36))

// Parameters for BGF Decoder:

define tau 3

define NbIter 5

endif

// Divide by the divider and round up to next integer:

define DIVIDE_AND_CEIL(x, divider) ((x/divider) + (x % divider == 0 ? 0 : 1ULL))

// Round the size to the nearest byte.
// SIZE suffix, is the number of bytes (uint8_t).

define N_BITS (R_BITS*2)

define R_SIZE DIVIDE_AND_CEIL(R_BITS, 8ULL)

define N_SIZE DIVIDE_AND_CEIL(N_BITS, 8ULL)

define R_DQWORDS DIVIDE_AND_CEIL(R_SIZE, 16ULL)

////////////////////////////////////////////
// Debug
///////////////////////////////////////////

ifndef VERBOSE

define VERBOSE 0

endif

if (VERBOSE == 3)

define MSG(...) { printf(VA_ARGS); }

define DMSG(...) MSG(VA_ARGS)

define EDMSG(...) MSG(VA_ARGS)

define SEDMSG(...) MSG(VA_ARGS)

elif (VERBOSE == 2)

define MSG(...) { printf(VA_ARGS); }

define DMSG(...) MSG(VA_ARGS)

define EDMSG(...) MSG(VA_ARGS)

define SEDMSG(...)

elif (VERBOSE == 1)

define MSG(...) { printf(VA_ARGS); }

define DMSG(...) MSG(VA_ARGS)

define EDMSG(...)

define SEDMSG(...)

else

define MSG(...) { printf(VA_ARGS); }

define DMSG(...)

define EDMSG(...)

define SEDMSG(...)

endif

////////////////////////////////////////////
// Printing
///////////////////////////////////////////

// Show timer results in cycles.

define RDTSC

//#define PRINT_IN_BE
//#define NO_SPACE
//#define NO_NEWLINE

////////////////////////////////////////////
// Testing
///////////////////////////////////////////

define NUM_OF_CODE_TESTS 100ULL

define NUM_OF_ENCRYPTION_TESTS 100ULL

endif //TYPES_H_INCLUDED

标签:...,VA,ARGS,BIKE,MSG,BITS,def,define
From: https://www.cnblogs.com/1314liyang/p/18184534

相关文章

  • BIKE decode.h
    /******************************************************************************BIKE--BitFlippingKeyEncapsulationCopyright(c)2021NirDrucker,ShayGueron,RafaelMisoczki,TobiasOder,TimGueneysu,JanRichter-Brockmann.Contact:drucker.nir@g......
  • CF1787H Codeforces Scoreboard
    CF1787HCodeforcesScoreboard校内测试的一道题,考试时根本没动。。题面考虑\(k\)比较大的放前面肯定优,然后修门挨着放也肯定优,所以先按\(k\)排个序,然后我们就只考虑每个门修不修。设计状态\(f[i][j]\)表示前\(i\)个点,有\(j\)个门取\(b-kt\),少送回去的最少......
  • CodeForces 1967D Long Way to be Non-decreasing 题解
    题意简述yzh喜欢单调不降序列。她有一个序列\(a\),最初为\(a_1,\ldots,a_n\),其中每个元素都在\([1,m]\)内。她希望使序列变得单调不降,为此,她有一个序列$b_1\ldotsb_m$,每个元素也在\([1,m]\)内。她可以进行若干次操作,一次操作定义为:选择一个集合\(S\subseteq......
  • Codeforces Round 942 (Div. 2) D2
    链接题目要求用数学一点的形式表达出来就是统计有多少a,b满足1.\(1\leqa\leqn,1\leqb\leqm\)2.\(\existsk\inN^*,使得b\timesgcd(a,b)=k\times(a+b)\)首先,把a和b改写,使得\(gcd(a,b)\)消失\(a=q*d,b=p*d\),则,\(gcd(a,b)=d\)条件二变为:\(p\timesd^2=k\times(q\t......
  • 条件编译#if、#elif、#ifdef的妙用
    前言—般情况下,C语言源程序中的每一行代码.都要参加编译。但有时候出于对程序代码优化的考虑,希望只对其中一部分内容进行编译,此时就需要在程序中加上条件,让编译器只对满足条件的代码进行编译,将不满足条件的代码舍弃,这就是条件编译。相关的预编译指令如下:条件编译功能预处理程......
  • qt 使用windows 的USB库 hid.dll 报错 :undefined reference to `HidD_GetAttributes(v
     1、cmakeLists.txt文件引入相应的库: cmake_minimum_required(VERSION3.5)project(test1LANGUAGESCXX)file(GLOBSRC./*.cpp./*.h)add_executable(test1${SRC})include(GNUInstallDirs)target_link_libraries(${PROJECT_NAME}hidsetupapi)inst......
  • Codeforces Round 941 (Div. 2) Div 1 cf941 A-D
     A感觉A比较复杂啊,相比较B简单明了。way1只要有相同的一个数,它的数目大于等于k,那么它就可以进行一次操作,接下来可以再摸k-1个数,那么对于无法凑成k个数的数字来说,无论现在它有多少个数(>=1),加上这k-1个数,都能凑成数目>=k。同时,这个操作可以无限循环下去。所以这道题的出题设......
  • 『Solution』Codeforces 372D Choosing Subtree is Fun
    首先这个\(k\)的限制不是很好入手,考虑先从如果选取了区间\([l,r]\)来入手。那么此时连通块最小的\(siz\)就是把这些点拎出来建虚树对应在原树上的所有点。那么这个有个结论,考虑按\(\operatorname{dfn}\)序排序后的点为\(p_0\simp_{k-1}\),那么对应的最小\(sz\)就......
  • TypeError: Cannot read properties of undefined (reading 'trim')
     运行时提示:TypeError:Cannotreadpropertiesofundefined(reading'trim')问题排查:1、确认trim()属性是否存在,这个是js去除字符串左右空格,属性是存在的2、确认this.form.proxy_url是否存在3、确认确认this.form.proxy_url的值是否为undefined和null通过排查和打印,con......
  • 『Solution』Codeforces 1970B Exact Neighbours
    Easy没什么启发性,直接考虑Medium。考虑到\(a_1=0\),那么\(1\)明显直接和自己配对就行,考虑分配到一个特殊的位置\((1,1)\)。接下来考虑如果还有\(a_i=0\),那么明显\(i\)也是和自己配对,此时因为这是无关紧要的就可以离特殊的\((1,1)\)尽量远一点,也就是让\(x\)坐......