Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Need help with encryption program

Author
Message
Mizipzor
20
Years of Service
User Offline
Joined: 24th May 2004
Location: Sweden
Posted: 9th Jun 2004 17:27 Edited at: 9th Jun 2004 17:55
Hi there, Im trying to learn how to handle reading and writing from txt files and strings. I decided to try it out by doing a simple encryption program. Heres the code:



The problem is, if i make the input file to big then the program shuts down when its trying to read it. I assume im breaking some max limits on some variables or something. Because it works if the input file is quite small. What is the maximum string length? Or whatever it is im making to big

Thanks
Mizipzor

[Edit] Hehe, maybe i should post how to use the program to . You need to txt files, input and key. The input file should hold whatever message you want to encrypt. The key file is a bit trickier.

The key files is how the message would be encrypted. Type the entire alphabet in a single line plus three characters. It doesnt matter which three the last characters is, theyre there because my language (swedish) has three extra characters at the end of the alphabet.

Example, if you want a to encrypted into Q and b into W then the key line should begin with QW... encrypted ab... and then follow with the rest of the alphabet. This is the line I use:

qwertyuiopasdfghjklzxcvbnmaaa


Why didnt I just post that line right away now... hmm... hehe . Anyways the program should produce a file, encrypted.txt, which is the input.txt file encrypted .

Thanks again

Dreaming of creating a highly advanced AI mind
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 9th Jun 2004 17:55 Edited at: 9th Jun 2004 17:56
The only limit to string size is memory. However, it could be a bug in the read string command...
If you can make the file availiable, I'll try it here tonight.


The place for wonderful plug-ins and things.
Keep your friends close, and your cats even closer.
Mizipzor
20
Years of Service
User Offline
Joined: 24th May 2004
Location: Sweden
Posted: 9th Jun 2004 18:08
How do I increase to memory aviable to the string then? Or does the string take the memory required no matter what?

What do I do if its a bud? I have the latest version...

Dreaming of creating a highly advanced AI mind
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 9th Jun 2004 19:11
When storing data into a string, memory is allocated for it automatically.
If it is a bug - then there are other alternatives for reading/writing data to files - got some on my web site.


The place for wonderful plug-ins and things.
Keep your friends close, and your cats even closer.
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 10th Jun 2004 01:29
Have you got your long test file ?


The place for wonderful plug-ins and things.
Keep your friends close, and your cats even closer.
SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 10th Jun 2004 07:18
Mizipzor,

One thing that immediately comes to my mind to solve your apparent problem is to save the Clear and Ciphered text into a MEMBLOCK, where you can access the area by characters, (bytes) code it and stuff it back to the memory for later printing. With advanced file access as well to fill up and write the memblocks, you should be able to code most any length message what so ever.

S.

Any truly great code should be indisguishable from magic.

Login to post a reply

Server time is: 2024-09-22 12:30:16
Your offset time is: 2024-09-22 12:30:16