Encryption algorithm that returns only lowercase encrypted string

O

Optimus

I would like to know if there is a encryption algorithm that returns
only lowercase encrypted string.

Thanks in advance.
 
N

Nicholas Paldino [.NET/C# MVP]

What you could do is take the encrypted bytes (using any encryption
algorithm) and then manually convert them to a base 26 representation (or a
base 36 if you are going to allow numbers) and then use all lowercase
letters in that scenario.

I have to ask though, why do you want to do such a thing?
 
R

rossum

I would like to know if there is a encryption algorithm that returns
only lowercase encrypted string.

Thanks in advance.
No modern algorithm does this, though many classical algorithms will
do so: Ceasar, Playfair, Vigenere etc. These depend on the plaintext
only having letters, no digits.

What may be of more use to you is an encoding such as Base32 which
only uses letters of a single case, though it also includes digits.
See RFC 4648 (http://tools.ietf.org/html/rfc4648) for details.
Encrypt using a modern algorithm (AES/Rijndael) and Base32 encode the
resulting byte stream.

If you really do need just lowercase letters, no digits, then you
could do something like encode the cyphertext as hex and then use a
single letter substitution for the digits: 0 -> m, 1 -> n etc. You
would have to write this yourself.

rossum
 
J

JR

Base-26

JR

rossum said:
No modern algorithm does this, though many classical algorithms will
do so: Ceasar, Playfair, Vigenere etc. These depend on the plaintext
only having letters, no digits.

What may be of more use to you is an encoding such as Base32 which
only uses letters of a single case, though it also includes digits.
See RFC 4648 (http://tools.ietf.org/html/rfc4648) for details.
Encrypt using a modern algorithm (AES/Rijndael) and Base32 encode the
resulting byte stream.

If you really do need just lowercase letters, no digits, then you
could do something like encode the cyphertext as hex and then use a
single letter substitution for the digits: 0 -> m, 1 -> n etc. You
would have to write this yourself.

rossum
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

rossum said:
What may be of more use to you is an encoding such as Base32 which
only uses letters of a single case, though it also includes digits.

I happen to have a Base32 implementing in C# if someone
is interested.

Arne
 
J

Jon Skeet [C# MVP]

JR said:
Easy is one thing, meeting the requirement is another.

I prefer the latter.

Base16 accomplishes both, of course...

Base32 was certainly worth mentioning, as it's quite possible that the
OP can deal with digits.
 
J

JR

Actually, a common variation uses digits and letters but with confusing
characters being equivalent - such as zero and o - and ignoring case.

JR
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

JR said:
Easy is one thing, meeting the requirement is another.

I prefer the latter.

So are you claiming that no power of 2 base can meet
requirements ?

Arne
 
J

JR

It depends.

If the requirement is to produce only lower case letters, there are 26 of
them in English. If you also allow the digits you have 36. If you then
disallow four letters, say l, o, s and i, you have 32.

JR
 
J

Jon Skeet [C# MVP]

JR said:
It depends.

If the requirement is to produce only lower case letters, there are 26 of
them in English. If you also allow the digits you have 36. If you then
disallow four letters, say l, o, s and i, you have 32.

The requirement can certainly be met using just base 16. Just because
you're restricted to lower-case letters doesn't imply that you have to
use all of them.

Heck, you could encode the data in binary, as "l" and "o" for "1" and
"0".
 
R

rossum

Actually, a common variation uses digits and letters but with confusing
characters being equivalent - such as zero and o - and ignoring case.

JR
That is the Base32 that I mentioned, letters a to z and digits 2 to 7.

rossum
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

JR said:
It depends.

If the requirement is to produce only lower case letters, there are 26 of
them in English. If you also allow the digits you have 36. If you then
disallow four letters, say l, o, s and i, you have 32.

Jon Skeet has already posted the fact that 2^4 <= 26 twice !

So no - it does not depend.

Arne
 
K

Ken P

I actually have this requirnment as well. We are encrypting our URL
using TripDES and its case sensitive alphanumberic string. Now seems
there are email scanning tools that rewrite URLs to all lower case. I
have verified an email that is being sent to an AOL user is the proper
case - when it comes back to us the URL is all lower case. According to
the return headers the email is getting realyed through some
spamscanner.test.aol.com.

I think this method will work..
http://www.eggheadcafe.com/articles/20060427.asp - being this is NOT
encryption rather obfuscation - which is fine for us.. but this
combination of HEX encoding should work fine - I need to test.. but I
should be able to do an upper on the string if it is converted to
lowercase and be off and running.
 
J

Jon Skeet [C# MVP]

Ken P said:
I actually have this requirnment as well. We are encrypting our URL
using TripDES and its case sensitive alphanumberic string. Now seems
there are email scanning tools that rewrite URLs to all lower case.

Really? That's appalling, given that although email addresses shouldn't
be treated case-sensitively, URLs *definitely* can.
I have verified an email that is being sent to an AOL user is the proper
case - when it comes back to us the URL is all lower case. According to
the return headers the email is getting realyed through some
spamscanner.test.aol.com.

Ah... why am I not terribly surprised? ;)
I think this method will work..
http://www.eggheadcafe.com/articles/20060427.asp - being this is NOT
encryption rather obfuscation - which is fine for us.. but this
combination of HEX encoding should work fine - I need to test.. but I
should be able to do an upper on the string if it is converted to
lowercase and be off and running.

Surely TripleDES has given you a byte array, in which case just "hex-
encoding" that would be simpler, wouldn't it?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top