Normally, I'd post this in General VB, but threads that I start there don't go that far and don't help much. But you hackers tend to know how to break things.
I am working on a file specification for PassProg 2. Ignoring encryption for now (I'll work on that after I know what to encrypt ), I need a way to store data in the following format:
So there are multiple entries in a file, and each entry contains a username, password, date, etc. What I did in PassProg 1 was use an INI file, but that was crude, IMHO. Any ideas for a proprietary PP2 format?
What you do is, have a header Type containing info about the file, for example:
VB Code:
Type PP2Header
sOwnerName As String*64 ' Or whatever
lOtherRandomThing As Long
lFirstEntry As Long ' Location in the file of the first entry
End Type
You have one of those first in the file (perhaps some signature bytes as well?) and then follow it up with the entry types. This is where it gets clever...
VB Code:
Type PP2Entry
sName As String*64 ' Entry name
lType As Long ' Entry type (possibly use an Enum for this?
lLocation As Long ' Location in the file of the data for this entry
lLength As Long ' Length of the associated data
End Type
Then you can have different Types for different things you need to store.
It's a bit abstract, but you might get the gist of it
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You". -- Linus Torvalds
Do you have an example of what it would look like? BTW, I forgot, a master password for the file would be stored there too (not as part of an entry, but by itself).
OK you'd have to give me a moment alone with a hex editor though It wouldn't really look like much, but I'll see what I can do (I think in terms of 8-byte aligned and packed structs rather than Types).
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You". -- Linus Torvalds
Oh. I was thinking of something groovy and complicated but pretty simple to read into the program. Do you mind if the fields are padded at all? This is so much easier in C where strings have a nice fat NULL on the end
Newline-delimited text files are ok, but a ***** to process.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You". -- Linus Torvalds
OK, for example you needed to hold 65536 chars per type field. Is it ok just to have that allocated in the type, or to store them separately using a length? Be a bit of a bastard to write but your choice...
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You". -- Linus Torvalds
Type PP2File
sOwnerName As String
lOtherRandomThing As Long
PP2Entries() as PP2Entry
End Type
Type PP2Entry
sName As String
lType As Long
lLocation As Long
Data as String
End Type
...
dim x as PP2File
...
Put#f,,x'in a file opened in binary
Use
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Nope, typenested strings and arrays will include a 2 or 6 byte descriptor making things so much easier
Use
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
It all depends on whether you want sequential or random access. Fixed length records are pretty much a necessity for random access but not for sequential access.
Use
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.