?
Solved

REGEX - simple encrypt, FAST decrypt

Posted on 2005-03-10
22
Medium Priority
?
1,316 Views
Last Modified: 2008-03-03
Am looking for original creative REGEX ideas on how to do a SIMPLE regex encrypt and FAST decrypt.

All web hits return long complicated algorithms -- need something extremely fast to decrypt data on the fly.

number string = "1234567890"
text string = "The text may be a lot longer than the numbers characters, so the numberstring has to repeat"
test string = "or short"

Want to encrypt the text string against the number string, fielding overflow and underflow of either/both.

Number string can be pre-pack to a single numeric value, if necessary, but the key here is speed of decryption.

PGP or anything like it is not needed.  Just want to render data hard to discover, but fast to recover.

Am thinking a ONE-LINER here!  Please, no complicated routines, and please explain what your 1-liner does?
0
Comment
Question by:sciwriter
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
22 Comments
 
LVL 23

Author Comment

by:sciwriter
ID: 13511828
Forgot to mention, inpage javascript will do the on-fly decryption, in case it matters...
0
 
LVL 48

Expert Comment

by:Tintin
ID: 13512220
Perhaps Crypt::Tea might be useful for you.  It is lightweight and has Javascript support.

See http://search.cpan.org/~pjb/Crypt-Tea-2.09/Tea.pm
0
 
LVL 23

Author Comment

by:sciwriter
ID: 13512414
Nope already looked at that and just about everything else, as stated.
No links please.  Want original ideas.  Thx
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 84

Expert Comment

by:ozo
ID: 13512679
What did you find unsuitable about Crypt::Tea that would need to be fixed with an original idea?
0
 
LVL 23

Author Comment

by:sciwriter
ID: 13512751
ozo -- I will answer that as long as my thread does not turn into a TEA discussion, ok?

1.  inflexible 128 bit perassigned key -- not variable encryption
2.  too complicated to decrypt on fly and too long
3.  cannot hide-recover key with JS adequately
4.  known and classic key approach to problem.

SO moving right along, that is not at all what I want.  I can already en/decode with JS, but it is too obvious.

Regex can be a great way to obfuscate and compress text strings, with bitwise encoding, packing and a host of other innovative ideas.  I'm no regex-pert, which is why I came to you guys to scratch the gray matter, think out of the box, do something different, bit pack, pack and encode, compress, whatever you can dream of?  This Q is something to think about, see what you regexperts can come up with -- a brainstorm, no?
0
 
LVL 23

Author Comment

by:sciwriter
ID: 13521971
Lunchy -- as I stated above, I was looking for some productive input for Regex and have not received any.  Will put this on another TA where I will get more input, hopefully.
0
 
LVL 23

Author Comment

by:sciwriter
ID: 13525947
<<would apply to any solution that could be implemented in Javascript by the browser>>

Nonsense.
 
Refunded points are not relevant to another expert.  Original input was, but apparently, I asked this Q in the wrong TA.  Am surprised that there are no original ideas here ....

BTW, FYI, There are much better links to TEA than the one given, which I had already gone over long before asking this question.  It is simply not relevant to what I was looking for -- Line 1, original Q, and 3:38 pm and 4:20 pm comments cover that issue sufficiently.  Clearly, you don't understand the question.

Anyway, I'm outa here.  Bye, Lunchy, hope all is going well for you since we last spoke.  Best, Sci.

0
 
LVL 84

Expert Comment

by:ozo
ID: 13526309
A regex finds matches, it does not encrypt.  A regex based substitiution could be used for transposition and substitution cyphers, but tranposition and substitution cyphers alone won't make a very secure encryption, nor would a regex be the fastest way to implement such transforms.

Original encryption ideas are rare, good ones are extremely rare, and not likely to be discussed in a public forum.

$number = "1234567890";
$text = "The text may be a lot longer than the numbers characters, so the numberstring has to repeat";
$text ^= "".substr($number x (1+(length$text)/length$number),-length $text);
Would be a trvial, fast, reversable, insecure, one liner using repetitions of $number to encrypt that does not use any regex.
You could add various pack or tr operations to furthur obscure, but it would remain an insecure encryption, with still not much use for any regex.
something like
$text =~ s/(..?)/$encrypt_table{$1}/sg;
could be a way to make use of a regex, but it would be %encrypt_table doing all the work, and it doesn't make use of $number
0
 
LVL 23

Author Comment

by:sciwriter
ID: 13526342
<< it doesn't make use of $number >>

Yep, that's exactly what I asked to be done, and it is not done.

However, ozo, just to get this unproductive thread off my back, I am giving you the points here, NOT because you answered the question -- but because at least you TRIED to give some Regex ideas.

Holy moley, you would think it was pulling teeth to ask people to "think outside the box" !!

Thanks ozo, for at least trying.  This Q is done, and I'm gone.

