this is a cipher based on the compositional principle 'tintinnabuli' by estonian minimalist composer arvo part. it encrypts a message by combining two "voices" derived from a single key: a harmonic "t-voice" and a melodic "m-voice". step 1: message preparation (plaintext to hex) first, the message to be encrypted (e.g., "hi") is converted into a stream of hexadecimal (base 16) characters. each character is broken down into its two-digit hex code. - example: "h" -> "68", "i" -> "69" - "hi" becomes the hex string "6869". the cipher will encrypt this hex string, one character at a time. step 2: the t-voice (the "sacred triad") the cipher generates a unique harmonic field (a triad of prime numbers) from the password. it uses the key's first, middle, and last letters to create three seed numbers, then finds the next prime number after each seed. the seed-generation formula is: (character_code % 10) + 2 - example 1: "cat" (3 letters) - first letter 'c' (ascii code 99): (99 % 10) + 2 = 9 + 2 = 11. nextprime(11) is 11. - middle letter 'a' (index 1): the middle index for a 3-letter word is floor(3 / 2) = 1, which is 'a'. (code 97): (97 % 10) + 2 = 7 + 2 = 9. nextprime(9) is 11. - last letter 't' (ascii code 116): (116 % 10) + 2 = 6 + 2 = 8. nextprime(8) is 11. - "cat" generates the triad [11, 11, 11]. - example 2: "loop" (4 letters) - first letter 'l' (ascii code 108): (108 % 10) + 2 = 8 + 2 = 10. nextprime(10) is 11. - middle letter 'o' (index 2): the middle index for a 4-letter word is floor(4 / 2) = 2, which is the *second* 'o'. (code 111): (111 % 10) + 2 = 1 + 2 = 3. nextprime(3) is 3. - last letter 'p' (ascii code 112): (112 % 10) + 2 = 2 + 2 = 4. nextprime(4) is 5. - "loop" generates the triad [11, 3, 5]. step 3: the m-voice (the "melody") the m-voice is a repeating melodic pattern derived from the password. the cipher steps through the password, repeating it as needed (e.g., "c-a-t-c-a-t..."). for each step of the encryption, it takes the corresponding password character and converts it into a "melody note" (a value from 0-15, using char_code % 16). step 4: the encryption (the "performance") encrypt each character of the hex string (from step 1): 1. gets the current "melody note" from the m-voice (e.g., 'c' -> 3). 2. looks at the password's "sacred triad" (e.g., [11, 11, 11] for "cat"). 3. finds which prime in the triad is *numerically closest* to the melody note (e.g., 3 is closest to 11). 4. this "closest prime" (11) becomes the shift value. 5. applies this shift to the hex character from the message (e.g., '6' + 11 = '17'). 6. wraps this value around base 16 (17 % 16 = 1) to get the final ciphertext character. this process repeats for the entire message, creating a complex polyalphabetic cipher where the entire keying system is derived from the key.