Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 39 for BinaryMarshaler (0.32 sec)

  1. src/hash/example_test.go

    		input2 = "unaware of what he will find."
    	)
    
    	first := sha256.New()
    	first.Write([]byte(input1))
    
    	marshaler, ok := first.(encoding.BinaryMarshaler)
    	if !ok {
    		log.Fatal("first does not implement encoding.BinaryMarshaler")
    	}
    	state, err := marshaler.MarshalBinary()
    	if err != nil {
    		log.Fatal("unable to marshal hash:", err)
    	}
    
    	second := sha256.New()
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sat Nov 04 03:47:34 UTC 2017
    - 1.2K bytes
    - Viewed (0)
  2. 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)
  3. 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)
  4. 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)
  5. src/hash/marshal_test.go

    // Copyright 2017 The Go Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    // Test that the hashes in the standard library implement
    // BinaryMarshaler, BinaryUnmarshaler,
    // and lock in the current representations.
    
    package hash_test
    
    import (
    	"bytes"
    	"crypto/md5"
    	"crypto/sha1"
    	"crypto/sha256"
    	"crypto/sha512"
    	"encoding"
    	"encoding/hex"
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Dec 06 07:45:46 UTC 2017
    - 5.4K bytes
    - Viewed (0)
  6. 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)
  7. 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)
  8. 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)
  9. 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)
  10. 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)
Back to top