Java icon indicating copy to clipboard operation
Java copied to clipboard

[FEATURE REQUEST] One-Time Pad Cipher

Open Shewale41 opened this issue 1 month ago • 0 comments

What would you like to Propose?

Title: Add One-Time Pad Cipher Implementation


🧠 Overview

The One-Time Pad (OTP) is an unbreakable cipher (if key truly random and used once). Implementing it helps demonstrate the concept of perfect secrecy in cryptography.

📂 Implementation Details

  • Folder: src/main/java/com/thealgorithms/ciphers/
  • Filename: OneTimePadCipher.java
  • Approach:
    • Generate a random key same length as plaintext.
    • XOR plaintext with key for encryption.
    • Apply XOR again for decryption.

✅ Expected Deliverables

  • Complete encrypt/decrypt implementation.
  • Example with random key generation.
  • Tests for multiple plaintext lengths.
  • Comments explaining cryptographic limitations (key reuse).

🧑‍💻 Additional Notes

A simple yet powerful algorithm showing fundamentals of symmetric encryption and XOR logic.

Issue details

🧠 Overview

The One-Time Pad (OTP) is an unbreakable cipher (if key truly random and used once). Implementing it helps demonstrate the concept of perfect secrecy in cryptography.

Additional Information

No response

Shewale41 avatar Oct 25 '25 13:10 Shewale41