Future viewers, let it be known, the Q was nowhere near answered in this thread.
0
 
LVL 84

Expert Comment

by:ozo
ID: 13527755
As we tried to explain, a regex is not the best tool for this task.
0
 
LVL 23

Author Comment

by:sciwriter
ID: 13529923
<< no excuse to be insulting and unprofessional in the Perl TA >>

I am being nothing of the sort.  I ask for regex help in a TA where MOST regex Qs seem to go -- my requests were VERY clear and specific -- you need to re-read how clear and specific I was.  What I get is NO regex help at all -- and then you jump in with this ego attitude that I don't understand the use of regex, and that a Tea methodology would apply to ANY javascript solution.  THAT, jmcq, IS insulting, and it is "nonsense" as I  know better than that ... perhaps you should read a person's question better.  

If you have no valuable solution to input, I don't think you have ANY right whatsover to snipe at me, trying to make a case that I am rude to people on questions.  I DO know how EE works, very well -- a person who asks a question should EXPECT people to provide input relevant to the question.  They have the right to assign points to anyone who DOES in fact give input relevant to the question.  Ozo was the only one who did.

All other comments in this thread, except Ozo's 2:37 pm comment, especially yours, are irrelevant to the question.  If you, as an Admin, cannot personally remove your own ego from this and look at the question and its disposition OBJECTIVELY, then you are not fulfilling the duties of EE -- which is, bottom line, to provide people solutions to their questions, with ONLY relevant input.  That is the bottom line.

What you do with this Q is irrelevant to me.  I got no real help with the Q, but ozo tried.  If you were able to be truly objective about this, you would see I am right -- your criticism of me was totally unjustified in the community thread you posted, it's just being petty and sniping.  And as ADMIN, looking back over this thread here, objectively, ALL off topic comments should be removed.

The only way to equitably resolve this, as I see it, is to remove your sniping Q in CS, remove all the offtopic comments in this thread -- and STICK to the EE rules about relevant input in your TA area. Any less, and you are not following the rules, you are just using your offended attitude to snipe at a quick, sharp, VERY busy, and valuable contributer to EE.  What a waste of time this thread has been.

 So ... this will be my last time in perl -- thanks for being so so hospitable to a first-time visitor.
0
 
LVL 23

Author Comment

by:sciwriter
ID: 13536512
sorry to barge in here, gentlemen -- but ozo said --

<< A regex finds matches, it does not encrypt.>>

That, I think, was good focus -- it didn't answer the Q, but it was fair focus for his perspective (advice) -- and that is what EE is all about.  

If you think it deserves an "A", go ahead, that's fine, if you want to delete it, go ahead, that is fine too.  My point was simply this -- I asked a specific question, which was not answered.

What can be clearer than that????

<<  but I seem to be part of the problem here >>

No, you just made a rather cutting statement that grated on my JS knowledge, that there was essentially no other JS solution, and I know that to be wrong.  Then you followed it up with sniping at me in CS.  You are welcome to repair it all, jmcg, by doing what most ADMINS do --

>> delete all irrelevant comments and leave it without them, change grade to A if you like.

Everything past my 4.20 comment to OZO is irrelevant, except his 2.37 comment that I gave points to.  Everything else should go, no?

I think jmcg, to backtrack a little -- the question I asked is an important one, that no one took really seriously (of course, they are not under any obligation to take it seriously, or even reply for that matter, as you well know).

I happen to disagree with you all -- I think Regex is a powerful tool as a COMPONENT in an encryption system, and that is what I was exploring.

So let's get over this messed up Q and I will ask a similar one in another thread.  You be the one to decide the Q's disposition -- and you have my blessing.

BYE !!!
0
 
LVL 84

Expert Comment

by:ozo
ID: 13536807
As a COMPONENT in an encryption system, the regex qr// might be useful in separating the characters of a string so you can then use list operations instead of string operations.  e.g.
  @text = split//,$text;
But that did not appear to be what you were asking.


0
 
LVL 23

Author Comment

by:sciwriter
ID: 13537040
<< PGP or anything like it is not needed.  Just want to render data hard to discover, but fast to recover.
Am thinking a ONE-LINER here!  Please, no complicated routines >>

<< Am looking for original creative REGEX ideas>>
<<SO moving right along, ...  Regex can be a great way to obfuscate and compress text strings>>

I don't think anyone really read the Q or gave it the thought it warranted ....

That't exactly why I will be asking it elsewhere.

Since I cannot "opt out" of this Q, and I am WAY to busy to waste any more time on something so unproductive as this, it needs to be closed.

0
 
LVL 2

Accepted Solution

by:
Lunchy earned 0 total points
ID: 13537064
Closed, 0 points refunded.
Lunchy
Friendly Neighbourhood Community Support Admin
0
 
LVL 23

Author Comment

by:sciwriter
ID: 13537187
Many thanks, Lunchy
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question