merkle-hellman-knapsack-cryptosystem

Public Key Cryptography Algorithm

This project, part of the 95-771 Data Structures and Algorithms course at Carnegie Mellon University, focuses on implementing and utilizing linked lists for advanced cryptographic and data structure tasks. The project is divided into three parts, each building on the previous to deepen the understanding and application of linked lists.

Skills Utilized:

  • Data Structuress & Algorithms
  • Linked Lists
  • Merkle Hellman Knapsack Cryptosystem
  • Java
  • SHA-256 Hashing

Part 1: Building a LinkedList Class

Key skills demonstrated include:

Recursive Programming: Adding methods like listCopy_rec() and listLength_rec() for recursive copying and length calculation of the list.
Custom Methods: Creating methods such as displayEveryThird() and a custom toString() for enhanced functionality.
Big Theta Notation: Commenting on methods with runtime complexity in Big Theta notation, ensuring performance analysis.
Comprehensive Testing: Writing a main routine to rigorously test the linked list functionality, including node creation, copying, and iteration.

Part 2: Implementing Merkle-Hellman Knapsack Cryptosystem

Leveraging the linked list from Part 1, it implements a Merkle-Hellman Knapsack Cryptosystem. Skills utilized include:

Cryptographic Key Management: Generating, encrypting, and decrypting keys using the linked list to hold sequences of Java BigIntegers.
BigInteger Operations: Using Java’s BigInteger class to handle large integer arithmetic essential for cryptographic processes.
Interactive Applications: Developing an interactive console application for user input and real-time encryption/decryption, demonstrating practical application of theoretical cryptographic principles.

Part 3: Building a Merkle Tree

In the final part, a Merkle Tree using the custom linked list is developed to manage nodes and hash values. This involves:

Tree Structures: Constructing a tree of hashes and computing the Merkle root from text file inputs.
Hash Functions: Utilizing SHA-256 for cryptographic hashing, ensuring data integrity and security.
File Handling and User Interaction: Reading from files, handling UTF-8 text, and managing user prompts to dynamically build and display the Merkle Tree.

Key Learnings

Enhanced Understanding of Data Structures: Deepened knowledge of linked lists and their applications in cryptography and tree structures.
Practical Cryptography: Gained hands-on experience with the Merkle-Hellman Knapsack Cryptosystem and Merkle Trees.
Performance and Efficiency: Emphasized efficient coding practices and performance analysis through Big Theta notation and optimized algorithms.

This comprehensive project not only reinforces foundational data structures and algorithms but also integrates them with advanced cryptographic techniques, providing a robust learning experience in both theoretical and practical aspects of computer science.