github.com/tunabay/go-bitarray@v1.3.1/bitarray_sha256_example_test.go (about) 1 // Copyright (c) 2021 Hirotsuna Mizuno. All rights reserved. 2 // Use of this source code is governed by the MIT license that can be found in 3 // the LICENSE file. 4 5 package bitarray_test 6 7 import ( 8 "fmt" 9 10 "github.com/tunabay/go-bitarray" 11 ) 12 13 func ExampleBitArray_SHA256() { 14 ba1 := bitarray.MustParse("011") 15 ba2 := bitarray.MustParse("010000") 16 17 fmt.Printf("%x\n", ba1.SHA256()) 18 fmt.Printf("%x\n", ba2.SHA256()) 19 20 // Output: 21 // 1f7794d4b0b67d3a6edcd17aba2144a95828032f7943ed26bf0c7c7628945f48 22 // 5ef0224f79737bda30562831152184b939cc43fcd40d09f4945e081a39c6d542 23 } 24 25 func ExampleBitArray_SHA224() { 26 ba1 := bitarray.MustParse("10") 27 ba2 := bitarray.MustParse("100") 28 29 fmt.Printf("%x\n", ba1.SHA224()) 30 fmt.Printf("%x\n", ba2.SHA224()) 31 32 // Output: 33 // ef9c947a47bb9311a0f2b8939cfc12090554868b3b64d8f71e6442f3 34 // 4f2ec61c914dce56c3fe5067aa184125ab126c39edb8bf64f58bdccd 35 }