From ac0380509f47684b92d019628a27ee6e025b1be6 Mon Sep 17 00:00:00 2001 From: defia Date: Wed, 14 Jan 2015 22:32:14 +0800 Subject: [PATCH] fix test and benchmark. add test and benchmark for rc4-md5 --- shadowsocks/encrypt_test.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/shadowsocks/encrypt_test.go b/shadowsocks/encrypt_test.go index b2583d3..e9ff06d 100644 --- a/shadowsocks/encrypt_test.go +++ b/shadowsocks/encrypt_test.go @@ -139,6 +139,10 @@ func TestDES(t *testing.T) { testBlockCipher(t, "des-cfb") } +func TestRC4MD5(t *testing.T) { + testBlockCipher(t, "rc4-md5") +} + var cipherKey = make([]byte, 64) func init() { @@ -156,8 +160,9 @@ func BenchmarkRC4Init(b *testing.B) { func benchmarkCipherInit(b *testing.B, ci *cipherInfo) { key := cipherKey[:ci.keyLen] + buf := make([]byte, ci.ivLen) for i := 0; i < b.N; i++ { - ci.newBlock(key) + ci.newStream(key, buf, Encrypt) } } @@ -190,3 +195,8 @@ func BenchmarkDESInit(b *testing.B) { ci := cipherMethod["des-cfb"] benchmarkCipherInit(b, ci) } + +func BenchmarkRC4MD5Init(b *testing.B) { + ci := cipherMethod["rc4-md5"] + benchmarkCipherInit(b, ci) +}