Link to home
Start Free TrialLog in
Avatar of michael123199
michael123199

asked on

encrypt and decrypt

Let's say I have some lines typed at notepad.exe.
I select all these lines and select 'copy', so those lines will be in memory.
 
Now I want to have source code that lets me:
encrypt all those lines with a word and put those encrypted lines in memory (instead of the original lines).
 
And I want to have source code that lets me:
decrypt all encrypted lines with the same word and put those decrypted lines in memory (instead of the encrypted lines).
 
If possible I want to have it like this:
. Both encrypt and decrypt functions in the same file.

. The user can select if he/she wants to decrypt or encrypt with a radiobox.

. The user can enter the password via a textbox.
 


I know this is a lot of work, but I aint a programmer. I'll give the full 150 points to the one who can give me the source code.
Avatar of hes
hes
Flag of United States of America image

Here is an example of excryption using a key

http://www.freevbcode.com/ShowCode.Asp?ID=2715

To use the clipboard use the following examples

clipboard.clear ' clears the clipboard
clipboard.gettext ' get's the text in the clipboard
clipboard.settext data  ' put's the data into the clipboard
 ' data is teh variable you want to be put into the clipboard
Avatar of michael123199
michael123199

ASKER

I want the full source code plz, I ain't know nothing about programming.
ASKER CERTIFIED SOLUTION
Avatar of PaulHews
PaulHews
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
'Assuming you have selected copy from notepad.
'The following will encrypt/decryypt the contents of the clipboard.

Private Sub Command1_Click()
    Dim strText As String
    If Len(txtPassword) < 5 Then
        MsgBox "password must be more than 5 characters."
        Exit Sub
    End If
    If Clipboard.GetFormat(vbCFText) Then
        strText = Clipboard.GetText(vbCFText)
        Call sEncryptDecryptString(strText, 940969077, txtPassword)
        Clipboard.Clear
        Clipboard.SetText strText, vbCFText
    End If
End Sub
Hi!

Here are some examples for you over the net:

Download...

Description:

Download...
http://www.vb-helper.com/HowTo/onetimepad.zip
Description: Use a one-time pad to encipher and decipher text (3K)

Download...
http://www.vb-helper.com/HowTo/simpencrypt.zip
Description: Encipher text, part 2 (6K)

Download...
http://www.vb-helper.com/HowTo/cipher.zip
Description: Encipher text (3K)

Download...
http://www.planetsourcecode.com/vb/scripts/ShowZip.asp?lngWId=1&lngCodeId=26385&strZipAccessCode=%5F%5F%5FA263855081
Description: This is a VB implementation of the AES block cipher (Advanced Encryption Standard) aka Rijndael created by Joan Daemen and Vincent Rijmen. AES is the government replacement algorithm for DES that will soon come into widespread use. A ton of info can be found on the AES algorithm at: http://csrc.nist.gov/encryption/aes/rijndael/ Note: I did not create the class module. It was written by P. Fresle for a VB implementation. I took his implementation and compacted the code down and created simpler Encrypt and Decrypt functions in a module to aid in ease of use for the Visual Basic community. I also added some error detection and an example of implementing the cipher in every day applications. The output of the cipher is hexadecimal and can get rater large for larger strings but the normal output of AES is to unintelligable and harder to transfer between applications. Unlike most people on PSC I don't care if you vote or not. Hope you enjoy this!

View code...
http://www.planetsourcecode.com/vb/scripts/ShowCodeAsText.asp?txtCodeId=3530&lngWId=1
Description: This is a encrypt/decrypt program thats only 10 lines long!!! all it uses is 2 simple fonts to encrypt, times new romand for the text and Money for the encrypted text! please tell me if you like it:)

That's it!

glass cookie ; )
Ok, so far I like Hes his answer best. I'll give the points to the one, who can alter :

- the load button so that get the clipboard information
- the save button so that it save the text field to the clipboard.
Ok, since nobody is helping me out with giving me the code I'll delete this q and post a new one...
michael, I gave you FULL working code above.
michael, please return and finalize this question, since clearly the question you asked has been handled.  If you'd like me to facilitate a point split between experts, I'll do that.  Advise expert name and amount.  

If this is not finalize, I will need to take the action.  Expert input always welcome to ensure a fair outcome.

Moondancer
Community Support Moderator @ Experts Exchange
Hi, thank you for your patience, I've asked for additional help on this; won't be back until later tomorrow and don't want you to think this isn't being worked.

Moondancer
Community Support Moderator @ Experts Exchange
Greetings, all.

michael logged in yesterday, after this follow up request was posted, yet didn't finalize, so I have.  If any questions, please comment.

Thank you.

Moondancer
Community Support Moderator @ Experts Exchange
michael and michael@hp --->  It is against Guidelines and the Member Agreement to have more than one account here.   The HELP DESK link on the left details the rules here, and the actions to take if violations occur.  Could it be that you may have originally had one account as michael@hp and perhaps had it converted somehow through special handling from Community support?  Both accounts exist, therefore this quesion to you.

Please choose one and respond, also please update/finalize all open questions in both.

Thanks,

Moondancer
Community Support Moderator @ Experts Exchange