Skip to content

Commit

Permalink
add aes-128 aes-192 cipher
Browse files Browse the repository at this point in the history
  • Loading branch information
xtaci committed Aug 16, 2016
1 parent 4a79d26 commit a04c959
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func main() {
cli.StringFlag{
Name: "crypt",
Value: "aes",
Usage: "methods for encryption: aes, tea, xor, none",
Usage: "methods for encryption: aes, aes-128, aes-192, tea, xor, none",
},
cli.StringFlag{
Name: "mode",
Expand Down Expand Up @@ -228,6 +228,10 @@ func main() {
block, _ = kcp.NewSimpleXORBlockCrypt(pass)
case "none":
block, _ = kcp.NewNoneBlockCrypt(pass)
case "aes-128":
block, _ = kcp.NewAESBlockCrypt(pass[:16])
case "aes-192":
block, _ = kcp.NewAESBlockCrypt(pass[:24])
default:
block, _ = kcp.NewAESBlockCrypt(pass)
}
Expand Down
6 changes: 5 additions & 1 deletion server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func main() {
cli.StringFlag{
Name: "crypt",
Value: "aes",
Usage: "methods for encryption: aes, tea, xor, none",
Usage: "methods for encryption: aes, aes-128, aes-192, tea, xor, none",
},
cli.StringFlag{
Name: "mode",
Expand Down Expand Up @@ -234,6 +234,10 @@ func main() {
block, _ = kcp.NewSimpleXORBlockCrypt(pass)
case "none":
block, _ = kcp.NewNoneBlockCrypt(pass)
case "aes-128":
block, _ = kcp.NewAESBlockCrypt(pass[:16])
case "aes-192":
block, _ = kcp.NewAESBlockCrypt(pass[:24])
default:
block, _ = kcp.NewAESBlockCrypt(pass)
}
Expand Down

0 comments on commit a04c959

Please sign in to comment.