I have a confession. I sometimes get wrapped up in the current news of the day. Whether it’s Covid-19 or politics, I can easily get anxious and distracted by everyone’s favorite histrionic social network: Twitter.
Here’s how I limit my time on Twitter so it doesn’t destroy my day:
- I use a very time consuming hashing algo to generate my Twitter password to login. It usually takes a few minutes.
- Instead of this password, my password manager (Lastpass) stores the Python command that generates my password. This ensures Lastpass won’t store my actual Twitter password.
For my expensive hashing algorithm, I have a python script (see below). I pass in a password I keep in my head (or run the command from (2)). This then outputs my true Twitter password. The script takes several minutes, and usually destroys the urge to log back in.
# usage python thisScript.py (password) # outputs a hashed version of the password to use to login to twitter or whatever import hashlib from base64 import b64encode if __name__ == "__main__": from sys import argv times = 1 site = '' # Optionally argv2 adds time to the password generation if len(argv) > 2: times = int(argv) dk = hashlib.pbkdf2_hmac('md5', argv.encode('utf-8'), SALT.encode('utf-8'), #Change SALT to a string unique to you iterations=times * 200000000, # Rehash this many times dklen=20) print(str(b64encode(dk)))
A couple things to note
iterations- it’s really a rehashing algorithm, taking the output of whatever hashing algo (md5) and then applying the hashing algorithm again and again. This is what makes it slow!
- The SALT here is a string you should create that’s unique to your version of the script. So my version doesn’t output what yours does, etc.
- Be careful executing this and having the command stored in your history. If you add a space before the command, it won’t be stored in Bash history
- This password takes serious effort to enter into my phone! On rare occasions I need Twitter on my phone, I reinstall the app and laboriously type in the password.
Hopefully a script like this can help you get your life & focus back on Twitter or anything else you don’t want to log back in!
For me logging out is easy enough to do. Nevertheless, if anyone has any hints on a browser plugin that can regularly log out from social media sites (perhaps deleting cookies, or whatever, after a time) I’d love to hear it!