quantum

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttackSearchSpace

type AttackSearchSpace struct {
	Size       int
	Dimensions int
	Payloads   []string
}

type BasisState

type BasisState struct {
	StateID     string
	StateLabel  string
	Amplitude   complex128
	Probability float64
	Observable  string
	Measurement interface{}
}

type BellStateType

type BellStateType int
const (
	PhiPlus BellStateType = iota
	PhiMinus
	PsiPlus
	PsiMinus
)

type ClassicalComparisonResults

type ClassicalComparisonResults struct {
	ClassicalSuccessRate float64
	ClassicalTime        time.Duration
	QuantumAdvantage     float64
}

type CoherenceMetrics

type CoherenceMetrics struct {
	CoherenceTime     time.Duration
	DecoherenceRate   float64
	FidelityScore     float64
	PurityScore       float64
	VonNeumannEntropy float64
}

type DecoherenceExploitEngine

type DecoherenceExploitEngine struct{}

func NewDecoherenceExploitEngine

func NewDecoherenceExploitEngine() *DecoherenceExploitEngine

type EntanglementAttackConfig

type EntanglementAttackConfig struct {
	EntanglementPairs    int
	CorrelationType      string
	NonLocalStrategy     string
	MeasurementOrder     string
	EntanglementSwapping bool
}

type EntanglementAttackEngine

type EntanglementAttackEngine struct{}

func NewEntanglementAttackEngine

func NewEntanglementAttackEngine() *EntanglementAttackEngine

func (*EntanglementAttackEngine) ExecuteEntanglementStrategy

func (e *EntanglementAttackEngine) ExecuteEntanglementStrategy(ctx context.Context, execution *QuantumAttackExecution, config *EntanglementAttackConfig) error

type EntanglementMetrics

type EntanglementMetrics struct {
	MaxEntanglement     float64
	AverageEntanglement float64
	EntanglementEntropy float64
	ConcurrenceScore    float64
	DiscordScore        float64
	BellViolation       float64
}

type EntanglementPair

type EntanglementPair struct {
	PairID              string
	Qubit1              int
	Qubit2              int
	EntanglementType    EntanglementType
	CorrelationStrength float64
	BellState           BellStateType
	NonLocalCorrelation float64
}

type EntanglementType

type EntanglementType int
const (
	EPRPair EntanglementType = iota
	GHZState
	WState
	ClusterState
	GraphState
	StabilizerState
)

type GateType

type GateType int
const (
	HadamardGate GateType = iota
	PauliXGate
	PauliYGate
	PauliZGate
	CNOTGate
	ToffoliGate
	PhaseGate
	RotationGate
	ControlledPhaseGate
	SWAPGate
	QFTGate
	GroverOperatorGate
)

type GroverSearchEngine

type GroverSearchEngine struct{}

func NewGroverSearchEngine

func NewGroverSearchEngine() *GroverSearchEngine

func (*GroverSearchEngine) ApplyDiffusion

func (g *GroverSearchEngine) ApplyDiffusion(ctx context.Context, state *QuantumState) error

func (*GroverSearchEngine) ApplyOracle

func (g *GroverSearchEngine) ApplyOracle(ctx context.Context, state *QuantumState, searchSpace *AttackSearchSpace) error

type InterferencePattern

type InterferencePattern struct {
	PatternID          string
	ConstructivePoints []InterferencePoint
	DestructivePoints  []InterferencePoint
	Visibility         float64
	Contrast           float64
	PhaseShift         float64
}

type InterferencePoint

type InterferencePoint struct {
	Position     int
	Amplitude    complex128
	Intensity    float64
	Phase        float64
	Interference InterferenceType
}

type InterferenceType

type InterferenceType int
const (
	ConstructiveInterference InterferenceType = iota
	DestructiveInterference
	PartialInterference
)

type MeasurementBasis

type MeasurementBasis int
const (
	ComputationalBasis MeasurementBasis = iota
	HadamardBasis
	BellBasis
	CustomBasis
)

type MeasurementGate

type MeasurementGate struct {
	MeasurementID string
	TargetQubits  []int
	Basis         MeasurementBasis
	Projectors    []ProjectionOperator
}

type MeasurementStatistics

type MeasurementStatistics struct {
	TotalMeasurements   int
	SuccessfulOutcomes  int
	MeasurementFidelity float64
	StatisticalError    float64
	QuantumNoise        float64
}

