how to implement one time pad encryption for images?

6 views (last 30 days)
One time pad is an interesting method i implemented it on alphabets .I need help in implementing it on images?
  10 Comments
David Goodmanson
David Goodmanson on 24 Jan 2018
Thanks Walter, lots of good information. And thanks Jan, for the clarification.
As far as the one time pad, the 64, 768 and 128 bit rules appear to refer to specific algorithms. The one time pad does seem like a different animal. It contains a huge number of bits all right, but unlike those algorithms it comes with a distribution problem as Walter mentioned, which is ongoing all the time. And it can't be broken, so continual improvement of the algorithm is not an issue. So I'm curious about the following:
Let's say I (a) write a piece of software to create one time pads. (b) trusting the mail, I put a one time pad on a flash drive and send it to my friend Paul in Quintana Roo, Mexico. (c) I write some software to code and decode messages. This can be really simple since the one time pad is doing all the work. (d) I email that software to Paul. (e) I encode King Lear and email that to Paul so he can decode it.
Would this be illegal? And if I have a discussion with anybody in or out of the country about software improvements in (a) and (c), would this be illegal also?
Walter Roberson
Walter Roberson on 24 Jan 2018
Typical OTP is done by just XOR'ing the data with the key. Because the same key is used to both encrypt and decrypt, that counts as a symmetric system, the key limit for which is 64 bits before some of the provisions kick in. So you could encrypt 8 bytes. You might be tempted to just keep repeating those 8 bytes of key, but if you do so then it is not OTP and is relatively easily susceptible to statistical analysis.
"And it can't be broken, so continual improvement of the algorithm is not an issue."
However, given source code (what we are talking about here) then it is likely very easy to just extend the maximum length of the key, violating the requirement that "The cryptographic functionality cannot be easily changed by the user"
"Would this be illegal?"
I do not know. I do not have enough background in encryption case law to understand what the boundaries are of the permitted uses. For example would you be emailing the software in source or in compiled form? Compiled form would not be easily changed by the user, so different sections might kick in.

Sign in to comment.

Answers (1)

Jan
Jan on 24 Jan 2018
Edited: Jan on 24 Jan 2018
Your problem does not concern Matlab, but US laws about exporting information which is considered to be relevant for warfare and terrorism. Although Walter has a reliable knowledge about legal questions, I'd really rely only on answers given by the U.S. Dept. of Commerce, Bureau of Industry and Security in written form.
I cannot reconsider why publishing C-code in a PDF is legal, while posting the 3 lines of java code in the forum is not. It matters, if I copy&paste the code from the PDF-viewer or HTML-browser. And it does not concern a cheap copyright infringement, but "exporting technology concerning warfare".
I had published a Matlab implementation of 128-bit AES encryption in the FileExchange. After it could be downloaded for 2 years and was a pick of the week, MathWorks removed it to avoid serious troubles. I'm still allowed to use my function and share it on servers outside the USA. If I limit the key length to 56 bit, posting it as code would be legal again - although any Matlab programmer could remove the artificial limit easily by editing the source code. Nevertheless, it is possible that I'm being accused to support terrorism.
You need a lawyer, who discusses your problem with the U.S. Dept. of Commerce, Bureau of Industry and Security and with the corresponding bureau in your own country. Your problem is beyond the topic of this forum.
  2 Comments
Walter Roberson
Walter Roberson on 24 Jan 2018
It is not the DHS that is responsible, it is the Bureau of Industry and Security, of the US Department of Commerce.
Jan
Jan on 24 Jan 2018
Thanks for the clarification, Walter. I've fixed it.

Sign in to comment.

Categories

Find more on Encryption / Cryptography in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!