Padlock is a JavaScript-based communication-security interface that enables you to carry out One-Time Pad (OTP) encryption and decryption processes, supporting various numeral systems.
| Length: | 0 | Checksum: | — |
| Length: | 0 | Checksum: | — |
This application utilizes a JavaScript-based algorithm for encryption and decryption, inspired by the One-Time Pad cipher.
Our goal is to streamline the traditionally tedious process of adding and subtracting characters. By integrating modern technology with a reliable and secure cipher, we aim to provide a valuable service to OTP operators.
Navigate to the "Generate Pads" section from the top tabs.
Choose either Random or Seed
to be the source of your OTP generation.
If seed is selected, you'll also need to provide a secret seed.
To create multiple one-time pads, enter the desired quantity of pads in the provided input field.
Enter the desired length
of the OTP in the provided input field. The length
should match (or exceed) the length of the message you intend to encrypt or decrypt.
Choose the desired character-set of the OTP in the provided drop-down list. There are numerous character-sets available, such as binary, decimal, alphabetical, and more. Some character-sets allow you to specify a casing (e.g. all upper-case letters).
Click the "Generate" button. The app will create a pseudo-random string of characters (letters, numbers, and symbols, depending on the character-set chosen) of the specified length.
The generated OTP will be displayed on the screen, unless you enabled the "Hide Pads" option. Each OTP has a few controls at the top of the pad that let you either copy the pad to the clipboard, use it as a send key, or use it as a receive key.
To verify that both the sender and receiver successfully produced the same OTP, each pad is assigned a specific pad id that is also a checksum. If in doubt, transmit the OTP's pad ID to verify the pads are the same.
Navigate to the "Encrypt/Decrypt" section.
Choose the desired character-set of the OTP in the provided drop-down list. This should be the same character-set used when generating the one-time pad. For example, if a binary OTP was generated, the character-set should also be set to binary.
Type the plaintext message you want to encrypt, or the ciphertext if you intend to decrypt, in the specified text area. Make sure that the length of the message does not exceed the length of the OTP/key.
Paste the OTP into either the send key or receive key. You can use different one-time pads for both key types if you prefer. Using different OTPs for the send-key and receive-key can help prevent operators from human error by accidentally using the same part of a key, which could lead to security vulnerabilities or decryption problems. It also mitigates keys from getting out of sync since encrypting and decrypting messages are handled separately for each operator.
If you ever suspect that the sender and receiver are using mismatched keys or that the keys are out of sync, operators should share the "length" and "checksum" values located below each key. This information can help re-sync their keys and ensure they have the same composition.
Click the "Encrypt" button (if encrypting a plaintext message), or the "Decrypt" button (if decrypting a ciphertext). The app will perform the encryption/decryption using the OTP as the key and display either the ciphertext or plaintext on the screen.
You have the option to click the "Save" button to store your progress and settings as a JSON file. This allows you to easily resume your work later. To import previously saved settings and progress, simply click the "Load" button and select the desired JSON file.
A one-time pad can be used for secure communication by employing a random key (the pad) that is as long as the message itself. The process begins with the generation of a randomly-generated key, which consists of random characters, numbers, or symbols and is kept secret between the communicating operators. When the sender, for example, Alice, wants to send a secure message, she converts her plaintext into numerical values and adds the corresponding values of the key, using modular arithmetic to wrap around if necessary. This results in the encrypted ciphertext, which she then transmits to the receiver, Bob. Upon receiving the ciphertext, Bob converts the same key (pad) into numerical values and subtracts the key values from the ciphertext, again applying modular arithmetic to retrieve the original plaintext message.
The security of the one-time pad lies in its design: as long as the one-time pad (key) is truly random, used only once, and kept confidential, it provides perfect secrecy. Without access to the key, the ciphertext remains indecipherable, ensuring that the communication between Alice and Bob is secure.
With Padlock, this process becomes highly automated, making secure communication easier. This app can generate random (and pseudo-random) keys and also perform the encryption and decryption processes seamlessly.
For technical instructions on how to use this app for secure communication, see the How to Use Padlock section.
With Padlock, you can securely store passwords for various credentials, all while only needing to memorize one single master-password. Here's how the process works:
The primary idea of this method is that the master-password and the random string work together to derive the real password. Even if an attacker gets your encrypted credential storage, they can't access the passwords without your master-password.
An alternative to memorizing a complex master-password would
be to instead memorize a Seed, and use that seed to
generate the master-password.
Padlock can be used to encrypt small files.
It should be noted that file-encryption is not the primary use-case for this app, and as such is highly inefficient in doing so. In most cases, there are far superior methods of encrypting files on a computer (such as AES, RSA, ECC, or full-disk encryption like Bitlocker, FileVault, or dm-crypt).
Due to the limitations of this app, it's not recommended to encrypt
files larger than 10 megabytes in size. You can split larger files
into separate pieces with the split command, or encrypt
a file with one of the modern methods outlined above, then use this app to encrypt
the key needed to decrypt the file.
To encrypt a file, follow the steps below:
7z a -t7z -mx=9 -mhe=on -p"YourStrongPassword" archive.7z secret1.txt secret2.png secret3.pdf
Where "YourStrongPassword" would be changed to a secure password of your choice; and the files listed would be the names of the files you want to encrypt.
base64 -w0 archive.7z > archive.7z.b64
wc -c archive.7z.b64
This will encrypt the file, though it may take several minutes to complete; depending on the file's size.
To decrypt an encrypted file, follow the steps below:
This will load the encrypted file into the "Ciphertext" field.
base64 -d archive.7z.b64 > archive.7z
Where "archive.7z.b64" is the name of the base64 file and "archive.7z" is the name of the archive.
7z x archive.7z
Where "archive.7z" is the name of the archive.
Padlock serves as an effective tool for implementing a Zero Knowledge Proof. This cryptographic technique enables one party (the prover) to demonstrate to another party (the verifier) that a statement is true without disclosing any additional information beyond that verification.
This method is particularly beneficial for authentication purposes, such as remotely confirming your identity or validating someone's knowledge on a specific topic. To utilize this technique, follow these steps:
A one-time pad (OTP) is a method of encryption that uses a single-use pre-shared key or pad that is as long as the message being sent. The key consists of random characters, and each character of the plaintext message is combined with a corresponding character from the key using modular addition (typically modulo 26 for letters).
When an OTP is properly utilized, it is theoretically unbreakable. This is not an exaggeration; the cipher has been mathematically proven to be virtually impossible to crack, regardless of the computational power, time, or expertise an eavesdropper may possess.
No other cipher currently known to man can claim such a feat.
The foundation of this cryptographic method can be illustrated by the
simplicity of the equation: 1 + 1 = 2
When two numbers are added together, they produce a sum. This sum, when considered alone, offers no information about the individual numbers that were combined to form it.
For example, the number seven could have been composed by adding one and six, two and five, three and four, and so on. When an eavesdropper only has the number seven to work with, they have no leads on what two individual parts were used to create that number.
The concept of the one-time pad was first described by the American inventor and cryptographer Gilbert Vernam in 1917. Vernam, who was working for AT&T, developed a system that used a tape of random characters to encrypt messages. This method was later refined by Joseph Mauborgne, who introduced the idea of using a key that is as long as the message itself.
During World War II, simple encryption methods, particularly one-time pads (OTPs), played a crucial role in the communications of the French Resistance and the intelligence efforts of British and American forces against the Axis powers. The French Resistance utilized OTPs to securely transmit vital information about enemy movements, sabotage operations, and logistical support to their allies, ensuring that sensitive details remained confidential and protected from German interception. Meanwhile, British and American intelligence agencies employed OTPs to communicate with resistance fighters and coordinate operations, leveraging the pads' theoretical unbreakability to safeguard their messages. This secure communication was essential for planning and executing missions, such as the D-Day invasion and other covert operations. The use of OTPs exemplified the importance of secure communication in wartime, enabling collaboration among disparate groups and contributing to the overall success of the Allied efforts against the Axis powers.
During the Cold War one-time pads were a crucial tool for secure communication among intelligence agencies and spies. Agencies like the CIA and KGB relied on OTPs to protect sensitive messages, ensuring that critical information regarding espionage, paramilitary operations, and diplomatic negotiations remained confidential.
One-time pads were employed in number stations—enigmatic radio broadcasts that transmitted coded messages to spies in the field. These broadcasts typically featured sequences of numbers read by a synthesized voice, which agents would intercept via radio and decode using their one-time pads. Another technique involved the use of microdots, where tiny photographs containing messages were hidden within printed materials, allowing for discreet transmission of information. While the practical limitations of OTPs—such as the need for keys to be as long as the messages and the complexities of key management—restricted their widespread use, they were reserved for the most sensitive communications.
In modern times, while more sophisticated encryption methods like asymmetric encryption dominate Internet communications due to their practicality and efficiency, one-time pads (OTPs) still hold significant value because of their unique security characteristics. OTPs provide theoretical unbreakability and can be implemented with just pencil and paper, allowing them to be integrated into almost any communication medium. This contrasts with modern encryption, which is often hidden from users and may contain secret backdoors or be vulnerable to eavesdropping and key mismanagement in compromised environments, such as on computers not owned or controlled by the user. As a result, OTPs remain relevant for highly sensitive communications where absolute security is paramount.
Before two operators can use the same one-time pad for secure communication, they must first share either the entire pad or a seed that can be used to generate identical pads.
Imagine you, a radio operator deep behind enemy lines, want to send an encrypted message to your commander, and you want to ensure that only they can read it. To do this, you need to use either a one-time pad or a seed for generating a one-time pad, that only you and your commander know. But before you can start transmitting secret messages, you need to find a way to share this key with your commander without the enemy intercepting it.
This is a challenging problem that has plagued secure communication since the dawn of encryption. Luckily, with the advancements in technology and tactics, it's now easier than ever to share this secret seed securely; although no one method is perfect. Here are some common ways to share a one-time pad or seed with another operator, without letting the enemy intercept it:
If you and your fellow operator are currently together and anticipate being separated in the future, take a proactive step to ensure secure communication. Before parting ways, exchange a secret seed or one-time pad. This pre-shared secret will serve as the foundation for secure future communications. When you need to transmit sensitive information later, you can immediately begin exchanging messages securely, using the pre-shared codebook to encrypt your transmissions.
Out-of-band (OOB) communication refers to any message exchanged outside the main frequency or channel being used for communication. For instance, if two operators will primarily send coded messages over their radio sets, they might first agree to share a secret one-time pad or seed through semaphore flags, a secure courier, or a morse-code line. In this scenario, any enemy listening in on the radio transmissions would be unable to intercept the OOB message. The operators would be able to secretly exchange seeds; and thus keep their radio communications secure.
An ephemeral secret is a type of OOB communication where the operators share a secret seed or one-time pad via a location or source that disappears (or is destroyed) shortly after being accessed. This method should only be used when both parties are certain that there are no active real-time attackers; or when the enemy agents are significantly delayed in their response.
The most effective type of ephemeral secret is one that only you and the receiver can access by placing it behind a physical lock, password, or secret (e.g. secret location, secret compartment, etc.). That way, if an enemy agent attempts to trace your footsteps or intercept the sensitive information, they'll be stopped by the barrier.
For instance, suppose an operator, Alice, wants to share a secret seed with another operator, Bob. She can upload the secret seed to a secure web server she controls, then send Bob a hyperlink to the file. If Bob can access the file quickly, Alice can immediately delete it afterwards, preventing any enemy from accessing the secret in the future. Dead Drops operate on the same ephemeral secret principle.
A dead drop is an inconspicuous or hidden physical location where two operators can leave or retrieve a secret seed or one-time pad while avoiding direct contact.
For example, Alice and Bob might agree on a specific location (e.g., a bench in a park) and a time. At a designated time, Alice would secretly leave a sealed envelope containing the seed or one-time pad. Shortly after, Bob would retrieve it. Because both parties are never at the same place at the same time, and the transfer is done secretly, it's extremely secure.
However, they're also more complicated to set up and can be risky if the location is discovered or an enemy agent gets to the package first.
Generating a secret seed from a public source resembles the concept of an ephemeral secret, but relies on publicly accessible information instead. Think of examples like the closing stock prices in a neutral country’s newspaper, the timestamp on a coded radio broadcast, weather reports from a specific city, or even the positions of the stars and planets. If both operators have access to the same details, they can generate identical seeds for their one-time pads, no matter how far apart they are—even one is in London and the other behind enemy lines.
Be warned: the enemy could get their hands on this public information, too. If they figure out what data is being used, they might crack the seed and unravel everything. To stay one step ahead, mix this trick with the other methods outlined here. For example, both operators could agree beforehand (pre-sharing) on exactly which obscure piece of public data to use—like the 15th word on the 3rd page of the "Neue Zürcher Zeitung" newspaper published in Zurich a year past—or stick to something that changes rapidly (ephemeral secret), like the price of a Berlin stock at noon.
Stenography is the craft of embedding confidential information within everyday objects—such as letters, photographs, or sketches—so that the enemy sees only harmless material and is unaware that any secrets are being communicated. When paired with a one-time pad, seed, or encrypted message, stenography offers a secret way to outwit even the sharpest interrogator.
Steganography operates on the principle that information fundamentally consists of patterns. Consequently, any medium—whether matter or light—that can be arranged into specific patterns can serve as a vehicle for storing or conveying secret information. For instance, subtle modifications to commonplace items—such as a handwritten note, a propaganda leaflet, or a photograph—can effectively conceal a message within a series of hidden patterns. Alternatively, some forms of steganography do not require altering the item itself, as information also necessitates an interpreter or "reader" capable of recognizing and understanding these patterns to extract meaningful information. If an adversary is unaware of what information to extract or how to interpret it, they will be unable to comprehend the message. This principle allows two operators to agree in advance (see presharing) to use an ordinary, unmodified object, employing a predetermined method to interpret the object's inherent characteristics—such as the weight of a vase—as a basis for communication. By keeping the specific characteristics used as a shared secret, a message can be effectively hidden through steganography.
In both steganographic methods, the key to success lies in how the message is embedded and subsequently extracted. For steganography to be effective, it is crucial that both parties have a pre-arranged system in place to understand the specific steganographic technique being employed and how to utilize it for sending secret messages. Some common methods include:
If Alice and Bob need to establish secure communication but have never met and are geographically separated, they can still do so with the help of a mutual friend, Charlie, who has secure connections with both Alice and Bob. Charlie can securely share a seed with both Alice and Bob, enabling them to establish their own secure connection. Charlie doesn't have to be a real person, either. If Alice and Bob are using the same version of this app, for example, with the same unique salts set up, they can use the secret salts as the trusted third party. However, the salts would need to remain a shared secret between both parties for this method to work.
This section outlines essential operational security (opsec) and cybersecurity (cysec) methods for securely handling secret messages on computers. Following these guidelines will help mitigate risks associated with unauthorized access, surveillance, and data breaches.
By adhering to these operational security and cybersecurity methods, you can significantly enhance the security of secret messages handled on computers. Always remain vigilant and continuously assess your environment and practices to mitigate potential risks.
Yes, this app (Padlock) is released until the MIT License:
Copyright (c) 2025 Kyle Mecklem Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.