尝试解决 Octave 问题时出现的问题

Issues while trying to solve Octave problems

提问人:Jarche 提问时间:11/6/2023 更新时间:11/6/2023 访问量:27

问:

我目前正面临使用 Octave 解决此问题的问题。

问题分为两部分。

第一部分(我已经解决了):

Bob sends to you KB = 123283019.
Copy value KB to your Octave Command Window and compute the common secret key KAB=K.
Create a message d consisting of your date of birth in the decimal format YYYYMMDD, i.e.M=YYYYMMDD. 
Transform K and d to binary format using function >> dec2bin() thus obtaining binary variables 
db and Kb.
Encrypt db using Vernam cipher with agreed secret key KAB=K obtaining ciphertext c1b in binary format using function
>> c1b=binaryxor().
Transform c1b to decimal format obtaining c1 using function
>> c1=bin2dec(c1b)
Send ciphertext [c1] to the Bob.

我创立了 c1 = 108430000。

我目前面临的问题位于第二个问题:

Bob encrypts sum of money n he intends to spend as a gift to you in your birthday by computing the same agreed secret key KBA=K and using the same Vernam cipher. 
The gift itself he keeps secret. 
He sends this ciphertext c2=129650693 in decimal format to you.
Decrypt c2 and find the sum of money.
Is Bob's behaviour correct from the cryptographic point of view?
Please think over what information can be computed by adversary, intercepting two ciphertexts 
c1 and c2 between Alice and Bob.
Since your know that it is not secure to use the same key in Vernam cipher (which is also called one-time pad) to encrypt two messages, lets decrypt c2 and obtain sum n. 
Send this sum in cleartext to the Bob and warn him to avoid such mistakes in the future.

当我第一次读到它时,我立即明白这是完全相同的问题,但恰恰相反。 问题是我没有找到正确的值。

这是我尝试过的:

  1. 复制 Bob 提供的密文 c2: c2 = 129650693;

  2. 使用 dec2bin() 函数将 K 转换为二进制格式: Kb = 十进制2bin(K);

  3. 使用 dec2bin() 函数将 c2 转换为二进制格式: c2b = 十进制2bin(c2);

  4. 使用带有密钥 K 的 Vernam 密码解密 c2b: n_binary = binaryxor(c2b, Kb);

  5. 使用 bin2dec() 函数将解密的二进制值“n_binary”转换为十进制格式,以获得货币总和 (n): n = bin2dec(n_binary);

每次 n = 1.4907e+07......但是这个十进制数字对于这个问题来说太大了(鲍勃提供的钱)

如果有人知道如何解决这个问题,我会很棒,提前致谢。

数学 密码学 octave octave-gui

评论


答: 暂无答案