REGEX - simple encrypt, FAST decrypt

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?
LVL 23
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sciwriterAuthor Commented:
Forgot to mention, inpage javascript will do the on-fly decryption, in case it matters...
Perhaps Crypt::Tea might be useful for you.  It is lightweight and has Javascript support.

sciwriterAuthor Commented:
Nope already looked at that and just about everything else, as stated.
No links please.  Want original ideas.  Thx
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

What did you find unsuitable about Crypt::Tea that would need to be fixed with an original idea?
sciwriterAuthor Commented:
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?
sciwriterAuthor Commented:
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.
sciwriterAuthor Commented:
<<would apply to any solution that could be implemented in Javascript by the browser>>

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.

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
sciwriterAuthor Commented:
<< 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.
As we tried to explain, a regex is not the best tool for this task.
sciwriterAuthor Commented:
<< 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.
sciwriterAuthor Commented:
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 !!!
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.

sciwriterAuthor Commented:
<< 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.

Closed, 0 points refunded.
Friendly Neighbourhood Community Support Admin

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sciwriterAuthor Commented:
Many thanks, Lunchy
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.