david wong

Hey! I'm David, the author of the Real-World Cryptography book. I'm a crypto engineer at O(1) Labs on the Mina cryptocurrency, previously I was the security lead for Diem (formerly Libra) at Novi (Facebook), and a security consultant for the Cryptography Services of NCC Group. This is my blog about cryptography and security and other related topics that I find interesting.

Magma vs Sage vs Pari posted February 2015

I was looking for a way to know what are the real differences between magma, sage and pari. I only worked with sage and pari (and by the way, pari was invented at my university!) but heard of magma from sage contributors.

From the sage website: The Sage-Pari-Magma ecosystem

The biggest difference between Sage and Magma is that Magma is closed source, not free, and difficult for users to extend. This means that most of Magma cannot be changed except by the core Magma developers, since Magma itself is well over two million lines of compiled C code, combined with about a half million lines of interpreted Magma code (that anybody can read and modify). In designing Sage, we carried over some of the excellent design ideas from Magma, such as the parent, element, category hierarchy.

Any mathematician who is serious about doing extensive computational work in algebraic number theory and arithmetic geometry is strongly urged to become familiar with all three systems, since they all have their pros and cons. Pari is sleek and small, Magma has much unique functionality for computations in arithmetic geometry, and Sage has a wide range of functionality in most areas of mathematics, a large developer community, and much unique new code.

I also noticed that Sage provides an interface to Shoup's NTL through ntl. functions. Good to know!

1 comment

Firefox Time Tracker : update 2 posted February 2015

I shipped!

You can get the .xpi on the github repo. Just open it with Firefox and no restart is needed! (Ctrl+O in firefox)

For now it's very basic. You will see this icon next to the close button:

firefox time tracker

Yes I know I should create a custom icon :D but I was too busy coding. You will then see some basic statistics of the day.

firefox time tracker

I'm now working on making this page nice with pretty graphics and more statistics (week, month, tracking of the most visited website of the week...).

So if you want to try my plugin, know that it works (so far)! And that you should pay this blog a visit because I'm planning on updating it.

comment on this story

A tutorial on how to get into an admin account on ANY windows. posted February 2015


A step by step tutorial showing you how to get admin credentials on a windows machine: http://imgur.com/gallery/H8obU


  • reboot in start-up repair mode
  • read privacy statement of one menu should open notepad
  • thanks to notepad replace sethc 1 with cmd
  • so now when you press 5 times on shift it will call cmd instead of sethc 1
  • you know have a shell, use command net localgroup Administrators to get a list of the admins
  • type net user <ACCOUNT NAME HERE> * to change one account's password.

If you're looking for a "fix", microsoft advise you to turn off sticky keys all completely

And here's another exploit for windows 98

Note that as soon as you can access the hard drive, you don't need to use the first trick and can switch around programs in system32 as you wish (except if windows is encrypted with bitlocker). For example you can do this with an ubuntu live cd and swap cmd with the magnifier tool and you will be able to do the same thing.

comment on this story

Firefox Time Tracker posted February 2015

I always thought I could reduce the amount of time slacking if I could track my time on facebook, reddit, hackernews... like I track my calories intake to reduce my weight. I couldn't find a good firefox plugin for that so I decided to make one.

I'm opensourcing the code right here: https://github.com/mimoo/FirefoxTimeTracker

I'm pretty surprised with Firefox SDK and it's actually easier than what I thought to build a browser plugin. It might also help that everything Mozilla documents is clear and pretty.

At the moment the code successfully logs the time passed on different websites across sessions. It just lacks nice graphs. If you want to try it just wait a couple days until I ship.

comment on this story

Kleptography: hidding a private key in plain sight posted January 2015

from wikipedia:

A kleptographic attack is an attack which uses asymmetric encryption to implement a cryptographic backdoor. For example, one such attack could be to subtly modify how the public and private key pairs are generated by the cryptosystem so that the private key could be derived from the public key. In a well-designed attack, the outputs of the infected cryptosystem would be computationally indistinguishable from the outputs of the corresponding uninfected cryptosystem. If the infected cryptosystem is a black-box implementation such as a hardware security module, a smartcard, or a Trusted Platform Module, a successful attack could go completely unnoticed.

I've seen implementations of this in the wild, here on reddit (python) and here on lobsters (C#)

comment on this story

Explanation of Shellshock posted January 2015

Here's an awesome explanation of shellshock: https://bitbucket.org/carter-yagemann/shellshock/src/f0a88573f912?at=master

This repository contains useful documents which I have written to help educate the cybersecurity community on the "ShellShock" bash vulnerability. These documents are designed to help facilitate learning, including on how to identify possibly vulnerable services and how to remediate such vulnerabilities.

It's actually the clearest explanation I've seen on the subject.

Made by these guys from Syracuse:

  • Carter Yagemann
  • Amit Ahlawat
comment on this story