Skip to content

Instantly share code, notes, and snippets.

Forked from jaames/
Created December 17, 2022 01:35
What would you like to do?
Decrypt Mii QR code data from 3DS / Wii U / Miitomo
# Decrypt Mii QR codes from 3DS / Wii U / Miitomo
# Usage: python3 <input file> <output file>
# QR docs:
from Crypto.Cipher import AES
from sys import argv
key = bytes([0x59, 0xFC, 0x81, 0x7E, 0x64, 0x46, 0xEA, 0x61, 0x90, 0x34, 0x7B, 0x20, 0xE9, 0xBD, 0xCE, 0x52])
with open(argv[1], "rb") as infile, open(argv[2], "wb") as outfile:
nonce =
cipher =, AES.MODE_CCM, nonce + bytes([0, 0, 0, 0]))
content = cipher.decrypt(
result = content[:12] + nonce + content[12:]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment