Last active
October 6, 2025 23:41
-
-
Save windwakr/e75fcaedb057cf1301ec50eda9bde807 to your computer and use it in GitHub Desktop.
Generates passwords for DS Tekuteku Diary - DSてくてく日記
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Generates passwords for DS Tekuteku Diary - DSてくてく日記 | |
| # TODO figure out all the unknown bits, clean up the code | |
| import datetime | |
| outfname = "tekuteku_pass.txt" | |
| # sample password | |
| # さ そ め す き に | |
| # ひ い あ お め こ | |
| # 2008-05-10 3032 steps | |
| # Edit these two lines | |
| steps = 3032 # 0 - 1,048,575 | |
| date = datetime.date(2008, 5, 10) # Valid dates are 2000-01-01 through today's date | |
| unk2_7 = 1 # 1 bit (0-1) | |
| unk2_6 = 0 # 1 bit (0-1) | |
| unk2_5 = 0 # 1 bit (0-1) | |
| unk2_4 = 0 # 1 bit (0-1) | |
| unkthing = 1 # ??? 6 bits (0-63) Related to which creature you receive. | |
| unk5_7 = 0 # 1 bit (0-1) | |
| unk5_6 = 0 # 1 bit (0-1) | |
| unk5_5 = 0 # 1 bit (0-1) | |
| unk6 = 0 # 2 bits (0-3) | |
| day = (date - datetime.date(2000, 1, 1)).days # day offset from 2000-01-01 (0-32767) | |
| unk2_7654 = (unk2_7 << 3) | (unk2_6 << 2) | (unk2_5 << 1) | unk2_4 | |
| unk5_765 = (unk5_7 << 2) | (unk5_6 << 1) | unk5_5 | |
| passbytes = [0, 0, 0, 0, 0, 0, 0] | |
| passbytes[0] = steps & 0xFF | |
| passbytes[1] = (steps >> 8) & 0xFF | |
| passbytes[2] = (unk2_7654 << 4) | (steps >> 16) | |
| passbytes[3] = day & 0xFF | |
| passbytes[4] = ((day >> 8) & 0x7F) | ((unkthing & 0x1) << 7) | |
| passbytes[5] = (unkthing >> 1) | (unk5_765 << 5) | |
| passbytes[6] = unk6 | |
| # Calc checksum | |
| chk = 0 | |
| for num in passbytes: | |
| chk = (chk + num) & 0xFF | |
| dec = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] | |
| dec[0] = passbytes[0] & 0x1F | |
| dec[1] = (passbytes[0] >> 5) | ((passbytes[1] & 3) << 3) | |
| dec[2] = (passbytes[1] >> 2) & 0x1F | |
| dec[3] = (passbytes[1] >> 7) | ((passbytes[2] & 0x1F) << 1) | |
| dec[4] = (passbytes[2] >> 4) | ((passbytes[3] & 1) << 4) | |
| dec[5] = (passbytes[3] >> 1) & 0x1F | |
| dec[6] = (passbytes[3] >> 6) | ((passbytes[4] & 7) << 2) | |
| dec[7] = (passbytes[4] >> 3) & 0x1F | |
| dec[8] = (passbytes[5]) & 0x1F | |
| dec[9] = (passbytes[5] >> 5) | ((passbytes[6] & 3) << 3) | |
| cipherstate = chk | |
| enc = [chk&0xF, (chk>>4)&0xF] | |
| for num in dec: | |
| cipherstate = (cipherstate * 0x6d + 0xa15) & 0x7FFF | |
| enc.append((num + (cipherstate & 0x1F)) & 0x1F) | |
| charsordered = ["あ", "え", "い", "お", "う", "か", "け", "き", "こ", "く", "さ", "せ", "し", "そ", "す", "た", "て", "ち", "と", "つ", "な", "ね", "に", "の", "ぬ", "は", "へ", "ひ", "ほ", "ふ", "ま", "め"] | |
| with open(outfname, "w", encoding="utf-8") as f: | |
| f.write("Date: %s\nSteps: %d\n " % (date.strftime("%Y-%m-%d"), steps)) | |
| for i, num in enumerate(enc): | |
| if i == 6: | |
| f.write("\n ") | |
| f.write("%s " % charsordered[num]) |
unk2_7 = quota reached message
unk2_5 = late at night message? Makes your gel more "cool" looking?
unk5_7 = day start message or something?
unk5_6 = congratulations on clearing something
unk5_5 = goodbye message
Still don't understand how the gel selection is fully encoded.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Online version that's easier to use. Generated from my Python script using Grok.
https://windwakr.github.io/tekuteku/passgen.html