david wong

Hey! I'm David, cofounder of zkSecurity and the author of the Real-World Cryptography book. I was previously a crypto architect at O(1) Labs (working on the Mina cryptocurrency), before that 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.

Quick access to articles on this page:

more on the next page...

Where have I been? posted August 2014

I've been on holidays, not doing much, mostly enjoying what is sadly my very last summer holiday sheds a tear.

But as usual, when I'm not productive I get all grumpy and I feel like I'm losing precious time.

Before holidays: "I'll have plenty of time to learn and code!"
During holidays: "Man I'm just gonna watch another episode of this new tv show"

So these past few weeks I chose to put android, google glass, unity and oculus asides. I'll deal with them later.

Now It's time to learn. And you can't create without learning the technologies first!

So the first thing I did was take a look at React and MongoDB. After spending a few hours with React I knew I didn't need it and fell in love with Angular. MongoDB seems pretty cool and it's my first time with a noSQL database (I followed the awesome Andrew Burgess tutorial on Tutsplus).

I've been reading a lot about Rails lately and I'm trying to gather all the info I need before starting my next project which will involve those technologies that I've never used before:

  • Ruby on Rails

  • Slim

  • Angular

  • CoffeeScript

I already have a simple but useful project in mind.

I start school on September the 1st and I also want to be able to spend a week with GOlang before having too many things to do what I want.

comment on this story

Weblang posted April 2014

I've been writing html, xhtml, and now html5 for ages. I think I started in 2001 (13 years ago).

I had to go through <br> becoming <br /> becoming <br> again.

I had to go through different doctypes

I had to go through new divs like <header> and <footer>

But I never had to go through a syntax change. Why is that? I don't understand why HTML is a language based on tags. It is unnecessary and it just adds time and confusion to typing in html. I haven't ran into any project directed at changing that syntax. And I thought, why not doing it myself? (and if there is already such a project please tell me!)

So I thought about a new language to write static web pages called web or weblang. No tags. Indentation. Simple doctype.

A simple index.web would looks like that:

\web:1 // this is a doctype

\head

$title: 'Weblang example';
$css: 'css/app.css';

\body

$header .monheader{
    $h1 "Weblang";
}

$section #introduction{
    $h2 "What is Weblang?";
    $p "Weblang is an elegant way of writing static webpages"
    "HTML is annoying to write." // there will be a breakline here
    $p{
        what about just writing text like this,
        it's kinda easier
    }
}

// what about just writing text
This is a text block, it will just render as text
in this text I want a list here : $ul{
    $li "with text in it";
}

$ul .links{
    $li{
        $a "more info" href: 'https://github.com/mimoo/weblang';
    }
    $li $a{
        tags can be chained
    }
}

$javascript 'js/jquery.js';
$script 'js/script.js' type: 'javascript';

This is just a first draft. The biggest problem is that plain text and code is mixed. The trick I used here is to use $ to tell the render engine that it is not plaintext. Might not be super clever. I need to brainstorm a bit more about this.

Also I need to look at sass' code to see how a compiler works. Seems to be a bunch of regex.

2 comments

Ruby, Go, Rust posted April 2014

I've been planning to code my next web project with Ruby on Rails.

But two languages have also been catching my attention. Go and Rust.

And today, I ran into two wonderful websites:

Those websites are so pretty that it just makes me want to read them! Great complement to learnXinYminutes.

Now I just have to find a project to code with these languages =)

comment on this story

Nodster day 3 posted April 2014

I can't stop coding this thing. What I've done today:

  • This is the query I'm using in google now : [your search] mp3 -facebook -youtube -soundcloud -last.fm -amazon -dailymotion -bleep
  • I'm now parsing google and the following links with jQuery: $(body).find('a') and then looking for good links with a regex. This is so much more quicker!
  • There is still a part that is taking some time though, it's the metadata fetching. I still have to get every mp3 independently and download enough bits to learn its metadatas...

But it is working quite well as it is!

EDIT: I'm now fetching the metadata in parallel and it's super fast! I've also fixed a ton.

comment on this story

Nodster day 2 posted April 2014

Okay. I'm not gonna talk too much about my new node-webkit project Nodster because I also have a lot of studies to do (exams next week!).

nodster

The problems

  • I'm still not streaming the mp3s properly. I think that I'll never be able to do it through the html5 audio and I need to look up other solutions. The do it yourself approach seems appealing and I'm gonna look into node speaker and node lame.
  • I'm using node google to crawl google and get links. It's not working properly and I'll have to dig into crawling google myself.
  • I'm parsing pages with a regex, it really seems to be slowing everything and I'm gonna look into using a dom parser. I heard about cheerio, is it good?

What does the app do?

  • Right now it's crawling google and avoiding useless websites like youtube, facebook, soundcloud, etc...
  • Then it goes one step deeper and looks for .mp3
  • It checks each mp3 for size (thanks to the headers) and download a bit of each to get metadata.
  • Displays the metadata and a link to play the file
  • If the link is clicked, the mp3 is downloaded to a buffer.mp3 and played.

The main problem is that it's slow, and it's not finding enough links. I could try to parse bing, yahoo and a list of mp3 finders. Or I could maybe try to optimize the requests to google...

Anyway, this app is bringing me a lot of problems to solve and it's pretty interesting :) some people have already forked it and someone has already requested a pull, so if you wanna help. Come and fork it!

2 comments

Nodster (node-webkit) posted April 2014

As always when I have to study for exams I find a gazillion other things to do.

Last night I downloaded node-webkit. I've been slacking when doing QT and WxPython because they were boring. And I thought that node-webkit would be as well. One hello world later and I was amazed at how easy it was to create desktop application with it!

Spent my day trying to figure out what are pipes, streams, websockets... I have to admit I have a long way to go but I really enjoyed this session of node.js.

I had this idea of a free spotify that would just get mp3s from google. There are a lot of legal issues around so I'm wondering if I should really keep this one, but here is what I did today: Nodster (Node-webkit + Napster).

nodster nodster2

The code is not pretty as I was trying and discovering new things all along. The design is crappy but this is obviously because I had other better things to code first :) I want to get the metadata of the mp3s to sort them more easily (most of them seems to have metadatas) but I have trouble figuring out how to do it.

Also it uses mp3skull.com to find mp3s, there are a lot others but eventually I wanted to just use google and crawl hard.

I could also add pictures for albums and... so many things to do!

If you want to help, fork away :)

2 comments

How good is flask? posted April 2014

I've used Django for my last project and I found the documentation unclear and the list of things I had to do to code simple things and deploy were... a bit too much for a simple project.

I've glanced at the Flask documentation and have found it über-clear. The syntax seems to be pretty straight-forward as well. I'm really thinking about learning Flask for my next project and putting Django on hold. What do you guys think?

There's also a talk on web2py in the current PyCon. I don't know if it's for me but I really need something I can do quick prototypes on.

Sometimes I wonder if I should go back to PHP and try the new Laravel that really looks super cool :)

laracon

comment on this story