0
$\begingroup$

I am looking for an algorithm/procedure that encrypts a text where the alphanumeric data is encrypted into password-protected alphanumeric data.

I have seen other algorithms where a text like "Hello, How are you?" will be encrypted into something like this: JHo+8D337H/hLwg9n2n2n8+du783bsH9hdsSEWj93==

This is not what I am after.

I am looking for something that does this: "Hello, How are you?" will be encrypted into "Kjehh, Jey uwh wmd?"

Any idea how to do that?

$\endgroup$
  • 5
    $\begingroup$ Do you want it secure (in the sense of preserving secrecy) within preserving capitalization and everything that is not a letter (including space, punctuation, perhaps digits)? That would be easy with FPE. You'd also need to chose between preserving length, and being such that the same plaintext always produce the same ciphertext, which can be a weakness. $\endgroup$ – fgrieu May 29 '17 at 5:48
  • $\begingroup$ You realise that by preserving punctuation /capitalisation /white space you're exposing vast amounts of information? Proper nouns (ie. names) are capitalised, and the question mark kinda suggests a question was posed. Frequency /syntactical analysis will kill your system. Do you have a very very good reason to maintain format or is this your only knowledge of encryption (which is fine)? $\endgroup$ – Paul Uszak May 29 '17 at 14:50
  • $\begingroup$ The philosophers amongst us might differ, but I think that your example is not encryption per se, but rather base64 encoding. $\endgroup$ – Paul Uszak May 29 '17 at 14:52
3
$\begingroup$

I would suggest using a classical cipher like Vigenère, for example:

Plaintext:  Hello, How are you?
Key:        topsecret
Ciphertext: Asads, Jfa tks ngy?

But bear in mind that classical encryption techniques are very insecure by modern standards.

|improve this answer|||||
$\endgroup$
  • $\begingroup$ How easy is it to be encrypted without the key? $\endgroup$ – asmgx May 29 '17 at 6:05
  • $\begingroup$ @asmgx (I assume you mean "how easy is it to decrypt without the key?") If the key is the same length as the plaintext, then in theory it's impossible provided the key is only used once. However, you're still leaking information by preserving spaces and punctuation, so it might be possible to guess the content of a message even without a key. $\endgroup$ – r3mainer May 29 '17 at 6:11
  • $\begingroup$ @squeamish ossifrage: for Vigenère to be fully secure, one needs (in addition to what's stated in the above comment) that each character of the key is chosen randomly and independently, which does not look like the case for topsecretin the answer. $\endgroup$ – fgrieu May 29 '17 at 7:04
  • 1
    $\begingroup$ @fgrieu topsecret is just an example. it's oviously not intended to be secure, just for understanding. $\endgroup$ – Aemyl May 29 '17 at 8:20
  • 2
    $\begingroup$ @Aemyl Actually, the answer doesn't refer to perfect secrecy at all. The comment about it just missed to note that perfect secrecy can only be achieved if a truly random and independently chosen key is used. That is not optional if perfect secrecy is the goal. The answer itself correctly stated that Vigenere offers almost no security from today's point of view. $\endgroup$ – tylo May 29 '17 at 8:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.