Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 33 for BinaryMarshaler (0.19 sec)

  1. src/encoding/encoding.go

    // the addition of marshaling functions if no existing, reasonable marshaling exists.
    package encoding
    
    // BinaryMarshaler is the interface implemented by an object that can
    // marshal itself into a binary form.
    //
    // MarshalBinary encodes the receiver into a binary form and returns the result.
    type BinaryMarshaler interface {
    	MarshalBinary() (data []byte, err error)
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 23 19:43:37 UTC 2023
    - 2.2K bytes
    - Viewed (0)
  2. doc/next/6-stdlib/99-minor/crypto/x509/66249.md

    The new [ParseOID] function parses a dot-encoded ASN.1 Object Identifier string.
    The [OID] type now implements the [encoding.BinaryMarshaler],
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 16 15:53:51 UTC 2024
    - 238 bytes
    - Viewed (0)
  3. test/typeparam/issue47713.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package main
    
    import (
    	"encoding"
    	"fmt"
    )
    
    type Seralizable interface {
    	encoding.BinaryMarshaler
    	encoding.BinaryUnmarshaler
    }
    
    type SerDeString string
    
    func (s *SerDeString) UnmarshalBinary(in []byte) error {
    	*s = SerDeString(in)
    	return nil
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 01 19:45:34 UTC 2022
    - 888 bytes
    - Viewed (0)
  4. src/crypto/hmac/hmac.go

    // ipad = 0x36 byte repeated for key length
    // opad = 0x5c byte repeated for key length
    // hmac = H([key ^ opad] H([key ^ ipad] text))
    
    // marshalable is the combination of encoding.BinaryMarshaler and
    // encoding.BinaryUnmarshaler. Their method definitions are repeated here to
    // avoid a dependency on the encoding package.
    type marshalable interface {
    	MarshalBinary() ([]byte, error)
    	UnmarshalBinary([]byte) error
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Oct 13 17:09:47 UTC 2023
    - 4.7K bytes
    - Viewed (0)
  5. src/hash/hash.go

    package hash
    
    import "io"
    
    // Hash is the common interface implemented by all hash functions.
    //
    // Hash implementations in the standard library (e.g. [hash/crc32] and
    // [crypto/sha256]) implement the [encoding.BinaryMarshaler] and
    // [encoding.BinaryUnmarshaler] interfaces. Marshaling a hash implementation
    // allows its internal state to be saved and used for additional processing
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Oct 13 19:15:34 UTC 2023
    - 2.1K bytes
    - Viewed (0)
  6. src/net/netip/fuzz_test.go

    	}
    }
    
    // checkBinaryMarshaler checks that x's MarshalText and UnmarshalText functions round trip correctly.
    func checkBinaryMarshaler(t *testing.T, x encoding.BinaryMarshaler) {
    	buf, err := x.MarshalBinary()
    	if err != nil {
    		t.Fatal(err)
    	}
    	y := reflect.New(reflect.TypeOf(x)).Interface().(encoding.BinaryUnmarshaler)
    	err = y.UnmarshalBinary(buf)
    	if err != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Dec 20 23:46:23 UTC 2021
    - 10.5K bytes
    - Viewed (0)
  7. src/math/rand/v2/chacha8.go

    	if len(b) == 0 || len(b) < int(1+b[0]) {
    		return nil, nil, false
    	}
    	return b[1 : 1+b[0]], b[1+b[0]:], true
    }
    
    // MarshalBinary implements the encoding.BinaryMarshaler interface.
    func (c *ChaCha8) MarshalBinary() ([]byte, error) {
    	if c.readLen > 0 {
    		out := []byte("readbuf:")
    		out = append(out, uint8(c.readLen))
    		out = append(out, c.readBuf[len(c.readBuf)-c.readLen:]...)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 22 22:09:08 UTC 2024
    - 2.8K bytes
    - Viewed (0)
  8. src/hash/crc32/crc32.go

    // polynomial represented by the [Table]. Its Sum method will lay the
    // value out in big-endian byte order. The returned Hash32 also
    // implements [encoding.BinaryMarshaler] and [encoding.BinaryUnmarshaler] to
    // marshal and unmarshal the internal state of the hash.
    func New(tab *Table) hash.Hash32 {
    	if tab == IEEETable {
    		ieeeOnce.Do(ieeeInit)
    	}
    	return &digest{0, tab}
    }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sun May 12 05:36:29 UTC 2024
    - 7.5K bytes
    - Viewed (0)
  9. src/hash/crc32/crc32_test.go

    	t.Run("IEEE", func(t *testing.T) {
    		for _, g := range golden {
    			h := New(IEEETable)
    			h2 := New(IEEETable)
    
    			io.WriteString(h, g.in[:len(g.in)/2])
    
    			state, err := h.(encoding.BinaryMarshaler).MarshalBinary()
    			if err != nil {
    				t.Errorf("could not marshal: %v", err)
    				continue
    			}
    
    			if string(state) != g.halfStateIEEE {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jun 03 14:56:25 UTC 2024
    - 12.1K bytes
    - Viewed (0)
  10. src/hash/adler32/adler32.go

    func (d *digest) Reset() { *d = 1 }
    
    // New returns a new hash.Hash32 computing the Adler-32 checksum. Its
    // Sum method will lay the value out in big-endian byte order. The
    // returned Hash32 also implements [encoding.BinaryMarshaler] and
    // [encoding.BinaryUnmarshaler] to marshal and unmarshal the internal
    // state of the hash.
    func New() hash.Hash32 {
    	d := new(digest)
    	d.Reset()
    	return d
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sun May 12 05:36:29 UTC 2024
    - 3K bytes
    - Viewed (0)
Back to top