Skip to content

Commit

Permalink
Better chacha20 implementation PR#205
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Auernhammer authored and arthurkiller committed Jul 26, 2018
1 parent 323704e commit 6bcbad8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ install:
- go get golang.org/x/crypto/blowfish
- go get golang.org/x/crypto/cast5
- go get golang.org/x/crypto/salsa20
- go get github.com/Yawning/chacha20
- go get github.com/aead/chacha20
- go install ./cmd/shadowsocks-local
- go install ./cmd/shadowsocks-server
script:
Expand Down
7 changes: 4 additions & 3 deletions shadowsocks/encrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import (
"encoding/binary"
"errors"
"io"
"github.com/Yawning/chacha20"

"github.com/aead/chacha20"
"golang.org/x/crypto/blowfish"
"golang.org/x/crypto/cast5"
"golang.org/x/crypto/salsa20/salsa"
Expand Down Expand Up @@ -101,11 +102,11 @@ func newRC4MD5Stream(key, iv []byte, _ DecOrEnc) (cipher.Stream, error) {
}

func newChaCha20Stream(key, iv []byte, _ DecOrEnc) (cipher.Stream, error) {
return chacha20.NewCipher(key, iv)
return chacha20.NewCipher(iv, key)
}

func newChaCha20IETFStream(key, iv []byte, _ DecOrEnc) (cipher.Stream, error) {
return chacha20.NewCipher(key, iv)
return chacha20.NewCipher(iv, key)
}

type salsaStreamCipher struct {
Expand Down

0 comments on commit 6bcbad8

Please sign in to comment.