Overclock.net - Overclocking.net
     
 
Home Gallery Reviews Blogs Register Today's Posts Mark Forums Read Members List


Go Back   Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming

Reply
 
LinkBack Thread Tools
Old 05-07-07   #11 (permalink)
Bifford
 
BFRD's Avatar
 
intel nvidia

Join Date: Dec 2004
Location: Carrollton, TX
Posts: 4,139

FAQs Submitted: 8
Folding Team Rank: 16
Hardware Reviews: 2
Trader Rating: 11
Default

Here is my application. It requires the .NET framework v2. It is very basic, and a little flawed. Enter in a message and press "Encode." You will then have a quasi-secret message that you can send to a friend. All they need to know is what setting you used to encode the message (using the slider at the bottom). Trial and error will of course get you to the appropriate value. This is entended to mostly show the weaknesses of shift encoding. I think when this challenge ends, we will try something more sophisticated.
Attached Files
File Type: zip Encoder.zip (87.7 KB, 16 views)
__________________
Helpful Posts (Hopefully )
Overclocker's Calculator
Photo Editing - B&W w/Color Accents

System: Main Rig
CPU
E6700 Conroe
Motherboard
Abit QuadGT
Memory
2GB G.Skill PC2 8000 (HZ)
Graphics Card
EVGA 8800GTX
Hard Drive
150 GB Raptor X / 300GB Storage
Sound Card
Audigy 2 ZS
Power Supply
PCP&C Silencer 750
Case
Sigma Shark
CPU cooling
Stock (for now)
GPU cooling
Stock
OS
Vista Ultimate
Monitor
Dual Samsung 204b

Last edited by BFRD : 05-19-07 at 08:06 AM.
BFRD is offline I fold for Overclock.net Overclocked Account BFRD's Gallery   Reply With Quote
Old 05-07-07   #12 (permalink)
Fear is the heart of Love
 
dangerousHobo's Avatar
 
amd nvidia

Join Date: Dec 2005
Location: ~/
Posts: 3,409

FAQs Submitted: 7
Folding Team Rank: 293
Trader Rating: 0
Default

Here's mine so far, I haven't been able to work on it for the past two days. Its a bit flawed too. I plan to work on it tonight and finish it.
To encode or decode you have to pass in a parameter when you run it.
Example:
Encode:
Code:
perl encode.pl -e
Decode:
Code:
perl encode.pl -d
Code:
#!/usr/bin/perl
use warnings;

#if the version of perl you are using is older than
#5.6, then get rid of the line "use warning;" and
#make the first line look like this: #!/usr/bin/perl -w

#array used for encoding and decoding
@code = ("A".."Z", "a".."z"," ",0..9);
$eString = "";
$index = 0;

#setting the shift
print "Enter shift => ";
chop($shift = <STDIN>);

if ($ARGV[0] =~ /[Ee]/) {
		
	print "Enter a word => ";
	#getting input and removing newline char.
	chop ($word = <STDIN>);
	
	$eString = &shifter ($word, '+');

	#writing encoded word to file
	open(OUTFILE, ">encode.txt");
	print OUTFILE ($eString."\n");
	close(OUTFILE);

} elsif ($ARGV[0] =~ /[Dd]/) {

	unless (open(INFILE, "encode.txt")){
		die("Cannot open the file encode.txt");
	}
	#reading line from file
	$word = <INFILE>;
	close(INFILE);
	
	$eString = &shifter ($word, '-');
	
	print $eString."\n";
} 

