This is a part of my Daj się poznać / Get Noticed! 2017 series. It is for a contest where I have to write a blog post twice a week abd create a open source project. Read more about it here.
Yesterday evening I decided to take a look at a bunch of technologies I took under consideration to write my Get Noticed! project. Before, I was looking into how easy it would be to use Qt in them. It made sense, in a way, but not entirely. Since my project has to deal with cryptography, now I took a look at how easy it is to implement simple public key encryption (and decryption via private file). Additional requirements: key files are generated beforehand and stored in files and private key is password-protected.
Last time I wrote a project in Python was probably at the university, some 6 years ago. As I’m a Ruby programmer, I never felt an urge to learn Python “by heart” – because it’s enough to know one web-plus-general-purpose scripting language. On the other hand, it never was really a problem for me to write in Python if needed. Yes, I’m not a fan of its object orientation (
selfs everywhere!), but it’s a decent and easy language for me.
Using some StackOverflow and documentation of Pycryptodome library, I was able to have working code pretty fast:
It’s very simple and does exactly what I want. Just as expected.
Rust was on my learning waitlist for some time already. I have heard about it for the first time really long time ago, but never really tried it. To be honest, its syntax scared me a bit. But it wasn’t that hard. Completing this snippet took longer than the one in Python, of course, but I’m quite satisfied with the results:
Some stuff is not very clear for me, but this exercise let me have a grasp of what Rust is about. And I must say: I really like it!
I thought of D as my low-level language of choice for a long time. I really didn’t like where C++ was couple years ago (it’s better nowadays) and D was exactly what was missing there. However, it never gained its momentum and right now ecosystem is in a bit weird place. After all those years there aren’t many rock-solid solutions and projects get abandoned all the time. A nice exception here is vibe.d, but… a web framework in that kind of language? I don’t think so…
I have no code to show for D, because I basically failed in producing it. There aren’t really many cryptography libraries to choose from. One is botan, which is pretty good adaptation of C++ library. However, a part about RSA keys and encryption was really to me. Also, from what I understand from Readme, it compiles only under Visual Studio on Windows and it is totally unacceptable.
I’m really disappointed with D this time. Maybe I will come back to it some day, but probably not within timeframe of the contest. I don’t have a slot in my timeline to write cryptography library from scratch.
Rust feels really good, however. And I’m closer to decision to choose it as a main language for my project. And I have a feel that I can any time fall back to Python, which is good too.
You can find the code I produced here - I decided to check it in the repository, even though final product will not include it. A nice idea for such open source contest, if you ask me.