Skip to content

[FEATURE REQUEST] One-Time Pad Cipher #6941

@Shewale41

Description

@Shewale41

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions