Text to Secret Code Converter..

malcom

Active Member
Joined
May 2, 2005
Messages
483
anybody who can suggest how i will manipulate a string.. so that others cannot read the lines unless convert it back using the code that was used to manipulate it...

for example..
"i will go home"
becomes
"hsdkjsdfbnkfjhkadjhfahkhekafhkjahkhsfruhefk" any unreadable lines....

then, it will become "i will go home" again if converted back using the code..

tanx..
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Hi Malcom

Try this UDF:
Code:
Function Crypt(ByVal Password As String) As String
Dim bChar As Byte
Dim I As Integer

For I = 1 To Len(Password)
    bChar = Asc(Mid$(Password, I, 1)) Xor &HFF
    Mid$(Password, I, 1) = Chr(bChar)
Next I
Crypt = Password
End Function


This will do both encryption & decryption.
 
Upvote 0
tanx al_b_cnu...

is it possible to modify it for better security...
in a way that there will be a password for it... so different people can use it with different passwords.. so only the authorized people can read the lines...

example
Crypt("i will go home","password1") becomes jahfkjhafkashfksajfk
but...
Crypt("jahfkjhafkashfksajfk","password1") = i will go home
Crypt("jahfkjhafkashfksajfk","password2") = bbsldoksokvhjdv
Crypt("jahfkjhafkashfksajfk","password3") = kjahfkjahkvjacjkxhskhalfv


tanx..:)
 
Upvote 0
Hi Malcom,

To do this I had to write 2 macros - 1 to Encrypt & 1 to decrypt:
Code:
Option Explicit
Function EnCrypt(ByVal CryptString, _
                 Optional Password As String = "") As String

EnCrypt = ConvertString(Password) & "|" & ConvertString(CryptString)
End Function
Function DeCrypt(ByVal CryptString, _
                 Optional Password As String = "") As String
Dim iPtr As Integer
Dim sPass As String, sData As String
iPtr = InStr(CryptString, "|")
If iPtr > 1 Then sPass = ConvertString(Left$(CryptString, iPtr - 1))
If sPass = Password Then
    DeCrypt = ConvertString(Right$(CryptString, Len(CryptString) - iPtr))
Else
    DeCrypt = CryptString
End If
End Function

Private Function ConvertString(ByVal CryptString As String) As String
Dim bChar As Byte
Dim I As Integer

For I = 1 To Len(CryptString)
    bChar = Asc(Mid$(CryptString, I, 1)) Xor &HFF
    Mid$(CryptString, I, 1) = Chr(bChar)
Next I
ConvertString = CryptString
End Function
 
Upvote 0
wow! ur so cool! :)
thanx al_b_cnu...

i know only people hu can write vba code will be able to decrypt this themselve... :)
 
Upvote 0
Book1
ABCD
1This is a secret
20
3This is a secret
Sheet1

formula in A2 is =encrypt(A1,"b")
Formula in A3 is =decrypt(A2,"b")

I must admit I did wonder about asking for the password in an InputBox, but wasnt sure how you wanted to use it.
 
Upvote 0
i plan to use them on worksheet_change... dont wory, i can write code.. :)
the password will be fixed for each person.. i wont allow them to provide their own.. this way, i can still view all without any difficulty..:)

i plan to apply it on event viewer, application popup.. or message being sent on NET SEND... r u familiar with this?

coz i wonder if its possible to access EVENT VIEWER directly using excel vba...

coz if its not possible, i plan to let user copy then paste the message to excel to reveal the message...
 
Upvote 0
malcom said:
i plan to use them on worksheet_change... dont wory, i can write code.. :)
the password will be fixed for each person.. i wont allow them to provide their own.. this way, i can still view all without any difficulty..:)

i plan to apply it on event viewer, application popup.. or message being sent on NET SEND... r u familiar with this?

coz i wonder if its possible to access EVENT VIEWER directly using excel vba...

coz if its not possible, i plan to let user copy then paste the message to excel to reveal the message...

Sorry Malcom, I've had no experience with this, maybe you could start another thread?
 
Upvote 0
al_b_cnu,

I was very interested in this thread and after enjoying the contents (good job!) I read your signature. Did you know that there are actuall 11 different kinds of people. Those that know binary, those that don't, and those that try to say this joke out loud! ;)
 
Upvote 0

Forum statistics

Threads
1,216,146
Messages
6,129,134
Members
449,488
Latest member
qh017

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top