Beta

Diffie, Hellman and You

Description:

Alice and Bob agreed communicate using Diffie-Hellman key exchange protocol. You have access to communication channel and can write \ modify data they send each other during DH execution. Your task is to decrypt message encrypted by key obtained during DH protocol.

Process details :

  • Key exchange is performed in multiplicative group of integers modulo

    30251575896538896245165270585041278040955420285387486763062672589424615181639;

  • Order of multiplicative group is divisible by small factor

    32261;

  • They agreed on group generator

    7;

  • After obtaining session key, they use SHA-256 function to derive key for symmetric cypher, which they use for main message encryption (cypherKey = SHA256(sessionKey));

  • All their messages consist of natural language (namely English) words;

Your solution should contain three functions :

  1. AliceMessage(aliceValue) and BobMessage(bobValue) - which represent data, that you might corrupt\overwrite during communication. It takes BigInteger and outputs BigInteger value;

  2. CrackSession() - which represents result of your efforts. It takes byte array of encrypted data and should output correctly decrypted string.

Session can fail due to these reasons :

  1. Session keys of users do not do not match;
  2. Either Alice or Bob receives 1 as their key part from another user;
  3. Message decrypted incorrectly.

USE UTF-16 ENCODING

If you do not know where to start

Note, that field order has small factors. Maybe you could enforce resulting key fit into that subgroup. Since messages will contain natural language words, you can use frequency analysis to distinguish correctly decrypted messages from wrong ones.

Cryptography
Mathematics
Algebra

Stats:

CreatedOct 6, 2024
PublishedOct 6, 2024
Warriors Trained18
Total Skips0
Total Code Submissions17
Total Times Completed2
C# Completions1
Python Completions2
Total Stars2
% of votes with a positive feedback rating0% of 0
Total "Very Satisfied" Votes0
Total "Somewhat Satisfied" Votes0
Total "Not Satisfied" Votes0
Ad
Contributors
  • topologoanatom Avatar
  • hobovsky Avatar
Ad