Kerckhoffs's principle
Description:
A cryptosystem should be secure even if everything about the system, except the key, is public knowledge. (Auguste Kerckhoffs, 1883)
Story
Company "Evil, Inc." dominates the world now. They sell their software for ridiculous prices and deny access to it to whoever opposes them. We, the Resistance, managed to get the source code for their license check algorythm and it seems vulnerable. Maybe we can generate license keys on our own...
Formal problem
Test cases section contains the cryptosystem code. Kata.Keygen
should return such license
byte array for given productID
and envID
, so that Evil.Protection.CheckLicense(license, productID, envID)
returns true
.envID
is a (unique) identifier of a computer we generate license for, and (as can be seen in test cases) is completely random. productID
is assigned to products by "Evil, Inc." and precise rules of its generation are unknown.Evil.Crypto.Encrypt
takes in 64-bit block
and key
consisting of three 16-bit parts (if passed objects have more bits, only this many rightmost bits are used).
Notes and hints
-- Solutions which try to modify global variables, change testing code or otherwise cheat testing system are not welcome. This kata is about overcoming the cryptography challenge, not bypassing it.
-- Bit size of block and key are relatively low to keep within standard types, not because puzzle can't be expanded. So, basically, bruteforce for 48, 32 or even 24 bits isn't a correct solution, even if you can optimize it to be fast enough to pass tests.
-- Test cases provide some existing licenses. Look through them, they may be useful.
-- You may use Evil.Crypto
and Evil.Protection
classes in your own code.
-- Useful reading (wiki): Feistel cipher, block ciphers in general. Also, good book to read is "Practical Cryptography" by Niels Ferguson, Bruce Schneier.
Credits
Similar Kata:
Stats:
Created | May 1, 2015 |
Published | May 8, 2015 |
Warriors Trained | 218 |
Total Skips | 117 |
Total Code Submissions | 22 |
Total Times Completed | 6 |
C# Completions | 2 |
Java Completions | 5 |
Total Stars | 5 |
% of votes with a positive feedback rating | 100% of 0 |
Total "Very Satisfied" Votes | 0 |
Total "Somewhat Satisfied" Votes | 0 |
Total "Not Satisfied" Votes | 0 |