diff --git a/go.mod b/go.mod
index f5bc73bfc..0e35a2d84 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.1
+ github.com/xtaci/qpp v1.1.2
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 5fb2fe0fd..8dc8db33a 100644
--- a/go.sum
+++ b/go.sum
@@ -75,6 +75,8 @@ github.com/xtaci/qpp v1.1.0 h1:PsIxn2lE2MdbbfNmNeTm1iWKw/k8DI/XkU5brOno5H0=
github.com/xtaci/qpp v1.1.0/go.mod h1:dJS3usaXNMbWxZSWCAdxz01UgJcz9wXDkd4BccDY/V0=
github.com/xtaci/qpp v1.1.1 h1:UaZCbcwvKTx+pSXi/fQufXg2R82Gn4VBPs/zjGB9FwA=
github.com/xtaci/qpp v1.1.1/go.mod h1:dJS3usaXNMbWxZSWCAdxz01UgJcz9wXDkd4BccDY/V0=
+github.com/xtaci/qpp v1.1.2 h1:QDJgYCtZdmKNKZ24uNPLq3cgHnp2irnJJBRtQ0gWZlU=
+github.com/xtaci/qpp v1.1.2/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 77e4ed1bc..02057cefc 100644
--- a/vendor/github.com/xtaci/qpp/README.md
+++ b/vendor/github.com/xtaci/qpp/README.md
@@ -36,6 +36,49 @@ 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.
+
+
+
+## Usage
+```golang
+Internal PRNG:
+
+func main() {
+ seed := make([]byte, 32)
+ io.ReadFull(rand.Reader, seed)
+
+ qpp := NewQPP(seed, 1024, 8)
+
+ msg := make([]byte, 65536)
+ io.ReadFull(rand.Reader, msg)
+
+ qpp.Encrypt(msg)
+ qpp.Decrypt(msg)
+}
+```
+
+```golang
+External PRNG:
+
+func main() {
+ seed := make([]byte, 32)
+ io.ReadFull(rand.Reader, seed)
+
+ qpp := NewQPP(seed, 1024, 8)
+
+ msg := make([]byte, 65536)
+ io.ReadFull(rand.Reader, msg)
+
+ rand_enc := qpp.CreatePRNG(seed)
+ rand_dec := qpp.CreatePRNG(seed)
+
+ qpp.EncryptWithPRNG(msg, rand_enc)
+ qpp.DecryptWithPRNG(msg, rand_dec)
+}
+```
+
## Conclusion
The Quantum Permutation Pad is a promising approach in the field of quantum cryptography, utilizing quantum mechanical properties to achieve secure communication. By applying quantum permutations to encrypt and decrypt data, QPP ensures high security and leverages the unique capabilities of quantum technology. As research and technology in quantum computing and quantum communication advance, protocols like QPP will play a crucial role in the next generation of secure communication systems.
diff --git a/vendor/github.com/xtaci/qpp/qpp.go b/vendor/github.com/xtaci/qpp/qpp.go
index 2c665d9d8..f448ab28a 100644
--- a/vendor/github.com/xtaci/qpp/qpp.go
+++ b/vendor/github.com/xtaci/qpp/qpp.go
@@ -1,6 +1,7 @@
package qpp
import (
+ "crypto/aes"
"crypto/hmac"
"crypto/sha1"
"crypto/sha256"
@@ -11,23 +12,29 @@ import (
"golang.org/x/crypto/pbkdf2"
)
-const PAD_IDENTIFIER = "QPP_%b"
-const PM_SELECTOR_IDENTIFIER = "PERMUTATION_MATRIX_SELECTOR"
-const SHUFFLE_SALT = "___QUANTUM_PERMUTATION_PAD_SHUFFLE_SALT___"
-const PRNG_SALT = "___QUANTUM_PERMUTATION_PAD_PRNG_SALT___"
-const NATIVE_BYTE_LENGTH = 8 // bit
-const PBKDF2_LOOPS = 128
+// Constants used in Quantum Permutation Pad (QPP) for identifiers, salts, and configuration
+const (
+ PAD_IDENTIFIER = "QPP_%b"
+ PM_SELECTOR_IDENTIFIER = "PERMUTATION_MATRIX_SELECTOR"
+ SHUFFLE_SALT = "___QUANTUM_PERMUTATION_PAD_SHUFFLE_SALT___"
+ PRNG_SALT = "___QUANTUM_PERMUTATION_PAD_PRNG_SALT___"
+ NATIVE_BYTE_LENGTH = 8 // Bit length for native byte
+ PBKDF2_LOOPS = 128 // Number of iterations for PBKDF2
+)
+// 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 {
- pads [][]byte // encryption
- rpads [][]byte // decryption
-
- numPads uint16 // number of pads
- qubits uint8 // number of quantum bits
- encRand *rand.Rand // random source for pattern selection
- decRand *rand.Rand // random source for pattern selection
+ pads [][]byte // Encryption pads, each pad is a permutation matrix for encryption
+ rpads [][]byte // Decryption pads, each pad is a reverse permutation matrix for decryption
+ numPads uint16 // Number of pads (permutation matrices)
+ qubits uint8 // Number of quantum bits, determines the size of each pad
+ encRand *rand.Rand // Default random source for encryption pad selection
+ decRand *rand.Rand // Default random source for decryption pad selection
}
+// NewQPP creates a new Quantum Permutation Pad instance with the provided seed, number of pads, and qubits
+// The seed is used to generate deterministic pseudo-random number generators (PRNGs) for both encryption and decryption
func NewQPP(seed []byte, numPads uint16, qubits uint8) *QuantumPermutationPad {
qpp := &QuantumPermutationPad{
numPads: numPads,
@@ -37,40 +44,43 @@ func NewQPP(seed []byte, numPads uint16, qubits uint8) *QuantumPermutationPad {
qpp.pads = make([][]byte, numPads)
qpp.rpads = make([][]byte, numPads)
+ // Initialize and shuffle pads to create permutation matrices
for i := uint16(0); i < numPads; i++ {
qpp.pads[i] = make([]byte, 1< 0; i-- {
+ block.Encrypt(sum, sum)
+ j := binary.LittleEndian.Uint64(sum) % uint64(i)
pad[i], pad[j] = pad[j], pad[i]
- })
+ }
}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index ccdda511b..7a0d09e91 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.0
+# github.com/xtaci/qpp v1.1.2
## explicit; go 1.22.3
github.com/xtaci/qpp
# github.com/xtaci/smux v1.5.24