Your task is to convert non-empty strings - between strings using the 26 letters, and programs, which are strings of bytes, where each byte has 256 possible values. You should use the same codepage your answer is written in for the possible values of bytes.
You need to do the following to do the conversion:
- Convert the letters to numbers
1-26
. - Treat it as a base 26 bijective numeration number to convert it to a positive integer.
- Convert it to base 256 using
1-256
, again using bijective numeration. - Turn it to bytes, where
i
turns to the byte with valuei-1
.
For example, for the string hello
, you start with converting it to [8, 5, 12, 12, 15]
, then you evaluate \$15 + 12\cdot26 + 12\cdot26^2 + 5\cdot26^3 + 8\cdot26^4 = 3752127\$. Then you convert \$3752127 = 191 + 64\cdot256 + 57\cdot256^2\$, so the answer is [56, 63, 190]
.
However, you dislike gibberish. You want your code to be a concatenation of English words. You can't do that directly in your code, so instead you'll do that in its base26 representation.
Rules
- Your code, when converted to base 26 using bijective numeration, has to be a concatenation of English words from this wordlist, with 1 or 2 letter words removed, except for
a, i, of, to, in, is, on, by, it, or, be, at, as, an, we, us, if, my, do, no, he, up, so, pm, am, me, go, ok, hi
. - You can choose whether you want your input to have lowercase or uppercase letters, but it has to be consistent.
- Your input has to be a string, an array of characters or an array of bytes - you can't take an array of numbers from
1
to26
, for example. - Your output has to be a string, an array of characters, an array of bytes, or an array of numbers from
0
to255
. - Standard loopholes are disallowed.
- If your language uses a base which isn't 256 then use that base, as long as it isn't a power of 26. If it is that language can't compete.
Test cases
input string -> array of bytes
hi -> [216]
iw -> [0, 0]
sr -> [0, 255]
cat -> [7, 25]
crxq -> [255, 0]
cshl -> [255, 255]
cshm -> [0, 0, 0]
hello -> [56, 63, 190]
helloworld -> [39, 138, 176, 111, 2, 107]
apple -> [10, 110, 12]
loremipsumdolorsitamet -> [81, 108, 15, 236, 169, 234, 61, 72, 24, 166, 102, 147, 49]
Scoring
Your score is the length of your program, encoded in base 26. This is code-golf, so the shortest answer in each language wins.
[56, 63, 190]
rather than[57, 64, 191]
. Does that imply that byte 255 becomes254
? \$\endgroup\$