Priority queues are useful to keep track of smallest elements in Python. A typical example would be to keep track of the smallest elements of a collection, for example first, second, third elements, we can simply keep popping out of the priority queue to get them. Python comes with a built in pirority queue via the library
heapq. In today’s post, we will look at the main functionalities of
heapq with examples.
Python dictionary is a structure that can be used to store key/value data with constant time for access. Dictionary structures in Python are very versatile which makes them popular and we can see them being used in many projects. They allow us to store keys and values of different types, provide us ways to iterate over the keys or values and have different ways to delete values. In today’s post, we will explore all the functionalities of dictionaries in Python.
Pointers are variables containing addresses of other variables. In C, pointers are used in many scenarios where they improve the code readability or where they are just necessary. In this post, we’ll explore what C pointers represent, how they can be used in functions, and explore the relationship between pointers and arrays.
I have been using Visual Studio Code for many years, starting from frontend development with Angular and React, then moving to work on Python and lately working on C# projects. Visual Studio Code has always been at the top of my favorite editor to use as it is very lightweight, responsive and fast. It’s quick to open files, quick to load projects, it has a clean and minimal interface and has a strong community. Over the years of using it, I realised that there are a couple of shortcuts that I keep using in repetition and that I found missing when using other IDE. In today’s post I’ll go through those keyboard shortcuts.
When working with cryptographic algorithm and hashes, it’s quite common to operate at the bit and byte level. For those situations, Python provides functionalities to convert
byte and vice versa and bitwise operators to operate on bits. In today’s post we will look at the different bitwise operators available with examples.
One-time passwords (OTP) are a great way to provide a second factor of authentication to an application. They are commonly distributed through channels like SMS, voice call, email, or physical token generator - common with banks. Although very useful, each of those distribution channels have limitations on both side; for the user and for the application developer. For example, for the user, SMS or voice call needs network connectivity which isn’t always available, and from the application developer, we need to rely on third party SMS gateway or voice call gateway which don’t support all countries, making 2FA unavailable for some. HMAC-based OTP (HMAC) and later on Time-based OTP (TOTP) were algorithms invented to address those problems providing a way for a prover to generate a valid OTP without the need of the verifier to send it to the prover. In today’s post we will see an example of TOTP implementation and look at how it is constructed.