Languages
[Edit]
EN

TypeScript - One-time Pad encryption with XOR

0 points
Created by:
Selina-Miranda
737

In this short article, we would like to show a simple TypeScript implementation of the most save encrytion that was invented by humans - One-time Pad encryption with XOR.

Used XOR formula:

 

Quick solution:

1. single-byte encryption

2. multiple bytes encryption 

Algorithm description

Edit

The algorithm is as strong as perfectly random numbers have been used as secret keys.

The main concept of the algorithm is to:

  1. use XOR formula on the data units to encode and decode,

    Hint: check Wikipedia reference to see other than XOR encryption formula.

  2. store on sender and recipient devices, secret keys composed of perfect random numbers
    (the numbers from computer algorithms may be predictable, so use nature-based approaches),
  3. never share the random numbers with others than the sender and the recipient,
  4. use always only part of secret keys to encrypt or decrypt some sent message (one byte encoded by one secret key),
  5. never use 2 times the same secret keys.

See also

Edit
  1. JavaScript - One-time Pad encryption with XOR

1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join