Author Archives: Conrado

Understanding the Montgomery reduction algorithm

The Montgomery reduction algorithm finds the remainder of a division. Many cryptographic schemes work with numbers modulo a prime. When you have to multiply two numbers with e.g. 128 bits each, first you multiply them the usual way (there are many techniques for this) to obtain a 256-bit (“double precision”) number. Then you need to [...]

Understanding the extended Euclidian algorithm

The Euclidian algorithm finds the greatest common divisor of two numbers a and b. There is an extended version of it that also finds two numbers x and y such that ax + by = gcd(x,y). This is useful when searching for modular multiplicative inverses. The algorithm is simple, but I’ve never bothered to study [...]

The black magic of GDI+

One of the things I am most ashamed of on Quivi is its speed when opening large images (which are not uncommon nowadays, specially with digital photos). It’s embarrassing that the lame Windows Picture and Fax Viewer is lightning fast when opening those images! I’ve always wondered how the Viewer did that. I’ve searched about [...]

VirtualBox rocks

I’ve just tried VirtualBox and it simply rocks. I was using VMWare Player and got sick the lack of features. Yes, there’s VMWare Server, but it lacks desktop friendliness. VirtualBox provides the best of both worlds. (For those not familiar, VirtualBox is a virtualization software: it allows you to create virtual machines, so you can, [...]

Yet another silly Python vs Java comparison

I’ve been hacking the mspsim (a simulator) source to add support for a couple of stuffs in its profiler. At a certain point I had a hash table mapping functions to how many times they were called, and I had to sort them by that number of times. How to do that? List<entry> list = [...]

Sandbox WordPress theme for 2.7 with threaded comments

The Sandbox WordPress theme is a nice bare bones theme which can be easily used as a base to your own themes (preferably with a style.css file only, following the zen). The only problem is that its development is kinda frozen and it does not support new WordPress 2.7 features like threaded and paged comments. [...]

The Frobenius endomorphism with finite fields

The Frobenius endomorphism is defined as: where p is the characteristic of the ring you’re working with. Simple, right? If you’re working with a field with prime order, then Frobenius is actually the identity map. Since the order of the multiplicative subgroup is p, when you raise to the power of p you get back [...]

Quivi for Linux released

I’ve just released the Linux version of Quivi: Quivi is an image viewer (specialized for comic/manga reading) for Windows which supports many file formats and compressed (zip, rar) files. It is aimed for fast & easy file browsing with keyboard or mouse. It was working on Linux for a while, but now it’s “official”. I’ve [...]

Visualizing group structure with colored addition/multiplication tables

When working with finite fields, if the number of elements is a prime power with m > 1, you can represent the elements as polynomials with degree m-1 and do the field addition and multiplication modulo a irreducible polynomial with degree m. The field GF(5) is composed by the numbers 0 to 4. We don’t [...]

Access violation errors with callbacks in ctypes

I’ve just spent a few hours trying to solve this bug, so I’m publishing this so maybe it will help someone with this issue… Assume that you’re working with a DLL/.so library through ctypes in Python, and this library allows you to set a callback for some other function. In my case, I was working [...]