Skip to content

Commit

Permalink
Merge pull request #58 from defia/develop
Browse files Browse the repository at this point in the history
fix tests and benchmarks. add test and benchmark for rc4-md5
  • Loading branch information
cyfdecyf committed Jan 27, 2015
2 parents 896ea0a + ac03805 commit 46c507b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion shadowsocks/encrypt_test.go
Expand Up @@ -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() {
Expand All @@ -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)
}
}

Expand Down Expand Up @@ -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)
}

0 comments on commit 46c507b

Please sign in to comment.