README (7668B)
1 Databankr: store arbitrary data inside Casio Databank/Telememo watches 2 ---------------------------------------------------------------------- 3 This is a Python utility program that allows you to encode arbitrary pieces 4 of information into the format that could be entered into Casio watches with 5 the databank/telememo function support, as well as retrieve and decode this 6 information later. It supports both raw and hexadecimal data, as well as both 7 file and standard input/output. 8 9 == Usage == 10 11 The program can be run like this (as always, use -h flag to see live help): 12 13 python3 databankr.py [enc/dec] [-t TYPE] [-i INPUT_FILE] [-o OUTPUT_FILE] 14 [-c CONFIG] [-m MODULE] [-l EXPECTED_LENGTH] 15 16 where the mode (enc/dec) parameter is mandatory, and the optional ones are: 17 18 * -t: data type to be encoded or decoded (bin or hex, bin by default, 19 which means raw data) 20 * -i: source input file path (default "-", which means stdin) 21 * -o: result output file path (default "-", which means stdout) 22 * -c: configuration file path (default "config.json" in the current dir) 23 * -m: module configuration code according to your watch (default 2515-lat) 24 * -l: expected decoded data length in bytes (default is 0 - no limits) 25 26 In the encoding mode, the program outputs (to a file or the standard output) 27 a set of double newline separated records that you need to enter into the 28 databank/telememo function of your watch. Note that the amount of characters 29 is fixed for every model, so if the record name/number contains less of them, 30 then you must enter whitespaces into the rest. The input to the encoding mode 31 can also be a file or the standard input, and the data type flag (-t) defines 32 whether this is a raw binary file or a hexadecimal string. 33 34 In the decoding mode, the program expects a set of double newline separated 35 databank/telememo records from a file or the standard input and outputs the 36 reconstructed data into a file or the standard output according to the data 37 type flag. By default, the output is bit-aligned with the number of records 38 and the amount of bits held by each of them, so the excess data are filled 39 with null bytes. If you know the exact byte count of the source data, you can 40 pass the -l flag to strip the restored information to the desired length. 41 42 If you choose to enter the data manually via the standard input, press Ctrl+D 43 when done. This works in both modes. 44 45 Keep in mind that the records are case-sensitive: you must only enter the 46 letters in exactly the same case it has been specified in the configuration 47 section for the module of your choice. Most of the time, it will be upper case 48 for the name parts of the records. 49 50 == Configuration format == 51 52 The basic configuration file is shipped with Databankr and is suitable for 53 several popular databank-enabled Casio models, but you can always extend it 54 to support other ones if you know the structure of their records. The file is 55 a normal JSON object where the keys are module identifiers (not necessarily 56 matching the only module it can work on), and the values are module config 57 objects. Each such object contains the following fields: 58 59 * description: a human-readable module description displayed by Databankr 60 * namelen: the name field length in a databank record (in characters) 61 * numberlen: the number field length in a databank record (in characters) 62 * alpha: the entire character set that can be entered into a name field 63 * digit: the entire character set that can be entered into a number field 64 * index: a subset of the "alpha" charset sorted alphabetically that's used 65 for record indexing; its length must be equal to the total amount 66 of records in the watch 67 68 The namelen and numberlen fields are integers, all others are strings. The 69 "index" field is necessary because all Databank/Telememo-enabled Casio watches 70 utilize automatic sorting, so, to preserve the data order, the first character 71 in the name part of the record actually is used to index the records and not 72 store the data payload itself. 73 74 == FAQ == 75 76 - How and why this was invented? 77 78 Databankr started in early 2023 as a JavaScript library with a different name, 79 Telememer, that only catered to Casios with 2757 and 5574 modules (like AW-80, 80 AMW-870 and so on). It was created as an attempt to turn the Telememo function 81 of these watches into a kind of universal storage for arbitrary binary data, 82 as such a storage is pretty much unhackable and only accessible to those who 83 physically uses the watch. Besides, a phone or even a paper notebook are much 84 more likely to be stolen, searched or confiscated than a cheap wristwatch from 85 Casio. Then, in mid-2024, Databankr was created in its current form of a CLI 86 application written in Python 3, supporting several different Casio modules 87 out of the box. 88 89 - How much data can we store this way? 90 91 The overall formula of bits per record looks like this: 92 93 bits = |number_len * log2(digits)| + |(name_len - 1) * log2(chars)|, 94 95 where "digits" is how many different digits we can enter into the number part, 96 "chars" is how many different characters we can enter into the name part, and 97 "number_len" and "name_len" are the length of the number and name fields 98 respectively. Then we can multiply this number by the amount of records and it 99 will be the total storage. For example, with the default "2515-lat" module 100 configuration (which corresponds to a Casio DB-36/DB-360/DB-380 watch set to 101 English or Dutch language), we can store 95 bits per record which translates 102 to 2850 bits or 356 bytes of information in the entire databank. 103 104 - What kind of information can I store in such limited space? 105 106 If you happen to own an old and more advanced Casio Databank model (with 50, 107 100 or even 150 records), you'll find even more possibilities (after creating 108 your own configuration section for that model, of course: note that the main 109 limit in this case will be the amount of characters in the alphabet). However, 110 even 2850 bits are still over 2048, which means you can store several 111 cryptographic keys, important URLs and passwords (in an encrypted fashion) or 112 other information that you don't need to glance at but need to be able to 113 recover if you're only storing it on this particular Casio. Besides databank 114 capacity, the only real tradeoff is your own readiness to manually enter the 115 records into the watch and then retype them into the program (or a file) 116 whenever you need to recover the information. 117 118 - What happens if I enter more data that can be stored on encoding? 119 120 It will be truncated prior to converting to records. Only one record set is 121 supported at the moment. 122 123 - Which modules are supported as of now? 124 125 Currently, Databankr comes with the configurations for the following modules: 126 127 * 675: Casio modules 675 and 1475 (e.g. DB-520, DB-810) - up to 42 records 128 * 2747: Casio modules 2747 and 5574 (AW-80, AMW-870, HDC-600 etc) 129 * 2515-lat: Casio modules 2515 and 3227 (DB-36/360/380), basic Latin letters 130 * 2515-cyr: Casio modules 2515 and 3227, Cyrillic characters 131 * 2515-por: Casio modules 2515 and 3227, Portuguese characters 132 * 2888-lat: Casio modules 2888 and 3228 (DBC-32/611), basic Latin letters 133 * 2888-cyr: Casio modules 2888 and 3228, Cyrillic characters 134 135 Even though the program itself is considered complete, the configuration list 136 is expected to grow in the future. Of course, everyone is encouraged to append 137 their own configurations according to the "Configuration format" section. 138 139 Note that for the 675/1475 modules, the @ character actually refers to the 140 "hourglass" symbol that comes last in the character table. 141 142 == Credits == 143 144 Created by Luxferre in 2024. Released into public domain with no warranties. 145