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 :
AliceMessage(aliceValue)
andBobMessage(bobValue)
- which represent data, that you might corrupt\overwrite during communication. It takesBigInteger
and outputsBigInteger
value;CrackSession()
- which represents result of your efforts. It takes byte array of encrypted data and should output correctly decryptedstring
.
Session
can fail due to these reasons :
- Session keys of users do not do not match;
- Either Alice or Bob receives
1
as their key part from another user; - 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.
Stats:
Created | Oct 6, 2024 |
Published | Oct 6, 2024 |
Warriors Trained | 18 |
Total Skips | 0 |
Total Code Submissions | 17 |
Total Times Completed | 2 |
C# Completions | 1 |
Python Completions | 2 |
Total Stars | 2 |
% of votes with a positive feedback rating | 0% of 0 |
Total "Very Satisfied" Votes | 0 |
Total "Somewhat Satisfied" Votes | 0 |
Total "Not Satisfied" Votes | 0 |