Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 5 of 5 for ExampleNew (0.13 sec)

  1. src/crypto/sha256/example_test.go

    	"io"
    	"log"
    	"os"
    )
    
    func ExampleSum256() {
    	sum := sha256.Sum256([]byte("hello world\n"))
    	fmt.Printf("%x", sum)
    	// Output: a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447
    }
    
    func ExampleNew() {
    	h := sha256.New()
    	h.Write([]byte("hello world\n"))
    	fmt.Printf("%x", h.Sum(nil))
    	// Output: a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447
    }
    
    func ExampleNew_file() {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Sep 19 17:29:19 UTC 2016
    - 817 bytes
    - Viewed (0)
  2. src/crypto/md5/example_test.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package md5_test
    
    import (
    	"crypto/md5"
    	"fmt"
    	"io"
    	"log"
    	"os"
    )
    
    func ExampleNew() {
    	h := md5.New()
    	io.WriteString(h, "The fog is getting thicker!")
    	io.WriteString(h, "And Leon's getting laaarger!")
    	fmt.Printf("%x", h.Sum(nil))
    	// Output: e2c569be17396eca2a2e3c11578123ed
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Sep 19 17:29:19 UTC 2016
    - 825 bytes
    - Viewed (0)
  3. src/net/http/cookiejar/example_test.go

    // license that can be found in the LICENSE file.
    
    package cookiejar_test
    
    import (
    	"fmt"
    	"log"
    	"net/http"
    	"net/http/cookiejar"
    	"net/http/httptest"
    	"net/url"
    )
    
    func ExampleNew() {
    	// Start a server to give us cookies.
    	ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
    		if cookie, err := r.Cookie("Flavor"); err != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Sep 09 03:47:00 UTC 2016
    - 1.5K bytes
    - Viewed (0)
  4. src/crypto/sha1/example_test.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package sha1_test
    
    import (
    	"crypto/sha1"
    	"fmt"
    	"io"
    	"log"
    	"os"
    )
    
    func ExampleNew() {
    	h := sha1.New()
    	io.WriteString(h, "His money is twice tainted:")
    	io.WriteString(h, " 'taint yours and 'taint mine.")
    	fmt.Printf("% x", h.Sum(nil))
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Sep 19 17:29:19 UTC 2016
    - 887 bytes
    - Viewed (0)
  5. src/errors/example_test.go

    		"the file system has gone away",
    	}
    }
    
    func Example() {
    	if err := oops(); err != nil {
    		fmt.Println(err)
    	}
    	// Output: 1989-03-15 22:30:00 +0000 UTC: the file system has gone away
    }
    
    func ExampleNew() {
    	err := errors.New("emit macho dwarf: elf header corrupted")
    	if err != nil {
    		fmt.Print(err)
    	}
    	// Output: emit macho dwarf: elf header corrupted
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Aug 16 02:08:40 UTC 2023
    - 2.2K bytes
    - Viewed (0)
Back to top