Just started work on the planned "single instance mode" for
#Xmoji.
The first commit is done, adding a class implementing the core functionality using a local
#Unix #socket. Part of the job is deriving a unique name for that socket, where
#hashing comes natural.
I had a similar class in
#qXmoji (based on
#Qt), and there you have
#sha256 at your fingertips with
QCryptographicHash
, so I just used that. You need a string from that, and sure thing, there's a
.toBase64()
method. Well, a
/
doesn't play well for filenames, but then, there's
.replace()
.
Without all these helpers from Qt, first thing I did now was searching the web for a "good" hash function, but there's certainly no need for a cryptographic one. I found
#FNV1a. It's super easy to implement in
#C. And for the base64 part, well, doing it myself, I can directly use a modified set of digits, without the
/
.
Now, here's the whole thing:
https://github.com/Zirias/xmoji/commit/db764e3184537d42b528e718bd4886495eb45544I'd say that's a nice example how
not having lots of "powerful" library functions readily available can lead to a much better (smaller, more efficient) solution.
#X11 #emoji #keyboard #development