| View previous topic :: View next topic |
| Author |
Message |
merkark12 Advanced Cheater
Reputation: 0
Joined: 04 Jul 2007 Posts: 74 Location: In that program you just downloaded
|
Posted: Fri Jul 20, 2007 2:37 pm Post subject: [Delphi Question]Making a string Changer? |
|
|
sorry about the questions but, how do you make a string changer? such as if someone input 'Example' it would change the characters to be different letters, or they would be numbers like 'e' would be 5? _________________
|
|
| Back to top |
|
 |
Reak I post too much
Reputation: 0
Joined: 15 May 2007 Posts: 3496
|
Posted: Fri Jul 20, 2007 3:28 pm Post subject: |
|
|
| Sorry but I dont get it, explain lil more please. |
|
| Back to top |
|
 |
magicalimp Expert Cheater
Reputation: 0
Joined: 03 Dec 2006 Posts: 105
|
Posted: Fri Jul 20, 2007 3:52 pm Post subject: |
|
|
Parse through the string using a for statement and the StrLen() function
Change characters accordingly. |
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Fri Jul 20, 2007 4:25 pm Post subject: |
|
|
I think I know what he means. Let me give an example.
So then there are two memoboxes or edit boxes or w/e. If someone were to input the word 'Example' it would change to 'e'. Or it could change to different numbers and if someone input 'e' it would change to 5. _________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Fri Jul 20, 2007 4:42 pm Post subject: |
|
|
i think he just wanna code files...
=\
like
This is a text on a notepad file - would be:
4g15 15 7 43$4 0y 7 y043i72 k1n3
and then u can code it back |
|
| Back to top |
|
 |
appalsap Moderator
Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Fri Jul 20, 2007 5:05 pm Post subject: |
|
|
a 'string' is an array of characters. that is, a pointer to an array of bytes that hold character representations in them. So, to change them, you would treat them as an array. ex:
| Code: |
const
blah = PChar('hello I am a string');
var
i : integer;
begin
WriteLn(blah); { Original }
for i := 0 to StrLen(blah) do
blah[i] := blah[i] or 2;
WriteLn(blah); { messed up }
end;
|
|
|
| Back to top |
|
 |
merkark12 Advanced Cheater
Reputation: 0
Joined: 04 Jul 2007 Posts: 74 Location: In that program you just downloaded
|
Posted: Fri Jul 20, 2007 7:45 pm Post subject: |
|
|
Ok i think appal and oib have my idea, but i cant understand appalslaps code ill just figure it out _________________
|
|
| Back to top |
|
 |
Trow Grandmaster Cheater
Reputation: 2
Joined: 17 Aug 2006 Posts: 957
|
Posted: Sat Jul 21, 2007 3:57 am Post subject: |
|
|
got "Replace" function in Delphi? or are VB programmers too lucky to start with... _________________
Get kidnapped often. |
|
| Back to top |
|
 |
Noz3001 I'm a spammer
Reputation: 26
Joined: 29 May 2006 Posts: 6220 Location: /dev/null
|
Posted: Sat Jul 21, 2007 3:59 am Post subject: |
|
|
| Can't you just use xor encryption? Easily crackable but just make a dynamic key. |
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Sat Jul 21, 2007 7:20 am Post subject: |
|
|
| Code: |
if AnsiPos('Cat', Edit1.Text) <> 0 then
Edit1.Text := StringReplace(Edit1.Text, 'Cat', 'c',
[rfReplaceAll, rfIgnoreCase])
else
Edit1.Text := '''Cat'' was not found.'
end;
|
I'll explain it in an edit if you want. _________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
Trow Grandmaster Cheater
Reputation: 2
Joined: 17 Aug 2006 Posts: 957
|
Posted: Sat Jul 21, 2007 7:40 am Post subject: |
|
|
so "StringReplace" exists afterall.. _________________
Get kidnapped often. |
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Sat Jul 21, 2007 7:41 am Post subject: |
|
|
Yeah, at first I was gonna use AnsiReplaceStr but I think it needs something in the uses list cuz I kept getting errors (yes I had the right syntax), and I didn't know which use so I just used StringReplace, both work. _________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
Noz3001 I'm a spammer
Reputation: 26
Joined: 29 May 2006 Posts: 6220 Location: /dev/null
|
Posted: Sat Jul 21, 2007 9:18 am Post subject: |
|
|
Well, i don't know Delphi so I had to steal this, but heres and example of xor encryption:
| Code: | const
c1 = 52845;
c2 = 22719;
function Encrypt (const s: string; Key: Word) : string;
var
i : byte;
ResultStr : string;
begin
Result:=s;
{Result[0] := s[0]; }
for i := 0 to (length (s)) do
begin
Result[i] := Char (byte (s[i]) xor (Key shr 8));
Key := (byte (Result[i]) + Key) * c1 + c2
end
end;
function Decrypt (const s: string; Key: Word) : string;
var
i : byte;
begin
{Result[0] := s[0];}
Result:=s;
for i := 0 to (length (s)) do
begin
Result[i] := Char (byte (s[i]) xor (Key shr 8));
Key := (byte (s[i]) + Key) * c1 + c2
end
end; |
Set your key and pass it as the second param |
|
| Back to top |
|
 |
|