Password Helper

Remembering passwords can be a pain in the ass, especially if you want them to be strong passwords, i.e. long, complex and different for every service. A password manager software can help a lot, and they have some pretty awesome features nowadays like automatically changing all your passwords every once in a while. However, even though most password managers sync data across all your devices, they fail big time when you need to login to something on somebody else’s device, where you don’t really have the time or option to first install the browser plugin just to log on to one web service. Also, password managers can’t help you with OS and other “hardware” -logins. Of course, there is also the question that can you really trust all your login credentials to just one service.

Fortunately, I came across the ultimate method for generating and remembering passwords a long time ago. I don’t remember where I saw it first (I have a vague recollection that it had something to do with Mikko Hyppönen). Since then I have seen this advise come up in many articles about password security.

Anyway here’s the idea: Have an algorithm that takes the name of the service, and spits out a standardized password based on it. That way you only have to remember the algorithm, and then you will always know your password, even for services you haven’t visited in years or are not sure you have an account there to begin with. I have been using this method for many years now and it works perfectly.

An example algorithm:

  1. Take the first, third and last character of the name of the service.
  2. Add a dot
  3. Add a regular expression like “asdASD”.
  4. Count the number of characters in the name (“random” = 6).
  5. Divide the number by two and add it with special formatting (“–3,0”)

-> example:

A service named “Random” becomes “Rnm.asdASD–3,0”

For an even stronger password use more letters and special characters, make it more complex with more steps and so forth.

Typically, applying the algorithm on names takes only a few second especially when you get used to it. However, for really long names counting the number of characters can be annoying and it’s quite easy to make mistakes (for example “Roberts Space Industries“). Therefore I made a little helper program to generate the changing parts of my passwords if I don’t happen to remember them outright. The helper was done with Python and PyQt5, and consists of a small window. The name of the service is typed or pasted on the first line and the program generates the corresponding password parts from that.


Here’s what it looks like in action:


The code:

(naturally I changed the algorithm here a little from my own)
# -*- coding: utf-8 -*-

import sys
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import (QWidget, QLineEdit, QApplication, QGridLayout, QLabel)

class Password(QWidget):
 def __init__(self):
 def initUI(self):
 self.setGeometry(300, 300, 300, 150) 
 self.setWindowTitle('Password Helper') 
 self.lbl1 = QLabel("Name:")
 self.lbl2 = QLabel("String:")
 self.lbl3 = QLabel("Number:") 
 self.line1 = QLineEdit(self)
 self.line2 = QLineEdit(self)
 self.line3 = QLineEdit(self)
 self.setStyleSheet("QLabel, QLineEdit {font: bold 14px;}")
 grid = QGridLayout()
 grid.addWidget(self.lbl1, 1, 0)
 grid.addWidget(self.lbl2, 2, 0)
 grid.addWidget(self.lbl3, 3, 0)
 grid.addWidget(self.line1, 1, 1)
 grid.addWidget(self.line2, 2, 1)
 grid.addWidget(self.line3, 3, 1)
 def onChanged(self, text):
 if len(text) >= 3:
   if len(text) == 3:
     string = text[0].upper() + text[1].lower() + text[2].lower()
   elif len(text) == 4:
     string = text[0].upper() + text[2].lower() + text[3].lower() 
     string = text[0].upper() + text[2].lower() + text[3].upper() + text[-1].lower()
   num = str((len(text)/2.0))
   num.replace('.', ',')
if __name__ == '__main__':
    app = QApplication(sys.argv)
    ex = Password()

Leave a Reply