| View previous topic :: View next topic |
| Author |
Message |
Lorrenzo Moderator
Reputation: 4
Joined: 02 Jun 2006 Posts: 3744
|
|
| Back to top |
|
 |
zart Master Cheater
Reputation: 0
Joined: 20 Aug 2007 Posts: 351 Location: russia
|
Posted: Wed Aug 22, 2007 1:29 pm Post subject: |
|
|
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 |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Wed Aug 22, 2007 1:40 pm Post subject: |
|
|
if Edit1.Text = 'hello' then Edit2.Text := 'juthty';
if Edit3.Text = 'juthty' then Edit4.Text := 'hello';
|
|
| Back to top |
|
 |
zart Master Cheater
Reputation: 0
Joined: 20 Aug 2007 Posts: 351 Location: russia
|
Posted: Wed Aug 22, 2007 1:42 pm Post subject: |
|
|
| 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 |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Wed Aug 22, 2007 1:50 pm Post subject: |
|
|
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 |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Wed Aug 22, 2007 3:22 pm Post subject: |
|
|
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 |
|
 |
Xanatos I post too much
Reputation: 18
Joined: 06 May 2007 Posts: 2559 Location: US
|
Posted: Wed Aug 22, 2007 3:34 pm Post subject: |
|
|
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 .
| 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 |
|
 |
TheIndianGuy Advanced Cheater
Reputation: 102
Joined: 14 Jan 2007 Posts: 88
|
Posted: Sat Aug 25, 2007 10:17 pm Post subject: |
|
|
| 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 |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Tue Aug 28, 2007 5:29 pm Post subject: |
|
|
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 |
|
 |
|