Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Possible?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Lorrenzo
Moderator
Reputation: 4

Joined: 02 Jun 2006
Posts: 3744

PostPosted: Wed Aug 22, 2007 1:23 pm    Post subject: Possible? Reply with quote

Ok, so I wanted to make a program that when you type a word or phrase into the box and hit a button so it puts a different or you could say "secret" word into a different box, or the other way around so others can understand. Kinda like an Encryption?

I wanted to do it with this layout (delphi)



I want it to do like if you type in the word "hello" in editbox1 and you hit the button it comes out as something like "juthty" or w/e in editbox2.

Then in editbox3 someone could put in "juthty" then pressing the button to get the word "hello" in editbox4.

Is it possible or no, and if so can I get some tips on how to do it?

_________________
LAWLrrenzolicious
Back to top
View user's profile Send private message
zart
Master Cheater
Reputation: 0

Joined: 20 Aug 2007
Posts: 351
Location: russia

PostPosted: Wed Aug 22, 2007 1:29 pm    Post subject: Reply with quote

of course it's possible... just choose a cypher --

example - caesar shift then using an array

caesar cipher

_________________
0x7A 0x61 0x72 0x74

TEAM RESURRECTiON
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Wed Aug 22, 2007 1:40 pm    Post subject: Reply with quote

if Edit1.Text = 'hello' then Edit2.Text := 'juthty';
if Edit3.Text = 'juthty' then Edit4.Text := 'hello';
Back to top
View user's profile Send private message
zart
Master Cheater
Reputation: 0

Joined: 20 Aug 2007
Posts: 351
Location: russia

PostPosted: Wed Aug 22, 2007 1:42 pm    Post subject: Reply with quote

Symbol wrote:
if Edit1.Text = 'hello' then Edit2.Text := 'juthty';
if Edit3.Text = 'juthty' then Edit4.Text := 'hello';


I think he wants to be able to (basicly) hash them, so he can enter in anything, get a jumble, then enter in the jumble and get the phrase back...

_________________
0x7A 0x61 0x72 0x74

TEAM RESURRECTiON
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Wed Aug 22, 2007 1:50 pm    Post subject: Reply with quote

oh he wants to encrypt and decrypt....
u can change strings and then change them back umm dont remember how i think StrReplace or something altough u can use "Replace" even in a notepad, but that will take a while ^_^
ill search for u if ill find ill edit my post

edit: the magic of google:

Code:
var
  before, after : string;

begin
  // Try to replace all occurrences of a or A to THE
  before := 'This is a way to live A big life'; //Message 1

  after  := StringReplace(before, ' a ', ' THE ', //Message 2
                          [rfReplaceAll, rfIgnoreCase]); //Replace all, ignores a and A, will replace both
  ShowMessage('Before = '+before); //Normal
  ShowMessage('After  = '+after); //Changed :D
end;


just change to editX.text insetad
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Wed Aug 22, 2007 3:22 pm    Post subject: Reply with quote

Lol, I suggest you make your encryption a little better. I wouldn't even call that encryption(@ symbol). You could do a simple xor encryption.

Delphi XOR Encryption

Code:

function XOR_encryption(const InStr, KeyStr : string) : string;
  var C1, C2 : integer;
      OutStr : string;
      Ch1, Ch2 : byte;
  begin
    //First initialise the counters to zero
    C1 := 0;
    C2 := 0;
    //initialise the returning string to an empty string
    OutStr := '';
    //We want to loop for as many characters in the Input String
    while (C1 < Length(InStr)) do
      begin
      //first of all, increment the both counters
      inc(C1);
      inc(C2);
      //if the second counter is greater than the length of the
      //Key String, then set ot back to 1
      if (C2 > Length(KeyStr)) then
        C2 := 1;
      //get the byte value of the character at the current position
      //of the Input String
      Ch1 := Ord(InStr[C1]);
      //get the byte value of the character at the current position
      //of the Key String. To ensure we do not get any NULL
      //characters during encryption, we add 128 to this value
      Ch2 := Ord(KeyStr[C2]) + 128;
      //Add the XOR'd value of the current Input String position
      //and the current Key String position to the end of the
      //returning string
      OutStr := OutStr + Chr(Ch1 xor Ch2);
    end;
    //return the encrypted/decrypted string
    Result := OutStr;
  end;


Delphi XOR Decryption

Code:

procedure TForm1.Button1Click(Sender: TObject);
var i,j:longword;
    thistime,lasttime:longword;
    buffer:array[0..7]of byte;
    b:array[0..1]of longword absolute buffer[0];
    plaintext:array[0..7]of byte;
    p:array[0..1]of longword absolute plaintext[0];
    key:array[0..7]of byte;
    k:array[0..1]of longword absolute key[0];
