diff --git a/go.mod b/go.mod index 1806bf36d..019edd94c 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ require ( github.com/pkg/errors v0.9.1 github.com/urfave/cli v1.22.15 github.com/xtaci/kcp-go/v5 v5.6.8 - github.com/xtaci/qpp v1.1.4 + github.com/xtaci/qpp v1.1.5 github.com/xtaci/smux v1.5.24 github.com/xtaci/tcpraw v1.2.25 golang.org/x/crypto v0.24.0 diff --git a/go.sum b/go.sum index 1154d34b7..6d4ea8659 100644 --- a/go.sum +++ b/go.sum @@ -81,6 +81,8 @@ github.com/xtaci/qpp v1.1.3 h1:mYCWbvT4c9EItrVsSD8J3KIW83zBfEQ6dZDfFs0rHZs= github.com/xtaci/qpp v1.1.3/go.mod h1:dJS3usaXNMbWxZSWCAdxz01UgJcz9wXDkd4BccDY/V0= github.com/xtaci/qpp v1.1.4 h1:J4uUJy+7KVFWTduuIQr/MCiD9Ik8x7AblOtYbwMhC+s= github.com/xtaci/qpp v1.1.4/go.mod h1:dJS3usaXNMbWxZSWCAdxz01UgJcz9wXDkd4BccDY/V0= +github.com/xtaci/qpp v1.1.5 h1:EpFDE3lpCkOtGVIQTxww0tjQEOOCohuBuISL+c7/iWw= +github.com/xtaci/qpp v1.1.5/go.mod h1:dJS3usaXNMbWxZSWCAdxz01UgJcz9wXDkd4BccDY/V0= github.com/xtaci/smux v1.5.24 h1:77emW9dtnOxxOQ5ltR+8BbsX1kzcOxQ5gB+aaV9hXOY= github.com/xtaci/smux v1.5.24/go.mod h1:OMlQbT5vcgl2gb49mFkYo6SMf+zP3rcjcwQz7ZU7IGY= github.com/xtaci/tcpraw v1.2.25 h1:VDlqo0op17JeXBM6e2G9ocCNLOJcw9mZbobMbJjo0vk= diff --git a/vendor/github.com/xtaci/qpp/README.md b/vendor/github.com/xtaci/qpp/README.md index 02057cefc..5f546085d 100644 --- a/vendor/github.com/xtaci/qpp/README.md +++ b/vendor/github.com/xtaci/qpp/README.md @@ -36,10 +36,13 @@ The [Quantum Permutation Pad](https://link.springer.com/content/pdf/10.1140/epjq - **Future-Proof**: As quantum computers become more powerful, classical cryptographic schemes (like RSA and ECC) are at risk. QPP provides a quantum-resistant alternative. - **Secure Communication**: Useful for secure communications in quantum networks and for safeguarding highly sensitive data. -## Examples -The count of Permutation Matrics in 8-qubit, it's been randomly selected from based on the seed provided. -图片 +## Security design in this implementatoin +The overall security is equivalent to **1680-bit** symmetric encryption, with each **BYTE** possessing a cryptographic strength of 256 bits. +The number of permutation matrices in an 8-qubit system is determined based on the provided seed and is selected randomly. +image + +Try directly from https://github.com/xtaci/kcptun/releases with the ```-QPP``` option enabled. ## Usage ```golang diff --git a/vendor/github.com/xtaci/qpp/qpp.go b/vendor/github.com/xtaci/qpp/qpp.go index 1dea28be6..83d9fa222 100644 --- a/vendor/github.com/xtaci/qpp/qpp.go +++ b/vendor/github.com/xtaci/qpp/qpp.go @@ -8,7 +8,7 @@ import ( "encoding/binary" "fmt" "math/big" - "math/rand" + "math/rand/v2" "golang.org/x/crypto/pbkdf2" ) @@ -25,6 +25,12 @@ const ( CHUNK_DERIVE_LOOPS = 1024 ) +type Source uint64 + +func (s Source) Uint64() uint64 { + return uint64(s) +} + // QuantumPermutationPad represents the encryption/decryption structure using quantum permutation pads // QPP is a cryptographic technique that leverages quantum-inspired permutation matrices to provide secure encryption. type QuantumPermutationPad struct { @@ -106,8 +112,9 @@ func (qpp *QuantumPermutationPad) CreatePRNG(seed []byte) *rand.Rand { mac.Write([]byte(PM_SELECTOR_IDENTIFIER)) sum := mac.Sum(nil) dk := pbkdf2.Key(sum, []byte(PRNG_SALT), PBKDF2_LOOPS, 8, sha1.New) // Derive a key for PRNG - source := rand.NewSource(int64(binary.LittleEndian.Uint64(dk))) // Create random source - return rand.New(source) // Create and return PRNG + //source := rand.NewSource(int64(binary.LittleEndian.Uint64(dk))) // Create random source + //return rand.New(source) // Create and return PRNG + return rand.New(Source(binary.LittleEndian.Uint64(dk))) } // EncryptWithPRNG encrypts the data using the Quantum Permutation Pad with a custom PRNG diff --git a/vendor/modules.txt b/vendor/modules.txt index a129b124a..3e2b4087b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -38,7 +38,7 @@ github.com/urfave/cli # github.com/xtaci/kcp-go/v5 v5.6.8 ## explicit; go 1.21 github.com/xtaci/kcp-go/v5 -# github.com/xtaci/qpp v1.1.4 +# github.com/xtaci/qpp v1.1.5 ## explicit; go 1.22.3 github.com/xtaci/qpp # github.com/xtaci/smux v1.5.24