• ComSec作业四:Diffie-Hellman


    ComSec作业四:Diffie-Hellman

    10.1 Alice and Bob use the Diffie-Hellman key exchange technique with a common prime q = 157 q = 157 q=157 and a primitive root α = 5 \alpha = 5 α=5.

    If Alice has a private key X A = 15 X_A = 15 XA=15, find her public key Y A Y_A YA

    Y A = α X A m o d    q = 5 15 m o d    157 = 79 YA=αXAmodq=515mod157=79

    YA=αXAmodq=515mod157=79
    YA=αXAmodq=515mod157=79

    If Bob has a private key X B = 27 X_B = 27 XB=27, find his public key Y B Y_B YB.

    Y A = α X B m o d    q = 5 27 m o d    157 = 65 YA=αXBmodq=527mod157=65

    YA=αXBmodq=527mod157=65
    YA=αXBmodq=527mod157=65

    What is the shared secret key between Alice and Bob?

    s h a r e d   s e c r e t   k e y = Y A X B m o d    q = Y B X A m o d    q = 7 9 27 m o d    q = 7 9 27 m o d    q = 6 5 15 m o d    q = 78 shared\ secret\ key=Y_A^{X_B}\mod q=Y_B^{X_A}\mod q=79^{27}\mod q=79^{27}\mod q=65^{15}\mod q=78 shared secret key=YAXBmodq=YBXAmodq=7927modq=7927modq=6515modq=78

    10.2 Alice and Bob use the Diffie-Hellman key exchange technique with a common prime q = 23 q = 23 q=23 and a primitive root α = 5 \alpha = 5 α=5.

    If Bob has a public key Y B = 10 Y_B = 10 YB=10, what is Bob’s private key X B X_B XB?

    由于q比较小,可以枚举n,得到下列的表

    n012345678910
    α n m o d    q \alpha^n\mod q αnmodq1521042081716119
    n1112131415161718192021
    α n m o d    q \alpha^n\mod q αnmodq2218211319315671214

    查表可知当 α n m o d    q = 10 \alpha^n\mod q=10 αnmodq=10的时候, n = 3 n=3 n=3,所以 X B = 3 X_B=3 XB=3

    If Alice has a public key Y A = 8 Y_A = 8 YA=8, what is the shared key K K K with Bob?

    K = Y A X B m o d    q = 8 3 m o d    23 = 6 K=Y_A^{X_B}\mod q=8^{3}\mod 23=6 K=YAXBmodq=83mod23=6

    Show that 5 is a primitive root of 23.

    ϕ ( 23 ) = 22 = 11 × 2 又 由 于 5 11 m o d    = 22 ≠ 1 5 2 m o d    = 2 ≠ 1 所 以 5 是 23 的 原 根 \phi(23)=22=11\times2\\ 又由于5^{11}\mod =22 \neq 1\\ 5^{2}\mod =2 \neq 1 所以5是23的原根 ϕ(23)=22=11×2511mod=22=152mod=2=1523

    ComSec作业五:椭圆曲线

    10.12 Consider the elliptic curve E 7 ( 2 , 1 ) E_7(2,1) E7(2,1); that is, the curve is defined by y 2 = x 3 + 2 x + 1 y^2 = x^3 + 2x + 1 y2=x3+2x+1with a modulus of p = 7 p = 7 p=7. Determine all of the points in E 7 ( 2 , 1 ) E_7(2,1) E7(2,1). Hint: Start by calculating the right-hand side of the equation for all values of x x x.

    椭圆曲线 E 7 ( 2 , 1 ) E_7(2,1) E7(2,1),包含的所有的点为 ( 0 , 0 ) , ( 1 , 3 ) , ( 3 , 3 ) , ( 5 , 2 ) (0, 0),(1, 3),(3, 3),(5, 2) (0,0),(1,3),(3,3),(5,2)

    10.13 What are the negatives of the following elliptic curve points over Z 7 Z_7 Z7? P = ( 3 , 5 ) P = (3, 5) P=(3,5); Q = ( 2 , 5 ) Q=(2,5) Q=(2,5); R = ( 5 , 0 ) R =(5,0) R=(5,0).

    − P = ( 3 , 2 ) − Q = ( 2 , 2 ) − R = ( 5 , 0 ) -P=(3, 2)\\ -Q=(2,2)\\ -R=(5,0) P=(3,2)Q=(2,2)R=(5,0)

    10.14 For E 11 ( 1 , 7 ) E_{11}(1, 7) E11(1,7), consider the point G = ( 3 , 2 ) G = (3,2) G=(3,2). Compute the multiple of G G G from 2 G 2G 2G through 13 G 13G 13G.

    2 G = G + G { δ = 3 x ′ 2 + a 2 y ′ m o d    p = 7 x = δ 2 − 2 ∗ x ′ m o d    p = 10 y = δ ∗ ( x ′ − x ) − y ′ m o d    p = 4 } 2 G = ( 8 , 1 ) 3 G = 2 G + G { δ = x 2 − x 1 y 2 − y 1 m o d    p = 5 x = δ 2 − x 1 − x 2 m o d    p = 1 y = δ ∗ ( x G − x ) − y G m o d    p = 8 } 3 G = ( 3 , 7 ) 2G=G+G\left\{δ=3x2+a2ymodp=7x=δ22xmodp=10y=δ(xx)ymodp=4

    δ=3x2+a2ymodp=7x=δ22xmodp=10y=δ(xx)ymodp=4
    \right\}2G=(8,1)\\ 3G=2G+G\left\{δ=x2x1y2y1modp=5x=δ2x1x2modp=1y=δ(xGx)yGmodp=8
    δ=x2x1y2y1modp=5x=δ2x1x2modp=1y=δ(xGx)yGmodp=8
    \right\}3G=(3,7)\\ 2G=G+Gδ=2y3x2+amodp=7x=δ22xmodp=10y=δ(xx)ymodp=42G=(8,1)3G=2G+Gδ=y2y1x2x1modp=5x=δ2x1x2modp=1y=δ(xGx)yGmodp=83G=(3,7)

    依次类推可以得到下表

    2 G 2G 2G 3 G 3G 3G 4 G 4G 4G 5 G 5G 5G 6 G 6G 6G 7 G 7G 7G 8 G 8G 8G 9 G 9G 9G 10 G 10G 10G 11 G 11G 11G 12 G 12G 12G 13 G 13G 13G
    ( 10 , 4 ) (10, 4) (10,4) ( 1 , 8 ) (1, 8) (1,8) ( 5 , 4 ) (5, 4) (5,4) ( 4 , 8 ) (4, 8) (4,8) ( 7 , 7 ) (7, 7) (7,7) ( 6 , 8 ) (6, 8) (6,8) ( 6 , 3 ) (6, 3) (6,3) ( 7 , 4 ) (7, 4) (7,4) ( 4 , 3 ) (4, 3) (4,3) ( 5 , 7 ) (5, 7) (5,7) ( 1 , 3 ) (1, 3) (1,3) ( 10 , 7 ) (10, 7) (10,7)

    ComSec作业六:Hash

    11.1What characteristics are needed in a secure hash function?

    单向性,抗碰撞性

    11.2What is the difference between weak and strong collision resistance?

    弱碰撞性:在已知 x x x的和 H ( x ) H(x) H(x)的情况下,寻找一个不等于 x x x x ′ x' x使得 H ( x ) = H ( x ′ ) H(x)=H(x') H(x)=H(x)成立

    强碰撞性:任意找两个不相等的 x , x ′ x,x' x,x,使得 H ( x ) = H ( x ′ ) H(x)=H(x') H(x)=H(x)

    113What is the role of a compression function in a hash function?

    将任意长度的报文压缩成为一个较短的定长输出报文的函数

    11.4What is the difference between little-endian and big-endian format?

    little-endian:小端序,指的是计算机存储一个数的时候,该数的高字节存在高地址处,低字节存在低地址处

    例子:比如0x1234,在计算机中存储为[0x34 0x12](向右为高地址)

    big-endian:大端序,指的是计算机存储一个数的时候,该数的高字节存在低地址处,低字节存在高地址处

    例子:比如0x1234,在计算机中存储为[0x12 0x34](向右为高地址)

    11.5What basic arithmetical and logical functions are used in SHA?

    加法,模,循环移位,AND、OR、NOT和XOR。

    11.6Describe the set of criteria used by NIST to evaluate SHA-3 candidates.

    首先需要满足Hash的基本性质:单向性和抗碰撞性

    其次就是算法实现的逻辑门更少,效率更加的高

    之后就是要抗已知的所有攻击方法的攻击

    11.7Define the term sponge construction.

    海绵结构分为吸水阶段和挤压阶段,和现实生活中的海绵相类似

    吸水阶段就是接受输入,根据输入调整隐藏的state,挤压阶段就是更具隐藏的state计算出Hash的结果

    吸水阶段:初始化state->与输入的信息XOR->经过压缩函数->与输入的信息XOR->经过压缩函数->…

    挤压阶段:经过压缩函数->挤压出输出1->经过压缩函数->挤压出输出2->…

    11.8Briefly describe the internal structure of the iteration function f f f.

    f f f函数也称为搅拌函数,过程是经过5个阶段 θ , ρ , π , χ , ι \theta,\rho,\pi,\chi,\iota θ,ρ,π,χ,ι,可以将隐藏的state中的bit打乱。

    11.9List and briefly describe the step functions that comprise the iteration function f f f.

    step θ \theta θ

    a [ x ] [ y ] [ z ] ← a [ x ] [ y ] [ z ] + ∑ y ′ = 0 4 a [ x − 1 ] [ y ′ ] [ z ] + ∑ y ′ = 0 4 a [ x + 1 ] [ y ′ ] [ z − 1 ] a[x][y][z]\leftarrow a[x][y][z] + \sum_{y'=0}^{4}a[x-1][y'][z]+\sum_{y'=0}^{4}a[x+1][y'][z-1] a[x][y][z]a[x][y][z]+y=04a[x1][y][z]+y=04a[x+1][y][z1]

    step ρ \rho ρ

    a [ x ] [ y ] [ z ] ← a [ x ] [ y ] [ z − ( t + 1 ) ( t + 2 ) / 2 ] w i t h    t    s a t i s f y i n g    0 ≤ t ≤ 24    a n d ( 0 1 2 3 ) t ( 1 0 ) = ( x y ) i n    G F ( 5 ) 2 × 2 o r    t = − 1    i f    x = y = 0 a[x][y][z]\leftarrow a[x][y][z - (t+1)(t+2)/2]\\ with\space\space t\space\space satisfying \space\space 0\le t\le 24\space\space and \left(0123

    0213
    \right)^t \left(10
    10
    \right)=\left(xy
    xy
    \right) in \space\space GF(5)^{2\times2}\\ or \space\space t=-1\space\space if\space\space x=y=0 a[x][y][z]a[x][y][z(t+1)(t+2)/2]with  t  satisfying  0t24  and(0213)t(10)=(xy)in  GF(5)2×2or  t=1  if  x=y=0

    step π \pi π

    a [ x ] [ y ] ← a [ x ′ ] [ y ′ ] , w i t h    ( x y ) = ( 0 1 2 3 ) ( x ′ y ′ ) , a[x][y]\leftarrow a[x'][y'], with\space\space\left(xy

    \right)=\left(0123
    \right)\left(xy
    \right), a[x][y]a[x][y],with  (xy)=(0213)(xy),

    step χ \chi χ

    a [ x ] ← a [ x ] + ( a [ x + 1 ] + 1 ) a [ x + 2 ] a[x]\leftarrow a[x]+(a[x+1]+1)a[x+2] a[x]a[x]+(a[x+1]+1)a[x+2]

    step ι \iota ι

    a ← a + R C [ i r ] a \leftarrow a+RC[i_r] aa+RC[ir]

  • 相关阅读:
    nginx php-fpm swoole
    基于Jaccard相似度的推荐算法---示例
    交通标志识别-YOLO-数据集TT100
    代码随想录38——动态规划:动态规划理论基础、509斐波那契数列、70爬楼梯、746使用最小花费爬楼梯
    C++仿函数
    Windows Docs
    通过 saltstack 批量更新 SSL 证书
    UE5 C++ 斯坦福 1
    Shopee买家通系统一款批量注册虾皮买家号软件
    使用Go的功能选项模式优雅实现devstream内部复杂对象的创建
  • 原文地址:https://blog.csdn.net/weixin_45004513/article/details/127854968