How I should have done password crypto for DWiki

DWiki (the software behind WanderingThoughts ) uses cryptography for thetraditional web application things, namely login passwords and logincookies; it stores hashed versions of login passwords, and it signs itslogin cookies. I had very little idea what I was doing when I wrote thatcode, so DWiki 's current use of cryptography is better off not discussedin polite company; instead, let's discuss how it should work.

(I was so stupid that I didn't use HMAC, despite it being in thePython


1984年發生了什麼事?

村上春樹以1984年為《1Q84》這套長篇小說書的入口,到底公元1984年發生過什麼大事呢?

《1984》是George Orwell於1949年出版,講述未來(1984年)某個極權政府統治下的國度的小說,故事中出現的Big Brother角

Continue reading...

戀愛不安


作者:朱天心
出版:印刻出版社
出版日期:2010年1月

這是一本非常之殘忍的愛情小說。

是的,非常之殘忍。這本小說沒有任何血腥暴力,沒有令人意想不到的推理謎團,沒有為了令人不安而堆砌出來的離奇情節。這本愛情

Report Card

I talked earlier about resetting my thermostat during university days. But it was before my primary school graduation when I realized for the first time in my life that I was capable of pressing the amazing reset button.

Looking back on my primary school days, I don't recall much except my mediocre academic performance; I just know I always ranked more than ten in my class. At any rate, I remembered the soccer league tables far better than what the teachers said during the class.

Then one afternoon in my final

兩個不快樂的哲學家

我有個哲學家朋友(哲學家甲)因為論文屢次不被學術期刊接納,覺得很失意;眼見有些朋友年年有論文刊登,他更不是味兒。我不知道他的生活整體上是否快樂,但在學術發展方面,他顯然是不快樂的。

我另有一個哲學家朋友

Reset

Needless to say, nephrologists talk a lot about the blood's salt or sodium content. We teach our medical students that kidneys help to keep our body's solute (composed primarily of sodium) concentration or so-called osmolality within a narrow range. No more, no less. It would be hard to imagine how nature works it out to keep everything in such a fine balance.

Now. Maybe you think our body is too unwieldy or rigid to operate only within a narrow range of osmolality. "Why

A Python safety tip: Do notice that things can throw exceptions

Recently, I discovered and fixed a long-standing bug in DWiki . Thebug itself was simple, but typical of a certain kind of error thatI keep making in Python: I had forgotten that the Cookie module could throw an exception,so I didn't catch it.

(Well, my general error code logged it, but I mean DWiki itself didn't catch it and do anything sensible; in this case,either ignoring the broken HTTP cookie header or perhaps reporting asecurity error.)

This


沒有「身段」,何來「放下」?

上次對政府有種「氣數已盡」的感覺,是董建華腳痛的時候。後來他的腳實在痛得受不了,香港就開始有運行。

當年的民怨,從「八萬五」累積至沙士,來到反《二十三條》終於給你一鋪清袋。那次遊行從維園開始,直至來到金

戒癮

戒癮

都說我是嚴母。

你還未滿六個月,我就要你戒奶嘴。

當初是我把奶嘴放你口,然後你沒了奶嘴就睡不穩,夜裏起來n次,就為了掉了奶嘴。我按捺不住,非要你戒掉不可。爸爸說你還那麼小,含奶嘴不外乎為了安全感,現在
Continue reading...

享受生活

享受生活

朋友年屆四十,初為人父。

我問感受如何。

朋友說,他覺得無比自豪。往後,他要好好地生活下去,看女兒長大,與她分享更多。

認識朋友是因讀書的關係,那時他是一位每星期六天,每天工作十四小時的燒焊工人。月
Continue reading...