| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Re: File writing |
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 -- Randy Birch MVP Visual Basic http://vbnet.mvps.org/ Please respond only to the newsgroups so all can benefit. "Woof-Woof" wrote in message news:k6jEc.17415$6r1.14171{at}fed1read06... : 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? : : : -- : : : --- : Allen : : : "Randy Birch" wrote in message : news:32KBc.15620$biD.1571{at}news04.bloor.is.net.cable.rogers.com... : > 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 : > : > -- : > : > Randy Birch : > MVP Visual Basic : > http://vbnet.mvps.org/ : > Please respond only to the newsgroups so all can benefit. : > : > : > "Blueyonder" wrote in message : > news:EWDBc.125002$B63.111165{at}doctor.cableinet.net... : > : Hi All : > : : > : Does anybody know how to write to a file so that the contents : cannot be : > : viewed by a text editor? : > : : > : : > : : --- þ RIMEGate(tm)/RGXPost V1.14 at BBSWORLD * Info{at}bbsworld.com --- * RIMEGate(tm)V10.2áÿ* RelayNet(tm) NNTP Gateway * MoonDog BBS * RgateImp.MoonDog.BBS at 6/30/04 5:54:00 AM* Origin: MoonDog BBS, Brooklyn,NY, 718 692-2498, 1:278/230 (1:278/230) SEEN-BY: 633/267 270 @PATH: 278/230 10/345 106/1 2000 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.