by CiPHPerCoder · 10y ago · 0 comments
It's very easy to write a cache-timing-safe version of base{16,32,64} encoding for use in encoding/decoding cryptographic keys in configuration files. To wit: https://github.com/paragonie/constant_time_encoding
Base-122? Not sure if it's even possible.
https://github.com/deckar01/digit-array/blob/master/README.m...
https://paragonie.com/blog/2016/06/constant-time-encoding-bo...
Each byte of base64 produces 6 bits of data, so the boundary aligns at 32 bits. LCM(6,8) = (6•8)/2
Each byte of base122 produces 7 bits of data, so the byte boundary aligns at 56 bits. LCM(7,8) = (7•8)/1
Edit: Due to the variable length encoding, there is no guarantee of byte alignment.
The magic is in the 2 byte encoding 110sss1x 10xxxxxx.
There are really 890 characters used in this encoding, so it should be called base890.
((2^7)-6)+((6•2)•(2^6))=890
From the posted article: "This leaves us with 122 legal one-byte UTF-8 characters to use"
Seems legit to me.