begin
   lasttime:=gettickcount;
   randomize;
   if length(edit1.text)<8 then exit;
   for i:=0 to 7 do
   begin
      plaintext[i]:=byte(edit1.text[i+1]);
      buffer[i]:=plaintext[i] xor random(256);//encrypt
   end;
   i:=0;
   repeat
      for j:=0 to 1000000 do //loop is unrolled by compiler
      begin
         randseed:=i;
         key[0]:=random(256);
         key[1]:=random(256);
         key[2]:=random(256);
         key[3]:=random(256);
         key[4]:=random(256);
         key[5]:=random(256);
         key[6]:=random(256);
         key[7]:=random(256);
         if b[0] xor k[0]=p[0] then //test key in blocks of 4
         if b[1] xor k[1]=p[1] then
         begin
            thistime:=gettickcount;
            caption:='The key is: '+inttostr(i)+' ('+
               inttostr((thistime-lasttime)div 1000)+'sec)';
            Exit;
         end;
         inc(i,1);
      end;
      caption:=inttostr(i);
      application.processmessages;
   until i>longword(MaxInt);

end;


C++ Delphi Encryption

Code:

#include <iostream.h>
int main()
{
  char string[11]="A nice cat";
  char key[11]="ABCDEFGHIJ";
  for(int x=0; x<10; x++)
  {
    string[x]=string[x]^key[x];
    cout<<string[x];
  }
  return 0;
}


Sorry for people with C++. I couldn't find a decryption code on google. But if you understand xor encryption, you'll probably be able to decrypt it. Btw, you probably will know how to use input and output on the encryption code for C++ instead of the programmers choice.

_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Xanatos
I post too much
Warning
Reputation: 18

Joined: 06 May 2007
Posts: 2559
Location: US

PostPosted: Wed Aug 22, 2007 3:34 pm    Post subject: Reply with quote

Here is the entire thing in Java, it had two text edit boxes and when you type in one, it automatically changes it to a * and when you click the button it will appear in the second text edit as it should be.

Again, its in java Neutral.

Code:

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class MyPassword extends JFrame implements ActionListener
{
   JPasswordField passwordBox = new JPasswordField("",10);
   JTextField revealedBox = new JTextField("",10);

   JButton b1 = new JButton("Reveal");



   public MyPassword(String title)
   {

      super(title);
      setDefaultCloseOperation(EXIT_ON_CLOSE);

      Container c = this.getContentPane();
      c.setLayout(new FlowLayout());

      c.add(passwordBox);
      c.add(revealedBox);
      c.add(b1);

      passwordBox.requestFocus();
      passwordBox.setEchoChar('*');

      b1.addActionListener(this);

   }//constructor




   public static void main(String args[])
   {

      MyPassword mp = new MyPassword("Password Tester");

      mp.setSize(400,150);
      mp.setVisible(true);

   }//init()



   public void actionPerformed(ActionEvent e)
   {
      //the getText() method has been deprecated for JPasswordField
       String p = String.valueOf(passwordBox.getPassword());

       revealedBox.setText(p);
    }


}//class

_________________
Back to top
View user's profile Send private message
TheIndianGuy
Advanced Cheater
Reputation: 102

Joined: 14 Jan 2007
Posts: 88

PostPosted: Sat Aug 25, 2007 10:17 pm    Post subject: Reply with quote

zart wrote:
of course it's possible... just choose a cypher --

example - caesar shift then using an array

caesar cipher


yeah i made one of these in vb
Back to top
View user's profile Send private message
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Tue Aug 28, 2007 5:29 pm    Post subject: Reply with quote

C#:

Code:

public string Encryptor(string toEncrypt)
{
          string Encrypted = "";
          char tmp = ""; //I think that's how you might do it
          foreach (char c in toEncrypt.ToCharArray())
          {
                      tmp = c - 8; //Some number
                      Encrypted += tmp;
          }
           return Encrypted;
}

public string Decryptor(string toDecrypt)
{
           string Decrypted = "";
           char tmp = "";
           foreach (char c in toDecrypt.ToCharArray())
           {
                      tmp = c + 8; //The same number from before
                      Decrypted += tmp;
           }
           return Decrypted;
}


you could implement this:

Code:

public void Encrypt_Click(object sender, EventArgs e)
{ //This is a button click thing
          EncryptedTextBox.Text = Encrypt(ToEncryptTextBox.Text);
}

public void Decrypt_Click(object sender, EventArgs e)
{
          DecryptedTextBox.Text = Decrypt(ToDecryptTextBox.Text);
}


I'm not too sure about Delphi... I don't know how to make a function, but you should do that, and make it require a string to be passed in. Then, instead of the foreach loops that I have, you should do

Code:

for i := 1 to STRINGNAMEHERE.Length
begin
:
:
end;
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites