Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 25 for XORKeyStream (0.21 sec)

  1. src/crypto/rc4/rc4.go

    // the process's memory.
    func (c *Cipher) Reset() {
    	for i := range c.s {
    		c.s[i] = 0
    	}
    	c.i, c.j = 0, 0
    }
    
    // XORKeyStream sets dst to the result of XORing src with the key stream.
    // Dst and src must overlap entirely or not at all.
    func (c *Cipher) XORKeyStream(dst, src []byte) {
    	if len(src) == 0 {
    		return
    	}
    	if alias.InexactOverlap(dst[:len(src)], src) {
    		panic("crypto/rc4: invalid buffer overlap")
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Oct 13 17:09:47 UTC 2023
    - 1.9K bytes
    - Viewed (0)
  2. src/crypto/cipher/ctr_aes_test.go

    			encrypted := make([]byte, len(in))
    			ctr.XORKeyStream(encrypted, in)
    			if out := tt.out[0:len(in)]; !bytes.Equal(out, encrypted) {
    				t.Errorf("%s/%d: CTR\ninpt %x\nhave %x\nwant %x", test, len(in), in, encrypted, out)
    			}
    		}
    
    		for j := 0; j <= 7; j += 7 {
    			in := tt.out[0 : len(tt.out)-j]
    			ctr := cipher.NewCTR(c, tt.iv)
    			plain := make([]byte, len(in))
    			ctr.XORKeyStream(plain, in)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Sep 08 04:08:51 UTC 2014
    - 3K bytes
    - Viewed (0)
  3. src/crypto/cipher/ofb_test.go

    			continue
    		}
    
    		for j := 0; j <= 5; j += 5 {
    			plaintext := tt.in[0 : len(tt.in)-j]
    			ofb := cipher.NewOFB(c, tt.iv)
    			ciphertext := make([]byte, len(plaintext))
    			ofb.XORKeyStream(ciphertext, plaintext)
    			if !bytes.Equal(ciphertext, tt.out[:len(plaintext)]) {
    				t.Errorf("%s/%d: encrypting\ninput % x\nhave % x\nwant % x", test, len(plaintext), plaintext, ciphertext, tt.out)
    			}
    		}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Sep 08 04:08:51 UTC 2014
    - 3K bytes
    - Viewed (0)
  4. src/crypto/cipher/ofb.go

    	x.out = x.out[:cap(x.out)]
    	for remain < len(x.out)-bs {
    		x.b.Encrypt(x.cipher, x.cipher)
    		copy(x.out[remain:], x.cipher)
    		remain += bs
    	}
    	x.out = x.out[:remain]
    	x.outUsed = 0
    }
    
    func (x *ofb) XORKeyStream(dst, src []byte) {
    	if len(dst) < len(src) {
    		panic("crypto/cipher: output smaller than input")
    	}
    	if alias.InexactOverlap(dst[:len(src)], src) {
    		panic("crypto/cipher: invalid buffer overlap")
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Oct 13 17:09:47 UTC 2023
    - 1.6K bytes
    - Viewed (0)
  5. src/crypto/cipher/ctr_test.go

    		copy(want, src)
    		counter := make([]byte, size)
    		for i := 1; i < len(want)/size; i++ {
    			inc(counter)
    			xor(want[i*size:(i+1)*size], counter)
    		}
    		dst := make([]byte, 1024)
    		ctr.XORKeyStream(dst, src)
    		if !bytes.Equal(dst, want) {
    			t.Errorf("for size %d\nhave %x\nwant %x", size, dst, want)
    		}
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Oct 20 21:38:36 UTC 2015
    - 1.1K bytes
    - Viewed (0)
  6. src/crypto/cipher/cfb.go

    package cipher
    
    import (
    	"crypto/internal/alias"
    	"crypto/subtle"
    )
    
    type cfb struct {
    	b       Block
    	next    []byte
    	out     []byte
    	outUsed int
    
    	decrypt bool
    }
    
    func (x *cfb) XORKeyStream(dst, src []byte) {
    	if len(dst) < len(src) {
    		panic("crypto/cipher: output smaller than input")
    	}
    	if alias.InexactOverlap(dst[:len(src)], src) {
    		panic("crypto/cipher: invalid buffer overlap")
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Oct 13 17:09:47 UTC 2023
    - 2K bytes
    - Viewed (0)
  7. src/crypto/aes/ctr_s390x.go

    			c0++
    		}
    	}
    	c.ctr[0], c.ctr[1] = c0, c1
    	// Encrypt the buffer using AES in ECB mode.
    	cryptBlocks(c.block.function, &c.block.key[0], &c.buffer[0], &c.buffer[0], streamBufferSize)
    }
    
    func (c *aesctr) XORKeyStream(dst, src []byte) {
    	if len(dst) < len(src) {
    		panic("crypto/cipher: output smaller than input")
    	}
    	if alias.InexactOverlap(dst[:len(src)], src) {
    		panic("crypto/cipher: invalid buffer overlap")
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 13 18:57:38 UTC 2024
    - 2.4K bytes
    - Viewed (0)
  8. src/crypto/cipher/ctr.go

    		// Increment counter
    		for i := len(x.ctr) - 1; i >= 0; i-- {
    			x.ctr[i]++
    			if x.ctr[i] != 0 {
    				break
    			}
    		}
    	}
    	x.out = x.out[:remain]
    	x.outUsed = 0
    }
    
    func (x *ctr) XORKeyStream(dst, src []byte) {
    	if len(dst) < len(src) {
    		panic("crypto/cipher: output smaller than input")
    	}
    	if alias.InexactOverlap(dst[:len(src)], src) {
    		panic("crypto/cipher: invalid buffer overlap")
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Oct 13 17:09:47 UTC 2023
    - 2.2K bytes
    - Viewed (0)
  9. src/crypto/cipher/benchmark_test.go

    	b.SetBytes(int64(len(buf)))
    
    	var key [16]byte
    	var iv [16]byte
    	aes, _ := aes.NewCipher(key[:])
    	stream := mode(aes, iv[:])
    
    	b.ResetTimer()
    	for i := 0; i < b.N; i++ {
    		stream.XORKeyStream(buf, buf)
    	}
    }
    
    // If we test exactly 1K blocks, we would generate exact multiples of
    // the cipher's block size, and the cipher stream fragments would
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Apr 28 19:13:50 UTC 2021
    - 3.3K bytes
    - Viewed (0)
  10. src/crypto/aes/modes_test.go

    		t.Fatalf("cipher.NewCBCDecrypter did not use cbcDecAble interface")
    	}
    }
    
    // testStream implements the cipher.Stream interface.
    type testStream struct{}
    
    func (*testStream) XORKeyStream(a, b []byte) {}
    func (*testStream) InAESPackage() bool       { return true }
    
    // Test the ctrAble interface is detected correctly by the cipher package.
    func TestCTRAble(t *testing.T) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Feb 14 15:32:26 UTC 2018
    - 3.5K bytes
    - Viewed (0)
Back to top