View Poll Results: Which method....

Voters
6. You may not vote on this poll
  • Use a tag-based system!

    0 0%
  • No, no! Use a line-based system!

    1 16.67%
  • Wrong! Use astring of data with a key!

    1 16.67%
  • You're all wrong! Use another, better method!

    4 66.67%

Thread: storing data

  1. #1
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    937

    storing data

    I come to this advice board in search of advice.

    I am writing a check balance program and I am trying to think of a way to save its data. It would be written in an encoded text file; done. But it's the format that I'm having trouble with. That is what the above poll is for.
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

  2. #2
    Registered User
    Join Date
    Nov 2002
    Posts
    491
    Depends on how complex of an encoding you have. If you are just shootin outa buncha records and wan to easy read them in, then I suggest doing line based. I always stray from XML, for most applications that use XML, it is total overkill. I think, whaever is simpler but provides a reseasonable amount of room for expansion would be best. Don't forgot to have some sort of header in your config file, so if you significantly change things in the future you know what format you are working with and can work around it.

  3. #3
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    Whatever you feel comfortable working with. No one is nessicarily better than another (except for the tag based system... this is unneeded unless you'll be editing the files by hand)

    Also, if you're looking for efficiency than read/write your files in binary mode.

  4. #4
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    937
    Well, you see, the program isn't really complex, but it's completely dynamic. The program grows with new accounts, banks, and shrinks with deleting such. That's why I was thinking XML style. But as you said, that seems like overkill, and chances are, the program done well, I won't be hand-editing the data file.

    *EDIT* and my codec is a simple ASCII value scramble.
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

  5. #5
    Registered User
    Join Date
    Nov 2002
    Posts
    491
    *EDIT* and my codec is a simple ASCII value scramble
    Why are you even bothering encoding it then?

  6. #6
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    937
    So that an unsupervised friend while I'm cooking dinner or a trojan client can't read my money info!
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

  7. #7
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    937
    But that's not the point. I was asking your opinion on how I should format the information, and I got that; so thank you.
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

  8. #8
    Registered User
    Join Date
    Nov 2002
    Posts
    491
    Originally posted by CodeMonkey
    So that an unsupervised friend while I'm cooking dinner or a trojan client can't read my money info!
    Anyone who wants to read your money info bad enough will have little trouble figuring out your ASCII encoding method. Just a though, but a better encoding system might be a good idea depending on how widespread you want this app sent. But anyways, that is your choice.

  9. #9
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    937
    Then you wouldn't mind giving an example
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

  10. #10
    mov.w #$1337,D0 Jeremy G's Avatar
    Join Date
    Nov 2001
    Posts
    704

    if you want to encrypt the file *securely*

    Heres a little theory/tutorial for EASY encryption and incredibly hard decryption (for hackers).
    //----------------------------------------------------------------------------
    GCC MATH IS GREAT
    = 0
    a = 1
    b = 2
    c = 3
    d = 4
    e = 5
    f = 6
    g = 7
    h = 8
    i = 9
    j = 10
    k = 11
    l = 12
    m = 13
    n = 14
    o = 15
    p = 16
    q = 17
    r = 18
    s = 19
    t = 20
    u = 21
    v = 22
    w = 23
    x = 24
    y = 25
    z = 26

    message (dimension arbitrary) = [M]
    [(7 3 3)
    (0 13 1)
    (20 8 0)
    (9 19 0)
    (7 18 5)
    (1 20 0)]

    encoder = [E]
    [(1 -2 2)
    (-1 1 3)
    (1 -1 -4)]

    coded = [M]*[E] = [C]
    [(7 -14 11)
    (-12 12 35)
    (12 -32 64)
    (-10 1 75)
    (-6 -1 48)
    (-19 18 62)]

    decoder = [E]^-1
    [(-1 -10 -8)
    (-1 -6 -5)
    (0 -1 -1)]

    decoded = [M]*[E]*[E]^-1 = [C]*[E]^-1 => [M]*[I] = [C]*[E]^-1 => [M] = [C]*[E]^-1
    [(7 3 3)
    (0 13 1)
    (20 8 0)
    (9 19 0)
    (7 18 5)
    (1 20 0)]
    //------------------------------------------------------------------------------

    Your message matrix determines your encryption matrix, specifficaly the COLUMNS (vertical). If your message matrix is 2x6 then your encryption matrix would be a 6x6 matrix.

    Keep in mind the larger your encryption matrix is, the less likely it can be brute forced. Also, use Sparse number in odd ranges, 1 -235 3000000000 888 are good ranges, while 1 3 9 and 7 would be likely to be found in a brute force program.

    Also note that you encryption matrix MUST, i repeat MUST have an inverse matrix, to check, get out a graphing calculator, enter the matrix and press inverse key followed by enter and copy that down.
    c++->visualc++->directx->opengl->c++;
    (it should be realized my posts are all in a light hearted manner. And should not be taken offense to.)

  11. #11
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    937
    Thanks!
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Push_back not storing data to vector
    By csonx_p in forum C++ Programming
    Replies: 13
    Last Post: 07-27-2008, 04:38 AM
  2. Robust method for storing data outside of a program
    By goatslayer in forum C++ Programming
    Replies: 17
    Last Post: 09-19-2007, 03:08 PM
  3. Storing data from a file into a single char string
    By tuxinator in forum C Programming
    Replies: 16
    Last Post: 05-01-2006, 10:21 PM
  4. storing client data in server app
    By codec in forum C++ Programming
    Replies: 4
    Last Post: 03-09-2003, 10:34 PM
  5. Storing Data in a Structure
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 11-28-2001, 06:43 AM