0

I am making a program which requires me to store login information for users. I already have the code set up which creates a hashed Byte[] array of their passwords and salts them with another Byte[]. I would like to store their username, their password, and their salt in the same file, preferably something like username,password,hash.

All I have found so far are examples of storing only a Byte array. If anyone could point me in the right direction for writing and reading files like that, it would be great.

Thank you for any help you can give me.

2
  • Could create an Object to hold all three and write that serialized Object to the file Commented Feb 13, 2015 at 14:14
  • I don't agree with serializable object...if it changes you couldn't be able to read already stored data! Commented Feb 13, 2015 at 14:51

1 Answer 1

1

The simplest option would probably be to just convert the byte arrays to text using base64 or hex (not calling new String(bytes)) and then just use a property file or any other text storage scheme you fancy.

You could go the other way, and store everything in a binary format (e.g. using a length-prefixed message for both bytes and strings) but my experience is that the readability of text files is huge boon to development.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.