![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 | |
|
Hobbyist Programmer
Join Date: Aug 2005
Location: Hiding from... them...
Posts: 110
Rep Power: 4
![]() |
Quote:
|
|
|
|
|
|
|
#12 |
|
Programming Guru
![]() |
This goes back to the two types of programmers: the arrogant, and the insecure.
__________________
|
|
|
|
|
|
#13 |
|
Programming Guru
![]() Join Date: Oct 2004
Location: namespace std
Posts: 1,246
Rep Power: 5
![]() |
absolutely, as programming skill has little to do with knowledge of syntax or knowledge of available libraries. work your potential man!!!
don't disregard posts that may appear to be condescending (sp?) when they are actually there to help. the language barrier is dificult to overcome, and we understand. also, don't worry about crazy posts about your english, (honestly an (american) retard speaks better english than you) and those guys might not know your situation. good luck!
__________________
i put on my robe and wizard hat... Have you ever heard of Plato, Aristotle, Socrates?...Morons. |
|
|
|
|
|
#14 |
|
Professional Programmer
Join Date: Sep 2005
Location: serbia & montenegro
Posts: 484
Rep Power: 4
![]() |
I've studied English language for only one year, and this is one way for learning it.Also, it would be very helpfull for me if you guys wanted to correct me in my grammar mistakes that I made with your posts. Thank you. |
|
|
|
|
|
#15 |
|
Programming Guru
![]() |
![]() Grammar Spelling English language is a noun, and your first sentence should be written like this to sound more clear: I've studied the English language for only one year, and this is one way to learn it. -- or -- I've studied the English language for only one year, and this is one method for learning it. Theoretically, the second change in your sentence is correct as far as english grammatics go, it's just hard to read... -------- Also, it would be very helpful for me if you guys wanted to correct me in my grammar mistakes that I make with your posts. --or-- Also, it would be very helpful for me if you guys wanted to correct me in my grammar mistakes that I have made with your posts. You have to indicate your tense before the use of the verb.
__________________
|
|
|
|
|
|
#16 |
|
Professional Programmer
Join Date: Sep 2005
Location: serbia & montenegro
Posts: 484
Rep Power: 4
![]() |
Thank you tempest I will remember that.
|
|
|
|
|
|
#17 |
|
Hobbyist Programmer
|
I exhort you to try and enhance this algorithm in some fashion, since it can be solved with mere frequency analysis as of current.
|
|
|
|
|
|
#18 |
|
Programming Guru
![]() |
Here's something i wrote a while back... it's not XOR but it's encryption...
[php]#include <iostream> using namespace std; char *enc(char *str, char *key) { int k = 0; char *newKey = (char *)malloc(strlen(str)); strcpy(newKey, str); for(int i=0;i<strlen(str);i++) { newKey[i] = (char)((int)str[i] + (int)key[k]); k = ((k == strlen(key)-1)?0:k+1); } return newKey; } char *dec(char *str, char *key) { int k = 0; char *newKey = (char *)malloc(strlen(str)); strcpy(newKey, str); for(int i=0;i<strlen(str);i++) { newKey[i] = (char)((int)str[i] - (int)key[k]); k = ((k == strlen(key)-1)?0:k+1); } return newKey; } int main(int argc, char *argv[]) { char *str = enc("this is a test", "cheese"); printf("Encrypted: %s\n", str); printf("Decrypted: %s\n", str, dec(str, "cheese")); cin.get(); return 0; }[/php]
__________________
|
|
|
|
|
|
#19 |
|
Professional Programmer
Join Date: Sep 2005
Location: serbia & montenegro
Posts: 484
Rep Power: 4
![]() |
Isn't working for me tempest...
The Output is: Encrypted: ╫╨╬╪ô╬╓ê╞àτ╩╓▄ Decrypted: ╫╨╬╪ô╬╓ê╞àτ╩╓▄ |
|
|
|
|
|
#20 |
|
Professional Programmer
Join Date: Sep 2005
Location: serbia & montenegro
Posts: 484
Rep Power: 4
![]() |
I optimized a little my code.
Now the file name may contain spaces and you can specify also the full location of the file. Also, you can enter the file name of the output file ( again, it can be only the file name or the full location ). The code:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
char fileName[129];
char outputFile[129];
int temp;
FILE *fp;
FILE *fp1;
printf( "Text Encoder 1.0 \n\n" );
printf( "Enter the file name you want to encrypt/decrypt: \n" );
printf( "The lenght of the file name may not contain then 128 chars. \n" );
printf( "You may also enter the location of the file. \n" );
gets( fileName );
if((fp = fopen( fileName, "r" )) == NULL)
{
printf( "That file doesn't exist!!! \n\n" );
system( "PAUSE" );
return 0;
}
printf( "Enter the name of the output file. \n" );
gets( outputFile );
fp1 = fopen( outputFile, "w" );
printf( "Processing.... please wait \n" );
while( temp != -1 )
{
temp = fgetc( fp );
if( temp == -1 ) break;
temp = temp ^ 1926701;
fputc( temp, fp1 );
}
printf( "Done. \n \n" );
system("PAUSE");
return 0;
} |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|