sub shifter {
	my ($word, $direction) = @_;
	
	#making the string to an array, w/ one char per index
	@wordA = split(//, $word);

	#generating the encoded string
	for (1..length($word)){
		for ($i = 0; $i < @code; ++$i){
 			if ($wordA[$index] eq $code[$i]){
				if($direction eq '+'){
					$eString .= $code[$i+$shift];
				} else {
					$eString .= $code[$i-$shift];
				}
			}
		}
		$index++;
	}
	return $eString;
}
__________________
"UNIX was never designed to keep people from doing stupid things, because that policy would also keep them from doing clever things." - Doug Gwyn

Try out the latest Programming Challenge
Quote:
Originally Posted by Melcar
Only one reasonable way to solve this... a dance off.

CPU-Z Validation
@ 2.97-prime95 stable 16 hours @ 1.48v Proof | CPU-Z Validation @ 3.15


Getting Mouse Side Buttons to work in Linux, Compile a custom Kernel, More

System: Anomaly
CPU
Athlon 3700 SD(KACAE)0546 @3.02ghz
Motherboard
DFI UT nF4 Ultra-D
Memory
G.Skill 2x512 UTT(BH-5)
Graphics Card
evga 6800gs
Hard Drive
Maxtor 300GB + WD 250GB
Sound Card
onboard
Power Supply
Ultra 500w V-series
Case
one from Ultra
CPU cooling
Big Typhoon
GPU cooling
80mm fan mounted on
OS
Arch Linux, Slackware 12.1
Monitor
Acer AL2216W 22" WS LCD

Last edited by dangerousHobo : 05-08-07 at 02:18 PM.
dangerousHobo is offline I fold for Overclock.net Overclocked Account dangerousHobo's Gallery   Reply With Quote
Old 05-14-07   #13 (permalink)
Kernel Sanders
 
rabidgnome229's Avatar
 
intel nvidia

Join Date: Feb 2006
Location: Pittsburgh
Posts: 4,897
Blog Entries: 1

Rep: 549 rabidgnome229 is becoming famousrabidgnome229 is becoming famousrabidgnome229 is becoming famousrabidgnome229 is becoming famousrabidgnome229 is becoming famousrabidgnome229 is becoming famous
Unique Rep: 327
FAQs Submitted: 6
Trader Rating: 5
Default

Let's see if I can write this in a reply message

Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void encode(char *p, int key)
{
   if(*p>='a'&&*p<='z')
   {
      if(*p+key>'z') *p=*p+key-'z'+'0';
      else *p=*p+key;
   }else if(*p>='A' && *p<='Z')
      if(*p+key>'Z') *p=*p+key-'Z'+'a';
      else *p=*p+key;
   }else if(*p>='0' && *p<='9')
      if(*p+key>'9') *p=*p+key-'9'+'A';
      else *p=*p+key;
   }
}

