Solved

Crypto Letters and Numbers

Posted on 2012-03-30
4
360 Views
Last Modified: 2012-03-30
hello
I would like to know how to change the encryption algorithm below for it to return only letters and numbers?

function EncryptDecrypt(InpStr, PassPhrase: string; Salt: Integer): string;
var
  iIndex: Integer;
  pIndex: Integer;
begin
  pIndex := 1;

  for iIndex := 1 to Length(InpStr) do
  begin
      InpStr[iIndex] := Chr(Salt XOR Ord(PassPhrase[pIndex]) XOR Ord(InpStr[iIndex]));
      Inc(Salt);
      Inc(pIndex);

      if (pIndex > Length(PassPhrase)) then
         pIndex := 1;
  end;

  Result := InpStr;
end;

Open in new window



thanks
Wagner
0
Comment
Question by:wagnerlimalopes
[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
4 Comments
 
LVL 19

Expert Comment

by:Thommy
ID: 37787229
If you change encryption, you will have to change decryption, too!!!
0
 

Author Comment

by:wagnerlimalopes
ID: 37787363
even having to separate the encryption and decryption codes, what is the solution?

wagner
0
 
LVL 27

Assisted Solution

by:Sinisa Vuk
Sinisa Vuk earned 250 total points
ID: 37787405
Do simple base64 encode after you do encrypt and base64 decode before you do decrypt.

http://www.swissdelphicenter.ch/torry/showcode.php?id=1524

http://www.delphipraxis.net/991-base64-mime-en-decoding.html
0
 
LVL 23

Accepted Solution

by:
Ferruccio Accalai earned 250 total points
ID: 37787440
Thommy, sometimes I don't understand your comments.
The function posted by him recursively crypts or decrypts a string giving a pass string and a salt.
@wagnerlimalopes: what is the solution?
I guess there's not solution for what you're asking, using this kind of function, as any parameter you pass could be so variable that it could result in at least one non standard alphanumeric character
To get what you need you should use another kind of encryption/decryption script, or insert some other code to force the range of any character into the alphanumeric range
0

Featured Post

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.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month7 days, 8 hours left to enroll

632 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