- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 25 for XORKeyStream (0.2 sec)
-
src/crypto/cipher/cipher.go
} // A Stream represents a stream cipher. type Stream interface { // XORKeyStream XORs each byte in the given slice with a byte from the // cipher's key stream. Dst and src must overlap entirely or not at all. // // If len(dst) < len(src), XORKeyStream should panic. It is acceptable // to pass a dst bigger than src, and in that case, XORKeyStream will // only update dst[:len(src)] and will not touch the rest of dst. //
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Sep 28 03:55:33 UTC 2022 - 2.4K bytes - Viewed (0) -
src/crypto/issue21104_test.go
panic(err) } stream := newCipher(block, iv[:]) test(t, name, cipherText, stream.XORKeyStream) } func test(t *testing.T, name string, cipherText []byte, xor func([]byte, []byte)) { want := "abcdefghij" plainText := []byte(want) shorterLen := len(cipherText) / 2 defer func() { err := recover() if err == nil { t.Errorf("%v XORKeyStream expected to panic on len(dst) < len(src), but didn't", name) }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Dec 06 06:03:36 UTC 2017 - 1.8K bytes - Viewed (0) -
src/crypto/cipher/io.go
// StreamReader wraps a [Stream] into an [io.Reader]. It calls XORKeyStream // to process each slice of data which passes through. type StreamReader struct { S Stream R io.Reader } func (r StreamReader) Read(dst []byte) (n int, err error) { n, err = r.R.Read(dst) r.S.XORKeyStream(dst[:n], dst[:n]) return } // StreamWriter wraps a [Stream] into an io.Writer. It calls XORKeyStream
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri Oct 13 17:09:47 UTC 2023 - 1.5K bytes - Viewed (0) -
src/crypto/cipher/cfb_test.go
cfb := cipher.NewCFBEncrypter(block, iv) cfb.XORKeyStream(ciphertext, plaintext) if !bytes.Equal(ciphertext, expected) { t.Errorf("#%d: wrong output: got %x, expected %x", i, ciphertext, expected) } cfbdec := cipher.NewCFBDecrypter(block, iv) plaintextCopy := make([]byte, len(ciphertext)) cfbdec.XORKeyStream(plaintextCopy, ciphertext) if !bytes.Equal(plaintextCopy, plaintext) {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri Mar 08 22:18:36 UTC 2019 - 2.8K bytes - Viewed (0) -
src/vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305_generic.go
panic("chacha20poly1305: invalid buffer overlap") } var polyKey [32]byte s, _ := chacha20.NewUnauthenticatedCipher(c.key[:], nonce) s.XORKeyStream(polyKey[:], polyKey[:]) s.SetCounter(1) // set the counter to 1, skipping 32 bytes s.XORKeyStream(ciphertext, plaintext) p := poly1305.New(&polyKey) writeWithPadding(p, additionalData) writeWithPadding(p, ciphertext) writeUint64(p, len(additionalData))
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Oct 26 00:11:50 UTC 2022 - 2.2K bytes - Viewed (0) -
src/vendor/golang.org/x/crypto/chacha20/chacha_generic.go
// // If len(dst) < len(src), XORKeyStream will panic. It is acceptable // to pass a dst bigger than src, and in that case, XORKeyStream will // only update dst[:len(src)] and will not touch the rest of dst. // // Multiple calls to XORKeyStream behave as if the concatenation of // the src buffers was passed in a single run. That is, Cipher // maintains state and does not reset at each XORKeyStream call.
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Oct 26 00:11:50 UTC 2022 - 13.9K bytes - Viewed (0) -
src/crypto/cipher/cipher_test.go
cfbe := cipher.NewCFBEncrypter(b, iv) cfbe.XORKeyStream(ct, pt[:0]) assertEqual("CFB encrypt", ct, pt) cfbd := cipher.NewCFBDecrypter(b, iv) cfbd.XORKeyStream(ct, pt[:0]) assertEqual("CFB decrypt", ct, pt) ctr := cipher.NewCTR(b, iv) ctr.XORKeyStream(ct, pt[:0]) assertEqual("CTR", ct, pt) ofb := cipher.NewOFB(b, iv) ofb.XORKeyStream(ct, pt[:0]) assertEqual("OFB", ct, pt) }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Oct 13 21:42:23 UTC 2016 - 2.2K bytes - Viewed (0) -
src/crypto/rc4/rc4_test.go
data1 := make([]byte, 1<<20) for i := range data1 { c1a.XORKeyStream(data1[i:i+1], data1[i:i+1]) c1b.XORKeyStream(data1[i:i+1], data1[i:i+1]) } c2a, _ := NewCipher(golden[0].key) c2b, _ := NewCipher(golden[1].key) data2 := make([]byte, 1<<20) c2a.XORKeyStream(data2, data2) c2b.XORKeyStream(data2, data2) if !bytes.Equal(data1, data2) { t.Fatalf("bad block") } }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Aug 21 19:49:06 UTC 2018 - 4.3K bytes - Viewed (0) -
src/crypto/cipher/example_test.go
panic("ciphertext too short") } iv := ciphertext[:aes.BlockSize] ciphertext = ciphertext[aes.BlockSize:] stream := cipher.NewCFBDecrypter(block, iv) // XORKeyStream can work in-place if the two arguments are the same. stream.XORKeyStream(ciphertext, ciphertext) fmt.Printf("%s", ciphertext) // Output: some plaintext } func ExampleNewCFBEncrypter() {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Oct 30 16:23:44 UTC 2018 - 11.8K bytes - Viewed (0) -
src/vendor/golang.org/x/crypto/chacha20/chacha_s390x.go
//go:build gc && !purego package chacha20 import "golang.org/x/sys/cpu" var haveAsm = cpu.S390X.HasVX const bufSize = 256 // xorKeyStreamVX is an assembly implementation of XORKeyStream. It must only // be called when the vector facility is available. Implementation in asm_s390x.s. // //go:noescape func xorKeyStreamVX(dst, src []byte, key *[8]uint32, nonce *[3]uint32, counter *uint32)
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Oct 19 23:33:33 UTC 2023 - 743 bytes - Viewed (0)