diff --git a/std/qpp.go b/std/qpp.go index 86a74d540..92cd1da67 100644 --- a/std/qpp.go +++ b/std/qpp.go @@ -32,25 +32,25 @@ import ( type QPPPort struct { underlying io.ReadWriteCloser // io.Writer is not enough, we need to close the underlying writer as well - qpp *qpp.QuantumPermutationPad + pad *qpp.QuantumPermutationPad wprng *qpp.Rand rprng *qpp.Rand } -func NewQPPPort(underlying io.ReadWriteCloser, qpp *qpp.QuantumPermutationPad, seed []byte) *QPPPort { +func NewQPPPort(underlying io.ReadWriteCloser, pad *qpp.QuantumPermutationPad, seed []byte) *QPPPort { wprng := qpp.CreatePRNG(seed) rprng := qpp.CreatePRNG(seed) - return &QPPPort{underlying, qpp, wprng, rprng} + return &QPPPort{underlying, pad, wprng, rprng} } -func (port *QPPPort) Read(p []byte) (n int, err error) { - n, err = port.underlying.Read(p) - port.qpp.DecryptWithPRNG(p[:n], port.rprng) +func (r *QPPPort) Read(p []byte) (n int, err error) { + n, err = r.underlying.Read(p) + r.pad.DecryptWithPRNG(p[:n], r.rprng) return } func (r *QPPPort) Write(p []byte) (n int, err error) { - r.qpp.EncryptWithPRNG(p, r.wprng) + r.pad.EncryptWithPRNG(p, r.wprng) return r.underlying.Write(p) }