Skip to content

Commit

Permalink
add support for Quantum Permutation Pad cryptography
Browse files Browse the repository at this point in the history
  • Loading branch information
xtaci committed Dec 16, 2024
1 parent 87de0f1 commit 01052c3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cmd/grasshopper/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func init() {
rootCmd.PersistentFlags().StringSliceVarP(&config.NextHops, "nexthops", "n", []string{"127.0.0.1:3000"}, "Servers to randomly forward to")
rootCmd.PersistentFlags().StringVar(&config.KI, "ki", "it's a secret", "Secret key to encrypt and decrypt for the last hop(client-side)")
rootCmd.PersistentFlags().StringVar(&config.KO, "ko", "it's a secret", "Secret key to encrypt and decrypt for the next hops")
rootCmd.PersistentFlags().StringVar(&config.CI, "ci", "3des", "Cryptography method for incoming data. Available options: aes, aes-128, aes-192, salsa20, blowfish, twofish, cast5, 3des, tea, xtea, sm4, none")
rootCmd.PersistentFlags().StringVar(&config.CO, "co", "3des", "Cryptography method for incoming data. Available options: aes, aes-128, aes-192, salsa20, blowfish, twofish, cast5, 3des, tea, xtea, sm4, none")
rootCmd.PersistentFlags().StringVar(&config.CI, "ci", "3des", "Cryptography method for incoming data. Available options: aes, aes-128, aes-192, qpp, salsa20, blowfish, twofish, cast5, 3des, tea, xtea, sm4, none")
rootCmd.PersistentFlags().StringVar(&config.CO, "co", "3des", "Cryptography method for incoming data. Available options: aes, aes-128, aes-192, qpp, salsa20, blowfish, twofish, cast5, 3des, tea, xtea, sm4, none")
rootCmd.PersistentFlags().DurationVar(&config.Timeout, "timeout", 60*time.Second, "Idle timeout duration for a UDP connection")
}
4 changes: 3 additions & 1 deletion cmd/grasshopper/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var (
Version = "undefined"

// allCryptoMethods lists all supported cryptographic methods.
allCryptoMethods = []string{"none", "sm4", "tea", "aes", "aes-128", "aes-192", "blowfish", "twofish", "cast5", "3des", "xtea", "salsa20"}
allCryptoMethods = []string{"none", "qpp", "sm4", "tea", "aes", "aes-128", "aes-192", "blowfish", "twofish", "cast5", "3des", "xtea", "salsa20"}
)

// startCmd represents the start command
Expand Down Expand Up @@ -123,6 +123,8 @@ func newCrypt(pass []byte, method string) grasshopper.BlockCrypt {
block, _ = grasshopper.NewXTEABlockCrypt(pass[:16])
case "salsa20":
block, _ = grasshopper.NewSalsa20BlockCrypt(pass)
case "qpp":
block, _ = grasshopper.NewQPPCrypt(pass)
}
return block
}
Expand Down

0 comments on commit 01052c3

Please sign in to comment.