SHA-3 最後審查...

Schneier on Security 上看到 SHA-3 的消息:「SHA-3 to Be Announced」。

1997 年,NIST 要找尋 Data Encryption Standard (DES) 的下一代標準,發起了有名的 AES 遴選計畫,也就是 Advanced Encryption Standard process

公開遴選 AES 的成果就是在 2001 年 NIST 選出 Rijndael,由 Vincent RijmenJoan Daemen 兩位比利時密碼學家所發展出的對稱式加密系統。這個成果以現在來看是相當受到好評的:從 1998 年 Rijndael 問世到現在已經將近 15 年,成為官方標準後也超過 10 年,在這麼長時間接受全世界密碼學家檢驗後,有效的攻擊 (full cycle,可以破解實際流量的演算法) 是 2009 年一系列針對 192bits 與 256bits 的攻擊 (Related-key attack),以及 2011 年針對所有 128bits/192bits/256bits 的攻擊 (Key-recovery attack),仍然都還不到「實用」的程度 (用合理的硬體與資源破解)。

因此,當 MD5SHA-1 被攻的亂七八糟時 (2004 年王小雲教授往 ePrint 上丟出有名的「Collisions for Hash Functions MD4, MD5, HAVAL-128 and RIPEMD」論文,給出兩個 vector 直接給出證明已經找到 collision),NIST 也想要透過同樣的遴選過程建立標準。於是,在 2007 年 NIST 宣佈了遴選計畫,這套標準就叫做 SHA-3,遴選過程則可以在 NIST hash function competition 這邊查到。

歷經五年的競爭,SHA-3 終於要宣佈結果了... (也有可能宣佈「沒有得主」?)

儲存密碼的方式

主要是參考「Cryptographic Right Answers」這篇給的建議:

Password handling: As soon as you receive a password, hash it using scrypt or PBKDF2 and erase the plaintext password from memory.
Do NOT store users' passwords. Do NOT hash them with MD5. Use a real key derivation algorithm. PBKDF2 is the most official standard; but scrypt is stronger.
Please keep in mind that even if YOUR application isn't particularly sensitive, your users are probably re-using passwords which they have used on other, more sensitive, websites -- so if you screw up how you store your users' passwords, you might end up doing them a lot of harm.

其中 scrypt 是作者自己發展的演算法,這邊看看就好。

你可以用 PBKDF2 (RFC 2898)。這邊假設的前提是,你不需要常常重複計算使用者的密碼是否正確。在這個前提下,我們可以把演算法弄得很複雜,而且很耗時,要複雜到用硬體加速也無法產生實質上有效的攻擊。

如果你對密碼學這個領域並不熟,Colin Percival 這篇文章可以拿來當做起點,文章裡面告訴你,某些類型的問題會用某些工具解決。