# 1-Click Passwords


I was recently presented with a situation where I would have to regularly enter a 48 random character password for a month or more to log in to a computer that was assigned to me. Given that I couldn't possibly memorize this string, and the computer is reasonably physically secure, I decided to build a device to do this for me.

I had previously used an Arduino to emulate a gamepad for a [homemade Dance Dance Revolution mat](https://www.hotelexistence.ca/me/?p=94). This time, I needed to emulate a keyboard. A search for "[HID](https://en.wikipedia.org/wiki/Human_interface_device) Arduino" returned the [Arduino HID](https://www.arduino.cc/en/Reference/HID) page, which suggested an Arduino with an Atmel 32u4 microcontroller. A search for Arduino 32u4 on Amazon returned the [KeeYees Pro Micro](https://www.amazon.ca/ATmega32U4-Development-Microcontroller-Leonardo-Bootloader/dp/B07WPCLF8Y/) clone, which I ordered.

![Arduino Pro Micro Clone, button wired to I/O 4](images/IMG_4297-1024x488.jpg "Arduino Pro Micro Clone, button wired to I/O 4")

It came in, I soldered a button to I/O 4, and uploaded the following code:
```
include "Keyboard.h"`  
include "Bounce2.h"  

const int buttonPin = 4;  
Bounce bounceTrigger = Bounce();  

void setup() {  
  bounceTrigger.attach(buttonPin, INPUT_PULLUP );  
  Keyboard.begin();  
}  

void loop() {  
  bounceTrigger.update();  
  if ( bounceTrigger.rose() ) {  
    Keyboard.println("I put my password here");  
  }  
}
```

Now, every morning, instead of copying 48 characters from a Post-it, I just click the button.

It should be said, this defeats the purpose of the password, and the password isn't stored in a secure way on the microcontroller. But this technique is great for any time you need to automate a sequence of keystrokes.

