0

For fun I am writing code that will hash a password with salt, just to try out (not for actual usage).

The problem is, I do not know how to store these passwords - If it was on the users hard drive, wouldn't it be insecure and only accessible by the person using it?

Can I store this file of hashed passwords + salt on Google drive, or some other online database? If so, how can this be accessed using python? I know you can do:

File = open('passwords.txt')

But how would this work with an online database?

Thanks for any responses :)

NightShade
  • 422
  • 5
  • 19
  • if your online database provides API for CRUD operations with files than it can work – Azat Ibrakov May 02 '17 at 06:19
  • Got an example of a database or code that I can go about to make this? I have never done this before and am completely clueless on how to do it. – NightShade May 02 '17 at 06:24
  • Remember why they are hashed and salted in the first place? In case the file does become compromised (you assume this will happen eventually), It's still a bunch of work to try to crack the hashes. The salt means that it's a lot more work to precompute and match the hashes. eg. "password1" at least isn't always the same exact hash. Making the file publicly accessible still isn't recommended (especially if users create their own passwords) – John La Rooy May 02 '17 at 07:01

1 Answers1

1

You're right, you would need to host the file somewhere online so that it can be accessed from anywhere.

Since you're doing this for fun, you could easily store the file in, say, Dropbox, or in Google Drive as you suggested. You could then get a sharing link for the file. Using the urllib or requests module, any user could then read this file.

This is definitely not advisable if you're trying to actually implement this, but would work fine if you're just messing around.

(A slightly more 'serious' way, but still simple, would be to host a small app on something like Heroku to hold the database.

Deem
  • 7,007
  • 2
  • 19
  • 23
  • Hope this isn't too big a question, I have created this document in Google drive: https://docs.google.com/document/d/1vKq4I_oFlBCB4aIbQPkGVVsmPBsrSONzHdohOcUx1D0/edit?usp=sharing how would I go about printing each line (for testing) – NightShade May 02 '17 at 06:35
  • Please have a look at http://stackoverflow.com/questions/1393324/in-python-given-a-url-to-a-text-file-what-is-the-simplest-way-to-read-the-cont, and also http://stackoverflow.com/questions/32971752/python-read-file-from-a-web-url. These should show you exactly how to do that. – Deem May 02 '17 at 06:41