Skip to content

Conversation

@vivaidris
Copy link

Adds a One-Time Pad (OTP) implementation to crypto/cipher.

OTP is a type of encryption that is provably secure
information-theoretically when used correctly. It
requires a key that is the same length as the message
and used only once.

This package provides the following:

  • OTPEncrypt and OTPDecrypt functions for encryption
    and decryption of byte slices.
  • KeyGen function for generating cryptographically
    secure random keys of the appropriate length.
  • A simple unit test (otp_test.go) that verifies
    encryption and decryption works correctly.

Note: OTP is not intended to be used in real-life practice
as it has highly limited capabilities and can only be used once
for the safest encryption, making it highly inefficient.

@google-cla
Copy link

google-cla bot commented Dec 15, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant