zirias (on snac)Just started work on the planned "single instance mode" for <a href="https://snac.bsd.cafe?t=xmoji" class="mention hashtag" rel="nofollow noopener" target="_blank">#Xmoji</a>.<br><br>The first commit is done, adding a class implementing the core functionality using a local <a href="https://snac.bsd.cafe?t=unix" class="mention hashtag" rel="nofollow noopener" target="_blank">#Unix</a> <a href="https://snac.bsd.cafe?t=socket" class="mention hashtag" rel="nofollow noopener" target="_blank">#socket</a>. Part of the job is deriving a unique name for that socket, where <a href="https://snac.bsd.cafe?t=hashing" class="mention hashtag" rel="nofollow noopener" target="_blank">#hashing</a> comes natural.<br><br>I had a similar class in <a href="https://snac.bsd.cafe?t=qxmoji" class="mention hashtag" rel="nofollow noopener" target="_blank">#qXmoji</a> (based on <a href="https://snac.bsd.cafe?t=qt" class="mention hashtag" rel="nofollow noopener" target="_blank">#Qt</a><span></span>), and there you have <a href="https://snac.bsd.cafe?t=sha256" class="mention hashtag" rel="nofollow noopener" target="_blank">#sha256</a> at your fingertips with <code>QCryptographicHash</code>, so I just used that. You need a string from that, and sure thing, there's a <code>.toBase64()</code> method. Well, a <code>/</code> doesn't play well for filenames, but then, there's <code>.replace()</code>.<br><br>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 <a href="https://snac.bsd.cafe?t=fnv1a" class="mention hashtag" rel="nofollow noopener" target="_blank">#FNV1a</a>. It's super easy to implement in <a href="https://snac.bsd.cafe?t=c" class="mention hashtag" rel="nofollow noopener" target="_blank">#C</a>. And for the base64 part, well, doing it myself, I can directly use a modified set of digits, without the <code>/</code>.<br><br>Now, here's the whole thing:<br><a href="https://github.com/Zirias/xmoji/commit/db764e3184537d42b528e718bd4886495eb45544" rel="nofollow noopener" target="_blank">https://github.com/Zirias/xmoji/commit/db764e3184537d42b528e718bd4886495eb45544</a><br><br>I'd say that's a nice example how <b>not</b> having lots of "powerful" library functions readily available can lead to a much better (smaller, more efficient) solution. 😏<br><br><a href="https://snac.bsd.cafe?t=x11" class="mention hashtag" rel="nofollow noopener" target="_blank">#X11</a> <a href="https://snac.bsd.cafe?t=emoji" class="mention hashtag" rel="nofollow noopener" target="_blank">#emoji</a> <a href="https://snac.bsd.cafe?t=keyboard" class="mention hashtag" rel="nofollow noopener" target="_blank">#keyboard</a> <a href="https://snac.bsd.cafe?t=development" class="mention hashtag" rel="nofollow noopener" target="_blank">#development</a><br>