type NonLocalResult

type NonLocalResult struct {
	TargetModel            string
	ViolatesBellInequality bool
	CorrelationStrength    float64
	QuantumAdvantage       float64
}

type ProjectionOperator

type ProjectionOperator struct {
	OperatorID  string
	Matrix      [][]complex128
	Eigenvalue  complex128
	Probability float64
}

type QuantumAdvantageMetrics

type QuantumAdvantageMetrics struct {
	SpeedupFactor        float64
	SuccessRateBoost     float64
	SearchSpaceReduction float64
	ParallelismFactor    float64
	QuantumVolume        float64
	CircuitDepthSaving   float64
}

type QuantumAnnealingEngine

type QuantumAnnealingEngine struct{}

func NewQuantumAnnealingEngine

func NewQuantumAnnealingEngine() *QuantumAnnealingEngine

type QuantumAttackExecution

type QuantumAttackExecution struct {
	ExecutionID       string
	AttackType        QuantumAttackType
	TargetModels      []string
	QuantumCircuit    *QuantumCircuit
	InitialState      *QuantumState
	FinalState        *QuantumState
	Measurements      []*QuantumMeasurement
	StartTime         time.Time
	EndTime           time.Time
	Status            QuantumExecutionStatus
	Results           *QuantumAttackResults
	QuantumAdvantage  float64
	ClassicalBaseline float64
	Metadata          map[string]interface{}
}

type QuantumAttackResults

type QuantumAttackResults struct {
	SuccessfulAttacks   []*SuccessfulQuantumAttack
	QuantumAdvantage    *QuantumAdvantageMetrics
	EntanglementMetrics *EntanglementMetrics
	CoherenceMetrics    *CoherenceMetrics
	MeasurementStats    *MeasurementStatistics
	ClassicalComparison *ClassicalComparisonResults
}

type QuantumAttackType

type QuantumAttackType int
const (
	SuperpositionAttack QuantumAttackType = iota
	EntanglementAttack
	QuantumTunnelingAttack
	PhaseManipulationAttack
	InterferenceAttack
	MeasurementCollapseAttack
	DecoherenceExploitAttack
	QuantumWalkAttack
	QuantumAnnealingAttack
	GroverSearchAttack
	QuantumTeleportationAttack
	QuantumCryptanalysisAttack
	AmplitudeAmplificationAttack
	QuantumErrorInjectionAttack
)

type QuantumCircuit

type QuantumCircuit struct {
	CircuitID          string
	Qubits             int
	Gates              []*QuantumGate
	Measurements       []*MeasurementGate
	Depth              int
	TotalGates         int
	EntanglingGates    int
	SuccessProbability float64
}

type QuantumExecutionStatus

type QuantumExecutionStatus int
const (
	QuantumInitializing QuantumExecutionStatus = iota
	QuantumPreparing
	QuantumExecuting
	QuantumMeasuring
	QuantumCompleted
	QuantumFailed
	QuantumDecoherent
)

type QuantumGate

type QuantumGate struct {
	GateID       string
	GateType     GateType
	TargetQubits []int
	Parameters   []float64
	Matrix       [][]complex128
	Unitary      bool
	TimeCost     time.Duration
}

type QuantumInspiredAttackEngine

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

QuantumInspiredAttackEngine implements attack strategies based on quantum computing principles Applies quantum concepts like superposition, entanglement, and quantum tunneling to LLM attacks

func NewQuantumInspiredAttackEngine

func NewQuantumInspiredAttackEngine(logger common.AuditLogger) *QuantumInspiredAttackEngine

NewQuantumInspiredAttackEngine creates a new quantum-inspired attack engine

func (*QuantumInspiredAttackEngine) ExecuteQuantumAttack

func (e *QuantumInspiredAttackEngine) ExecuteQuantumAttack(ctx context.Context, attackType QuantumAttackType, targetModels []string, config interface{}) (*QuantumAttackExecution, error)

ExecuteQuantumAttack executes a quantum-inspired attack

type QuantumInterferenceEngine

type QuantumInterferenceEngine struct{}

func NewQuantumInterferenceEngine

func NewQuantumInterferenceEngine() *QuantumInterferenceEngine

func (*QuantumInterferenceEngine) ApplyInterference

