qpp

package module
v1.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2024 License: GPL-3.0 Imports: 9 Imported by: 4

README

Quantum Permutation Pad

The Quantum Permutation Pad (QPP) is a cryptographic protocol designed to leverage the principles of quantum mechanics for secure communication. While the exact details of the QPP can vary based on the specific implementation and the theoretical model, the general concept involves using quantum properties such as superposition and entanglement to enhance the security of data transmission. Here’s an overview of the QPP and its relationship to quantum mechanics and cryptography:

Key Concepts of Quantum Permutation Pad

  1. Quantum Mechanics Principles: QPP relies on fundamental quantum mechanics principles, particularly superposition (the ability of quantum bits to be in multiple states simultaneously) and entanglement (the correlation between quantum bits regardless of distance).

  2. Quantum Bits (Qubits): Instead of classical bits (which are either 0 or 1), QPP uses qubits, which can be in a state of 0, 1, or any quantum superposition of these states.

  3. Permutation Operations: Permutations in the context of QPP refer to rearranging the order of qubits in a quantum state. These permutations can be thought of as quantum gates that alter the qubit states in a manner that is hard to predict without the correct key.

Functionality of Quantum Permutation Pad

  1. Key Generation: The QPP protocol involves generating a key based on quantum states. This key can be a set of quantum gates or permutation operations that will be applied to the qubits.

  2. Encryption:

    • Prepare Qubits: The sender prepares a set of qubits in a known quantum state.
    • Apply Permutations: Using the generated key, the sender applies a series of permutation operations to the qubits. These permutations act as the encryption process, transforming the quantum state into an encrypted form.
  3. Transmission: The encrypted quantum state (the qubits after permutation) is transmitted to the receiver.

  4. Decryption:

    • Reverse Permutations: The receiver, who has the same key, applies the inverse of the permutation operations to the received qubits. This step decrypts the quantum state, returning it to its original form.
    • Measurement: The receiver then measures the qubits to obtain the classical data.

Security Aspects

  • Quantum No-Cloning Theorem: One of the fundamental principles that enhance the security of QPP is the no-cloning theorem, which states that it is impossible to create an identical copy of an arbitrary unknown quantum state. This property prevents eavesdroppers from copying the qubits during transmission.
  • Quantum Key Distribution (QKD): QPP can be integrated with QKD protocols like BB84 to securely distribute the key used for the permutation operations. QKD ensures that any eavesdropping attempts can be detected.
  • Unpredictability of Quantum States: The inherent unpredictability of quantum measurements adds an extra layer of security, making it extremely difficult for an attacker to gain useful information without the correct key.

Applications and Benefits

  • High Security: QPP offers higher security levels compared to classical cryptographic methods, leveraging the unique properties of quantum mechanics.
  • 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.

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

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)
}
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.


Documentation

Index

Constants

View Source
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
	CHUNK_DERIVE_SALT      = "___QUANTUM_PERMUTATION_PAD_SEED_DERIVE___"
	CHUNK_DERIVE_LOOPS     = 1024
)

Constants used in Quantum Permutation Pad (QPP) for identifiers, salts, and configuration

Variables

This section is empty.

Functions

func QPPMinimumPads added in v1.1.4

func QPPMinimumPads(qubits uint8) int

QPPMinimumPads calculates the minimum number of pads required based on the number of qubits This is derived from the minimum seed length needed for the permutations

func QPPMinimumSeedLength added in v1.1.4

func QPPMinimumSeedLength(qubits uint8) int

QPPMinimumSeedLength calculates the length required for the seed based on the number of qubits This ensures that the seed has sufficient entropy for the required permutations

Types

type QuantumPermutationPad

type QuantumPermutationPad struct {
	// contains filtered or unexported fields
}

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.

func NewQPP

func NewQPP(seed []byte, numPads uint16, qubits uint8) *QuantumPermutationPad

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 (*QuantumPermutationPad) CreatePRNG added in v1.0.4

func (qpp *QuantumPermutationPad) CreatePRNG(seed []byte) *rand.Rand

CreatePRNG creates a deterministic pseudo-random number generator based on the provided seed It uses HMAC and PBKDF2 to derive a random seed for the PRNG

func (*QuantumPermutationPad) Decrypt

func (qpp *QuantumPermutationPad) Decrypt(data []byte)

Decrypt decrypts the given data using the Quantum Permutation Pad with the default PRNG It selects a reverse permutation matrix based on a random index and uses it to restore each byte of the data

func (*QuantumPermutationPad) DecryptWithPRNG added in v1.0.4

func (qpp *QuantumPermutationPad) DecryptWithPRNG(data []byte, rand *rand.Rand)

DecryptWithPRNG decrypts the data using the Quantum Permutation Pad with a custom PRNG This function shares the same permutation matrices

func (*QuantumPermutationPad) Encrypt

func (qpp *QuantumPermutationPad) Encrypt(data []byte)

Encrypt encrypts the given data using the Quantum Permutation Pad with the default PRNG It selects a permutation matrix based on a random index and uses it to permute each byte of the data

func (*QuantumPermutationPad) EncryptWithPRNG added in v1.0.4

func (qpp *QuantumPermutationPad) EncryptWithPRNG(data []byte, rand *rand.Rand)

EncryptWithPRNG encrypts the data using the Quantum Permutation Pad with a custom PRNG This function shares the same permutation matrices

type Source added in v1.1.5

type Source uint64

func (Source) Uint64 added in v1.1.5

func (s Source) Uint64() uint64

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL