# Tag Archives: python

## Using Cartopy to draw maps and plot points

Let's do something simple but useful for geographical data science: drawing a map in Python. I will assume you are using the Anaconda distribution. Unfortunately, there are many mapping libraries for different programming ecosystems and it's a little hard to find out which you should use. For a long time in Python, Basemap was the […]

## A Python 3 implementation of the MD5 Hash

Today we'll see a Python 3 implementation of the MD5 hashing algorithm, which was originally designed by Ron Rivest. Even though the MD5 algorithm has been compromised and is not longer secure, it is still in use today. For example, CS ISOs of Linux distributions often provide MD5 sums in addition to SHA256 sums. There […]

## Python's "map" method and permutations of lists

Let's look at Python's map function. What does this function do? Here is the syntax:

It takes a function called function and applies it to each element of iterable, returning the result as an iterable. For example:

The output of this program is:

## Polynomial over finite field: permutation polynomial?

Let's assume you have a polynomial over a finite field $\F_q$, defined in Sage. How can you tell whether it's a permutation polynomial? That is, when is the corresponding function $\F_q\to\F_q$ bijective? This is how you might have a polynomial over $\F_q$ defined in Sage:

Here, the variable $x$ refers the element $x$ in […]

## Same multiplicative order modulo p and p^2

In the abelian group $\Z/n$, the order of $m\in \Z/n$ can be calculated via the formula $n/{\rm gcd}(m,n)$. This number is just the smallest number you have to multiply $m$ by in order to get a multiple of $n$. So when $n = p$ is a prime, every we see that every nonzero element of […]