![]() |
| |
Thread Tools Display Modes |
|
ASCII decrypt
Here is a program that decrypts ASCII alphanumerics using the Cypher method
C++ Code:
// ascii decrypt.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <stdio.h>
#include <string.h> //header files needed to compile it
#include <ctype.h>
#include <stdlib.h>
char *process(char *word, char type)
{
int i;
char *aux = word;
switch(type)
{
case 'd': //in the case that we choose to decrypt
{
/* //takes the word (aux) and goes down one letter in the ascii table then in the second letter it goes down two letters in the ascii table and so on... */
for(i = 0; aux[i] != ''; ++i)
aux[i] -= i;
}
break;
case 'e': //in the case we choose to encrypt
{
// basicly does the opposite of case 'd'
for(i = 0; aux[i] != ''; ++i)
aux[i] += i;
}
break;
default:
{
fprintf(stderr, "nUse decrypt or encrypt...n"); // prints the text on the screen...(uses C (fprintf) not C++[im not sure about that])
exit(1); // exits.....duh
}
}
return aux; // returns the word (aux)
}
int main(void)
{
char opt, word[25+1]; // sets the word limit to be 25 characters long
printf("/t/te - encrypt wordn/t/td - decrypt wordnnttOption:");
do
{
opt = getchar(); // gets the word
}while(opt != 'd' && opt != 'e');
scanf("%*[^n]"); scanf("%*c");
printf("ntWord (MAX 25 chars): "); // says max is 25 chars
scanf("%s", word);
opt == 'd' ? printf("tDecrypted word : %sn", process(word, opt)) : // prints the decrypted word on the screen
printf("tEncrypted word : %sn", process(word, opt)); //prints the encrypted word on the screen
system("pause>nul"); // pauses the screen and takes away the "press any key to continue..."
return 0; // ends the program by returnin nothing
}
__________________
DONT CLICK HERE
![]() Quote:
Quote:
Quote:
Last edited by mameman2; 07-07-2008 at 08:06 PM.. |
||||||||||
|
where'd you get it from, you should include source:)
__________________
Founder of the Rainbow 6 Vegas Teleportation Glitch The New James Bond Game is Made by ACTIVISION!! ![]() ![]() |
|||||||
|
I think that you should have some comments so ppl can follow. //This is a post
__________________
![]() |
|||||||
|
sorry if this sounds nooby but what do we save the file as?
|
|||||||
|
put in some explination and manguy umm u dont save it as u compile it
**The CODE tags remove some /'s so please replace them where nesacery
__________________
DONT CLICK HERE
![]() Quote:
Quote:
Quote:
Last edited by mameman2; 07-07-2008 at 08:07 PM.. |
||||||||||
![]() |
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|



















Linear Mode