void decode(char *p, int key)
{
   if(*p>='a'&&*p<='z')
   {
      if(*p-key<'a') *p=*p-key-'a'+'Z';
      else *p=*p-key;
   }else if(*p>='A' && *p<='Z')
      if(*p+key<'A') *p=*p-key-'A'+'9';
      else *p=*p+key;
   }else if(*p>='0' && *p<='9')
      if(*p+key<'0') *p=*p-key-'0'+'z';
      else *p=*p+key;
   }
}
int main(int argc, char *argv[])
{
   int key=3; /* Default encoding/decoding key */
   char *string, *p1, mode;
   
   if(argc<3 || argv[1][0] != '-') {printf("Usage: %s [flag] [string]\nFlags: -e Encode [string]\n-d Decode [string]", argv[0]); exit(EXIT_FAILURE);

   mode=argv[1][1];

   if(argc==4) key=atoi(argv[3]);
   strcpy(string, argv[2]);
 
   for(p1=string; *p1; p1++)
      if(mode=='e') encode(p1, key);
      else if(mode=='d') decode(p1, key);
      else{printf("Invalid mode\n"); exit(EXIT_FAILURE);}

   printf("%s\n", string);
}
I wonder if that even compiles
__________________
BIG BROTHER
I put on my robe and wizard hat...

IS WATCHING

System: It goes to eleven
CPU
E6300
Motherboard
DS3
Memory
2GB XMS2 DDR2-800
Graphics Card
EVGA 8600GTS
Hard Drive
1.294 TB
Sound Card
Audigy 2 ZS
Power Supply
Corsair 520HX
Case
Lian-Li v1000B Plus
CPU cooling
TTBT
GPU cooling
Thermalright V2
OS
Arch Linux/XP
Monitor
Samsung 226bw
rabidgnome229 is offline Overclocked Account   Reply With Quote
Old 05-15-07   #14 (permalink)
AMD Overclocker
 
decompiled's Avatar
 
amd nvidia

Join Date: Feb 2006
Location: Redsox Nation
Posts: 356

Rep: 27 decompiled is acknowledged by some
Unique Rep: 26
Hardware Reviews: 9
Trader Rating: 0
Default

I was bored so I did one that included all ASCII. There might be bugs in it because I'm not testing every case.

Code:
#include <stdio.h>
#include <string.h>

int main()
{

  char mode;
  char c;
  char input[500];
  char output[500];
  int i = 0;
  int key;

  puts("Enter your message:");
  
  while( ( c = getchar() ) != '\n' )
  {
    input[i++] = c;
  }

  input[i] = '\0';

  printf("Do you want to [D]ecode or [E]ncode: ");
  scanf("%c", &mode);
  
  if ( mode == 'D' )
  {
    printf("Enter your key: ");
    scanf("%i", &key);
    /* Subtract key from each index. */
    int count = 0;
    int length = strlen(input);
    while( count <= length - 1 )
    {
      char temp = input[count];
      temp -= key;
      output[count] = temp;
      count++;
    }
    output[count] = '\0';
  }
  
  if ( mode == 'E' )
  {
    printf("Enter your key: ");
    scanf("%i", &key);
    /* Add key from each index */
    int length = strlen(input);
    int count = 0;
    while( count <= length )
    {
      char temp = input[count];
      temp += key;
      output[count] = temp;
      count++;  
    }
    output[count] = '\0';
  }

  puts("");   
  puts("Your input was:");
  puts(input);
  puts(""); 
  printf("Your key was: %i\n",key);
  puts("");
  puts("Your request has produced:");
  puts(output);

  return 0;
}

System: Slow Poke
CPU
AMD X2 4400
Motherboard
MSI K8N Diamond +
Memory
3gb TCC5
Graphics Card
eVGA 7900GS
Hard Drive
74gb Raptor + Raid 1 640's
Sound Card
Audigy SE
Power Supply
OCZ 520 PowerStream
Case
Antec P180
CPU cooling
Stock AMD
GPU cooling
Stock eVGA
OS
Vista x64
Monitor
Dell 1905FP
decompiled is offline   Reply With Quote
Old 05-19-07   #15 (permalink)
Bifford
 
BFRD's Avatar
 
intel nvidia

Join Date: Dec 2004
Location: Carrollton, TX
Posts: 4,139

FAQs Submitted: 8
Folding Team Rank: 16
Hardware Reviews: 2
Trader Rating: 11
Default

Ok. The encoder challenge is over. Stay tuned for the next installment. Thanks to everyone that participated.
__________________
Helpful Posts (Hopefully )
Overclocker's Calculator
Photo Editing - B&W w/Color Accents

System: Main Rig
CPU
E6700 Conroe
Motherboard
Abit QuadGT
Memory
2GB G.Skill PC2 8000 (HZ)
Graphics Card
EVGA 8800GTX
Hard Drive
150 GB Raptor X / 300GB Storage
Sound Card
Audigy 2 ZS
Power Supply
PCP&C Silencer 750
Case
Sigma Shark
CPU cooling
Stock (for now)
GPU cooling
Stock
OS
Vista Ultimate
Monitor
Dual Samsung 204b
BFRD is offline I fold for Overclock.net Overclocked Account BFRD's Gallery   Reply With Quote
Old 08-08-07   #16 (permalink)
Overclocker in Training
 
venar303's Avatar
 
intel ati

Join Date: Aug 2007
Location: NY
Posts: 96

Rep: 1 venar303 Unknown
Unique Rep: 1
Trader Rating: 0
Default Encryptify

Wow, this challenge is OLD! but hey, I'm new here so i don't really mind unearthing a dino!
Here's an encrypting program that is a bit simpler than bit shift, and more powerful as well!
http://uploader.polorix.net//files/594/encrypt7.exe

Tips
-change the string "key" to change how it's encrypted
-Notice how the decoding, is the same as encoding! It works backwards!
-The only encoding occurs in here, everything else is just getting input (poorly i admit)
while(x<= (count-2))
{
string[x]=string[x]^key[x]; ///XOR check on the binaries
cout<<string[x];
x++;
}



the code

#include <iostream.h>
#include <stdio.h>
#include <string.h> //provides strcat() --adds to end of string
#include <conio.h> //provides getch() --gets int for key press

int main()
{
char string[400]="";

char temp[] = "1";
char key[400]="I am the key used for encryption";
int count = 0;
cout<<"input string to encrypt or type enter to decode"<<endl;
while ((int)temp[0] != 13) //while not key_enter
{
count++;
temp[0] =(char)getch();
strcat(string,temp);
cout<<temp;
}
if (count==1)
{
count--;
temp[0]=1;
cout<<"input string to decode: ";
while ((int)temp[0] != 13)
{
count++;
temp[0] =(char)getch();
strcat(string,temp);
cout<<temp;
}
cout<<endl<<endl<<"decoded it is: ";
}
else
{ cout<<endl<<endl<<"You wrote: "<<string<< endl<<"encrypted it is: "<<endl; }

int x=0;
while(x<= (count-2))
{
string[x]=string[x]^key[x]; ///XOR check on the binaries
cout<<string[x];
x++;
}

cout<<endl<<" Decoded it is:\n"<<endl;
x=0;
while(x<= (count-2))
{
string[x]=string[x]^key[x];
cout<<string[x];
x++;
}


getch();
return 0;
}
__________________
System: teh_pwnage
CPU
Core 2 Duo e6600 L631B120
Motherboard
Asrock Dual
Memory
G.SKill DDR2-800
Graphics Card
X1950XT
Hard Drive
Seagate 320gb
Power Supply
Hiper 580W
Case
Xion Hydraulic
CPU cooling
D-Tek Fuzion
GPU cooling
Stock
OS
Windows XP
Monitor
Samsung, 19" flat
venar303 is offline   Reply With Quote
Old 10-12-07   #17 (permalink)
Overclocker
 
charbs152's Avatar
 
amd nvidia

Join Date: Dec 2006
Location: upstate NY
Posts: 908

Rep: 99 charbs152 is acknowledged by some
Unique Rep: 42
Trader Rating: 0
Default

bump
__________________
What Signature?
Recent studies show 92% of the teenage population likes rap music. If you are part of the 8% who listen to real music, put this as your sig. .... rock on Hendrix, Stevie Ray Vaughan, jeff beck, Clapton, joe satch, johnny a, zappa, RHCP, nirvana, pink floyd and many many more who created this wonderful genra of music called rock and who changed the world with their guitars and music!!
Quote:
Originally Posted by startekee View Post
no i have a dual core pentium 4 not ht

System: THE ATHLON
CPU
AMD Athlon 1.2GHz (socket A)
Motherboard
pcchips M810LR
Memory
384mb pc133
Graphics Card
PNY FX5500 128MB
Hard Drive
320GB Western Digital
Sound Card
XiFi
Power Supply
400 Watt Ultra X-Connect
Case
cheapo
CPU cooling
TR2-M3
OS
dual boot Ubuntu 7.10 (gutsy) + Windows XP Pro SP3
Monitor
17" CRT/ Viewsonic NX1932w 19" lcd
charbs152 is offline charbs152's Gallery   Reply With Quote
Old 10-14-07   #18 (permalink)
Programmer
 
kdbolt70's Avatar
 
intel ati

Join Date: May 2007
Location: Walled Lake, MI
Posts: 1,100

Rep: 126 kdbolt70 is acknowledged by manykdbolt70 is acknowledged by many
Unique Rep: 91
Folding Team Rank: 156
Trader Rating: 1
Default

Man, if I wasn't getting owned by programming projects this semester I'd be all over working on some fun challenges.
__________________

~M Hail to the Victors M~

System: It's about time!
CPU
Q6600 G0 @3.3Ghz
Motherboard
Gigabyte P35-DS3L
Memory
2Gb Ballistix DDR2 800 @915Mhz
Graphics Card
Sapphire 2900Pro Flashed to XT
Hard Drive
Seagate Barracuda 320Gb
Sound Card
Onboard
Power Supply
Corsair HX 620W
Case
CM 690
CPU cooling
Tuniq Tower 120
GPU cooling
stock
OS
Vista Business and VMWare Ubuntu
Monitor
Acer AL2223W 22"
kdbolt70 is offline I fold for Overclock.net   Reply With Quote
Old 10-15-07   #19 (permalink)
Programmer
 
JoBlo69's Avatar
 
intel nvidia

Join Date: Jan 2007
Posts: 3,291

Rep: 168 JoBlo69 is acknowledged by manyJoBlo69 is acknowledged by many
Unique Rep: 145
Trader Rating: 15
Default

Quote:
Originally Posted by kdbolt70 View Post
Man, if I wasn't getting owned by programming projects this semester I'd be all over working on some fun challenges.
Second that. ^^
__________________
My Lego case thread. With PICS!!!
-----------------------------------------------------------------------
Video card RMA database thread. I am working on an application that allows users to input their cards issues into a database, to build a knowledge base for what types of cards have a lower fail rate.

System: 45nm FTW
CPU
E8400 3.6Ghz 1.25v
Motherboard
ASUS P5Q Delux P45
Memory
4GB (2x2GB) PATRIOT Viper PVS24G 6400LLK R
Graphics Card
XFX 8800GT
Hard Drive
2 x 74GB Raptors RAID0 ICH10R
Sound Card
onboard FTRW!!!
Power Supply
700w OCZ GamerXtream
Case
POS
OS
64bit Vista
Monitor
18" Dell LCD + 24" Gateway LCD (killed it's self)
JoBlo69 is offline JoBlo69's Gallery   Reply With Quote
Old 10-16-07   #20 (permalink)
Fear is the heart of Love
 
dangerousHobo's Avatar
 
amd nvidia

Join Date: Dec 2005
Location: ~/
Posts: 3,409

FAQs Submitted: 7
Folding Team Rank: 293
Trader Rating: 0
Default

Yeah, been having one after another.
Not been getting owned, but they are eating up all my time.

Right now I have to basically build the TCP protocol out of UDP.
__________________
"UNIX was never designed to keep people from doing stupid things, because that policy would also keep them from doing clever things." - Doug Gwyn

Try out the latest Programming Challenge
Quote:
Originally Posted by Melcar
Only one reasonable way to solve this... a dance off.

CPU-Z Validation
@ 2.97-prime95 stable 16 hours @ 1.48v Proof | CPU-Z Validation @ 3.15


Getting Mouse Side Buttons to work in Linux, Compile a custom Kernel, More

System: Anomaly
CPU
Athlon 3700 SD(KACAE)0546 @3.02ghz
Motherboard
DFI UT nF4 Ultra-D
Memory
G.Skill 2x512 UTT(BH-5)
Graphics Card
evga 6800gs
Hard Drive
Maxtor 300GB + WD 250GB
Sound Card
onboard
Power Supply
Ultra 500w V-series
Case
one from Ultra
CPU cooling
Big Typhoon
GPU cooling
80mm fan mounted on
OS
Arch Linux, Slackware 12.1
Monitor
Acer AL2216W 22" WS LCD
dangerousHobo is offline I fold for Overclock.net Overclocked Account dangerousHobo's Gallery   Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools



All times are GMT -4. The time now is 07:06 AM.


Overclock.net is a Carbon Neutral Site Creative Commons License Internet Security By ControlScan

Terms of Service / Forum Rules | Privacy Policy | Advertising | Become an Official Vendor
Copyright © 2008 Shogun Interactive Development. Most rights reserved.
Page generated in 0.21879 seconds with 10 queries