func (i *QuantumInterferenceEngine) ApplyInterference(ctx context.Context, state *QuantumState, strategy string) error

func (*QuantumInterferenceEngine) CreateInterferencePattern

func (i *QuantumInterferenceEngine) CreateInterferencePattern(ctx context.Context, state *QuantumState) (*InterferencePattern, error)

type QuantumMeasurement

type QuantumMeasurement struct {
	MeasurementID        string
	MeasuredQubits       []int
	Outcome              []int
	Probability          float64
	PostMeasurementState *QuantumState
	CollapseTime         time.Duration
	Timestamp            time.Time
}

type QuantumMeasurementEngine

type QuantumMeasurementEngine struct{}

func NewQuantumMeasurementEngine

func NewQuantumMeasurementEngine() *QuantumMeasurementEngine

func (*QuantumMeasurementEngine) MeasureQubit

func (m *QuantumMeasurementEngine) MeasureQubit(ctx context.Context, state *QuantumState, qubit int, basis MeasurementBasis) (*QuantumMeasurement, error)

type QuantumPhaseEngine

type QuantumPhaseEngine struct{}

func NewQuantumPhaseEngine

func NewQuantumPhaseEngine() *QuantumPhaseEngine

func (*QuantumPhaseEngine) ApplyPhaseShifts

func (p *QuantumPhaseEngine) ApplyPhaseShifts(ctx context.Context, state *QuantumState, shifts []float64) error

type QuantumState

type QuantumState struct {
	StateID          string
	StateVector      []complex128
	Qubits           int
	Entanglements    []EntanglementPair
	Superposition    *SuperpositionState
	Phase            complex128
	Amplitude        float64
	MeasurementBasis string
	DecoherenceTime  time.Duration
	Fidelity         float64
	CreationTime     time.Time
	LastModified     time.Time
}

type QuantumTunnelingConfig

type QuantumTunnelingConfig struct {
	BarrierHeight      float64
	TunnelingAmplitude float64
	ResonanceTunneling bool
	MultiBarrier       bool
	AdiabaticEvolution bool
}

type QuantumTunnelingEngine

type QuantumTunnelingEngine struct{}

func NewQuantumTunnelingEngine

func NewQuantumTunnelingEngine() *QuantumTunnelingEngine

func (*QuantumTunnelingEngine) TunnelThroughBarriers

func (t *QuantumTunnelingEngine) TunnelThroughBarriers(ctx context.Context, barriers []*SecurityBarrier, config *QuantumTunnelingConfig) ([]*TunnelingResult, error)

type QuantumWalkEngine

type QuantumWalkEngine struct{}

func NewQuantumWalkEngine

func NewQuantumWalkEngine() *QuantumWalkEngine

type SecurityBarrier

type SecurityBarrier struct {
	BarrierID   string
	Height      float64
	Type        string
	TargetModel string
}

type SuccessfulQuantumAttack

type SuccessfulQuantumAttack struct {
	AttackID           string
	AttackType         QuantumAttackType
	TargetModel        string
	QuantumState       *QuantumState
	SuccessProbability float64
	ExploitVector      string
	QuantumSpeedup     float64
	ClassicalHardness  float64
	Timestamp          time.Time
}

type SuperpositionAttackConfig

type SuperpositionAttackConfig struct {
	NumberOfStates        int
	AmplitudeDistribution string
	InterferenceStrategy  string
	MeasurementStrategy   string
	OptimizationTarget    string
}

type SuperpositionAttackEngine

type SuperpositionAttackEngine struct{}

func NewSuperpositionAttackEngine

func NewSuperpositionAttackEngine() *SuperpositionAttackEngine

type SuperpositionState

type SuperpositionState struct {
	BasisStates             []BasisState
	Coefficients            []complex128
	ProbabilityDistribution []float64
	CoherenceLevel          float64
	Interference            *InterferencePattern
}

type SuperpositionTestResult

type SuperpositionTestResult struct {
	Success       bool
	Probability   float64
	ExploitVector string
	ModelResponse string
}

type TunnelingResult

type TunnelingResult struct {
	TunnelingSuccess     bool
	TunnelingProbability float64
	BarriersPenetrated   int
	ClassicalDifficulty  float64
	TargetModel          string
}

Jump to

Keyboard shortcuts

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