Hide String Value Using Cryptography

C

Colin Steadman

Does anyone have a couple of VBA functions they dont mind
sharing to encrypt/decrypt a string? I'd like to hide a
value before storing it in the registry but am not sure
about how to do this. I've been looking around the net
for a couple of VBA functions to do this, but cant find
anything useful.

TIA,

Colin
 
J

Jay Freedman

Colin said:
Does anyone have a couple of VBA functions they dont mind
sharing to encrypt/decrypt a string? I'd like to hide a
value before storing it in the registry but am not sure
about how to do this. I've been looking around the net
for a couple of VBA functions to do this, but cant find
anything useful.

Hi Colin,

It depends on how "secure" you want it to be. It sounds like you don't need
high security, just a bit of scrambling to hide the value. If that's the
case, rot13 is quick and easy -- see
http://www.vbcode.com/asp/showsn.asp?theID=1483 for a sample function. Rot13
is the simplest of substitution ciphers: take the character's position in
the alphabet and add 13, with "wraparound" from the end to the beginning. It
has the great advantage that the same function both encrypts and decrypts
the string. A possible disadvantage is that it doesn't change digits or
punctuation at all.
 
C

Colin Steadman

Hi Colin,

It depends on how "secure" you want it to be. It sounds like you don't need
high security, just a bit of scrambling to hide the value. If that's the
case, rot13 is quick and easy -- see
http://www.vbcode.com/asp/showsn.asp?theID=1483 for a sample function. Rot13
is the simplest of substitution ciphers: take the character's position in
the alphabet and add 13, with "wraparound" from the end to the beginning. It
has the great advantage that the same function both encrypts and decrypts
the string. A possible disadvantage is that it doesn't change digits or
punctuation at all.


Thankyou Jay,

It doesn't have to be to secure as the value is only stored for a
short time while the user has an automated template open.

I have a macro that connects to an Oracle database and gets some data
when a custom toolbar button is clicked. The problem is that I have
to request the users username and password each time it runs, because
unlike IngresNet, Oracle seems to forget its authentication
information between requests.

Storing the password in the registry behind a little encryption seems
to be the only way around the problem...

Since my initial post I've found a nice article on the subject,
complete with examples!

http://www.visualbasicforum.com/showthread.php?t=31778

Colin
 
C

Colin Steadman

Hi Colin,

It depends on how "secure" you want it to be. It sounds like you don't need
high security, just a bit of scrambling to hide the value. If that's the
case, rot13 is quick and easy -- see
http://www.vbcode.com/asp/showsn.asp?theID=1483 for a sample function. Rot13
is the simplest of substitution ciphers: take the character's position in
the alphabet and add 13, with "wraparound" from the end to the beginning. It
has the great advantage that the same function both encrypts and decrypts
the string. A possible disadvantage is that it doesn't change digits or
punctuation at all.


Thankyou Jay,

It doesn't have to be to secure as the value is only stored while the
user has an automated template open.

I have a macro that connects to an Oracle database and gets some data
when a custom toolbar button is clicked. The problem is that I have
to request the username and password each time the button is run.

Storing these values in the registry behind a little encryption seems
to be the only way around the problem...

Since my initial post I've found this article which has some nice
examples in it:

http://www.visualbasicforum.com/showthread.php?t=31778

Thanks,

Colin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top