ALL:
I currently have an ASCII text file that I am using a WinBatch program to read/write. It contains sensitive information, and I'd like to know if there is a file format (like, binary?) that I can read/write that will replace the ASCII text file. I'm really not looking for encrypted top-secret kind of stuff, just something to keep looky-loo's from easily opening notepad to view it.
As always, thanks in advance
Wow, more homework. Don't know if there is any 'top secret' stuff, but there are multiple ways to encrypt/decrypt in WB... think the Tech DB has a few. But, if you post the structure and some sample data you want encrypted, I'm sure you will get positive responses.
[EDIT]: probably base 64 will suit your needs
[EDIT 2]: actually I want Tony to come up with CLR code for : RijndaelManaged Class
Data file is the same as the comma-delimited problem I was having a few days ago...
Here's a sample of what I've got:
Data file looks something like this:
Line 1 - Data File
1,2,3,4,5,6,7,8,9,10
2,3,4,,5,,6,7,,8,9,10,1
3,4,5,6,7,8,9,10,1,2
4,5,6,7,8,9,10,1,2,3
5,6,7,8,9,10,1,2,3,4
6,7,8,9,10,1,2,3,4,5
Use a technique such as ROT13 for basic obfuscation of text where you need to read & process the text on a per-character basis without having to convert the entire file to plaintext before working with it. ROT13 has been around for a long time, with historical origins of the technique going back as far the Roman army using to protect written messages.
thanks Chuck... pretty simple but can be made more complex
text = "This is Test 5"
offset = 13
rot=""
;encrypt
For i = 1 To Strlen(text)
char= StrSub(text,i,1)
rot= rot:num2char(char2num(char)+13)
Next
Message(text,rot)
;decrypt
text=""
For i = 1 To Strlen(rot)
char= StrSub(rot,i,1)
text= text:num2char(char2num(char)-13)
Next
Message(rot,text)
Don't forget the modulo arithmetic for either unsigned 8 bit code points [ASCII/ANSI] or unsigned 16 bit code points. Rollover above 255 or 65535 and underflow below zero must be accounted for if the rotated value is to be stored in the same byte or word in the file.
Quote from: ChuckC on February 21, 2021, 11:52:51 AM
Don't forget the modulo arithmetic for either unsigned 8 bit code points [ASCII/ANSI] or unsigned 16 bit code points. Rollover above 255 or 65535 and underflow below zero must be accounted for if the rotated value is to be stored in the same byte or word in the file.
I won't forget, but then it's not my thread :D
That goes without saying...how could anyone forget that? ;)
That should be easy enough to remember.... it's the two imaginary irrational cube roots of -1 that are more often not thought about...
Quote from: ChuckC on February 21, 2021, 01:56:41 PM
That should be easy enough to remember.... it's the two imaginary irrational cube roots of -1 that are more often not thought about...
which goes down easy after a 6-pack of Occam's Razor
makes it a little trickier, if you remember the offset... [run several times for different results]
text = "This is Test 5"
offset = Random((255 -122)/2)
rot=""
;encrypt
For i = 1 To Strlen(text)
char= StrSub(text,i,1)
rot= rot:num2char(char2num(char)+offset)
Next
Message(text,rot)
;decrypt
text=""
For i = 1 To Strlen(rot)
char= StrSub(rot,i,1)
text= text:num2char(char2num(char)-offset)
Next
Message(rot,text)
This message late to the party, but don't forget about Alan Kreutzer's RC4 encryption extender - makes the job quite easy:
https://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WIL~Extenders/_Third~Party~Extenders/RC4
rc4encrypt(PlainText, Key)
rc4decrypt(EncryptedText, Key)
rc4binary(Pointer, Key)