Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / General 2 / June 2004



Tip: Looking for answers? Try searching our database.

File writing

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Blueyonder - 21 Jun 2004 17:22 GMT
Hi All

Does anybody know how to write to a file so that the contents cannot be
viewed by a text editor?
Randy Birch - 22 Jun 2004 00:19 GMT
Define "can not be viewed".  Any file can be opened in a text editor ...
whether or not the contents mean anything is a result of the data in the
file and possible some sort of encryption applied.  If you want to prevent
casual reading of the file -- you can't prevent editing and possibly
rendering the file useless -- perhaps this might do what you want...
http://vbnet.mvps.org/code/algorithms/rot39.htm

Signature

Randy Birch
MVP Visual Basic
http://vbnet.mvps.org/
Please respond only to the newsgroups so all can benefit.

: Hi All
:
: Does anybody know how to write to a file so that the contents cannot be
: viewed by a text editor?
Woof-Woof - 29 Jun 2004 20:08 GMT
Having read your article "Simple Algorithms to Obfuscate a String" at
http://vbnet.mvps.org/index.html?code/algorithms/obfuscatedstring.htm
I wondered what would happen if I replaced Rnd -4 in the ConvertData
sub-routine with Rnd -(Timer).

If I didn't miss something it appears that you get a different
encrypted e-mail address every time you do the encryption because the
Rnd value is always changing. Seems like that has a very beneficial
use in keeping people from decrypting it "more easily", since the
encrypted string is different each time a person clicks on the button.
Might make someone scratch their head, eh?

Signature

---
Allen

> Define "can not be viewed".  Any file can be opened in a text editor ...
> whether or not the contents mean anything is a result of the data in the
[quoted text clipped - 7 lines]
> : Does anybody know how to write to a file so that the contents cannot be
> : viewed by a text editor?
Randy Birch - 30 Jun 2004 03:31 GMT
The routine relies on the repeatability of random numbers, so seeding
with -4 provides for predicable decoding when passing the string back
through the same routine. It falls apart when a truly random number is
generated for the encode and decode sequences preventing the decoding from
working.  The reason it *appears* to work if you use your suggestion just
for this demo is that the Timer function seeds the number to the time of the
machine, and as the code executes very quickly both the encoding and
decoding are happening at the same Timer time.  If you try this modification
to the Command1_Click routine to introduce a delay when your
suggested -(Timer) is used instead of -4, you'll see the results are not as
you'd expect. Restoring to -4 (or any other fixed number for that matter)
will work...

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Private Sub Command1_Click()

  Me.AutoRedraw = True

  Dim sEncodedEmail As String

  Print
  Print Command1.Caption

  sEncodedEmail = ConvertData(sDummyEmail)
  Print "encoded", sEncodedEmail
  Refresh
  Call Sleep(1000)  'wait 1 second before decoding
  Print "decoded", ConvertData(sEncodedEmail)

End Sub

Signature

Randy Birch
MVP Visual Basic
http://vbnet.mvps.org/
Please respond only to the newsgroups so all can benefit.

: Having read your article "Simple Algorithms to Obfuscate a String" at
: http://vbnet.mvps.org/index.html?code/algorithms/obfuscatedstring.htm
[quoted text clipped - 23 lines]
: cannot be
: > : viewed by a text editor?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.