Don't have an account? Register now to chat, post, use our tools, and much more.
I am making a simple program that will archive a message until the correct password is typed in, the message is displayed, then the message gets erased. I was wondering if their was a way to encrypt it instead of using a password. My idea is that multiple people could have this program and someone could send someone else the encrypted message and the other person would be able to decrypt it using the same program to reveal the message.
I'm no encryption expert, nor a programming expert, but you could try and derive an encryption from a word or number. You can assign values to letters then use the resulting number as a seed to jumble the letters of the message, change their own value, etc.
I found this on ticalc. It uses a list to encrypt/decrypt strings.

Some of my own ideas:
--You could use a list to store the numbers of each letter. You can store more than 1 letter number in a single element, and extract the data using some iPart() and fPart() manipulation.

--You could scramble the string, and/or insert delimiters (you should probably use an untypable character, like one of the Stat variables) to determine what letter comes after the other, or something of the like.

Once again, these are just some ideas. They may not be the most efficient, but they will probably work.

EDIT: Also, this site may help, as electro mentioned in SAX.
Without getting into "real" crypto, you want a Vigenere cipher. It's still vulnerable to relatively simple statistical attacks, but more secure algorithms are much more difficult to implement.
(sorry for slight necropost)

Here's one I just created on my own:

Code:

"ABCDEFGHIJKLMNOPQRSTUVWXYZ
Ans+Ans->Str2
Input "",Str1
" ->Str3
For(A,1,length(Str1
If inString(Str2,sub(Str1,A,1
Then
inString(Str2,sub(Str1,A,1
Str3+sub(Str2,2Ans,1->Str3
Else
Str3+sub(Str1,A,1->Str3
End:End
sub(Str3,2,length(Str3)-1->Str3

What this one does is it takes the alphabetical place of each character in your string, and doubles that. So for example, "CEMETECH" would be "FJZJNJFP".
One of the advantages/disadvantages of this program is that not all characters have different encryptions than other characters, so letters like "R" and "E" would both become "J".

For decryption, you could just reverse it somehow, however I'm not quite sure how to do that...

Can you figure this out?
VJJZ LPFVL.
A method of making encryption that's slightly secure (but can be broken with a computer) is to seed rand to a value (a different one for each message), and add the resulting pseudorandom numbers to the numbers representing your message. After taking the remainder mod 26 or something, you convert it to a string of ciphertext. Then, on the other end, you can seed rand to the same value, convert the ciphertext to numbers, subtract the same pseudorandom numbers, and then convert back to a string to get your plaintext.
Michael2_3B wrote:
For decryption, you could just reverse it somehow, however I'm not quite sure how to do that...
You can't.

It's impossible because your enciphering function is not lossless. The output message has lower entropy than the input. There are two possible plaintext characters for each character of ciphertext, so it might be possible to guess with a reasonable success rate.

Simple statistical methods would probably work well against such a cipher, since you're effectively aliasing the first and second halves of the plaintext alphabet together.
Michael2_3B wrote:
(sorry for slight necropost)

Here's one I just created on my own:

Code:

"ABCDEFGHIJKLMNOPQRSTUVWXYZ
Ans+Ans->Str2
Input "",Str1
" ->Str3
For(A,1,length(Str1
If inString(Str2,sub(Str1,A,1
Then
inString(Str2,sub(Str1,A,1
Str3+sub(Str2,2Ans,1->Str3
Else
Str3+sub(Str1,A,1->Str3
End:End
sub(Str3,2,length(Str3)-1->Str3

What this one does is it takes the alphabetical place of each character in your string, and doubles that. So for example, "CEMETECH" would be "FJZJNJFP".
One of the advantages of this program is that not all characters have different encryptions than other characters, so letters like "R" and "E" would both become "J".

For decryption, you could just reverse it somehow, however I'm not quite sure how to do that...

VJJZ LPFVL.

Well, for each letter, you get twice the index number, search in the string and finds a letter, for example: E -> 5th letter -> letter number 10 becomes J.
But because you inserted twice the alphabet in a string, you must work with modulo-calculation. For example: T -> 20th letter -> letter number 40 (oops, more than 26, so 40 mod 26 = 14) 14 becomes N.

Well, let's decrypt. If I see the letter N (which index = 14), the original letter must be 14/2=7 OR (26+14)/2=20 which could be G or T. Understand? For each letter of the decrypted string are always two possibilities. For greater strings you get sooooooooo many results....

For you:

Code:
F -> C / O
J -> E / R
Z -> M / Z
J -> E / R
N -> G / T
J -> E / R
F -> C / O
P -> H / U

which has 2^8=256 possibilites.

Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

»
» All times are GMT - 5 Hours

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum