cryptography - Diffie Hellman generating a result in a range -
i'm using diffie-hellman key exchange method securely generate key use aes cipher (the result hashed make in ideal length). assuming exponent prime of length 2^2048 bits, how can calculate size of base , modulus if want decimal result of length in between (2^6)^32 , (2^6)^40 (i.e. base64 string of length equal or greater 32 , less or equal 40 characters). base want use within range 3
i'm new diffie-hellman exchanges, there restrictions on modulus, base or exponents should aware of?
is there equation can use derive ideal pair lengths, or have pre calculate , store in array.
thanks,
i'm not sure asking about.
for diffie-hellman choose safe or strong prime p
between 2^2047
, 2^2048-1
in case, choose element 0 < g < p-1
such g^(p-1) mod *p*=1
g^x mod p≠1
0 < x < p-1
. p
, g
constant parameters implementation. size of g
not matter scheme. key exchange sample 0 < a,b < p-1
uniformly , random, exchange g^a mod p
, g^b mod p
, , calculate g^ab mod p
. because of random choice of a
, b
result g^ab mod p
random 0 < (g^ab mod p) < p-1
.
as have noticed can hash g^ab mod p
generate short key (256 bit sha256 example).
Comments
Post a Comment