forked from gcash/bchd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Since the Midstate is no longer needed, switch to using crypto/sha256.
- Loading branch information
Showing
14 changed files
with
48 additions
and
509 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
// Copyright (c) 2015 The Decred developers | ||
// Copyright (c) 2016 The btcsuite developers | ||
// Copyright (c) 2016-2017 The btcsuite developers | ||
// Use of this source code is governed by an ISC | ||
// license that can be found in the LICENSE file. | ||
|
||
package chainhash | ||
|
||
import "github.com/btcsuite/fastsha256" | ||
import "crypto/sha256" | ||
|
||
// HashB calculates hash(b) and returns the resulting bytes. | ||
func HashB(b []byte) []byte { | ||
hash := fastsha256.Sum256(b) | ||
hash := sha256.Sum256(b) | ||
return hash[:] | ||
} | ||
|
||
// HashH calculates hash(b) and returns the resulting bytes as a Hash. | ||
func HashH(b []byte) Hash { | ||
return Hash(fastsha256.Sum256(b)) | ||
return Hash(sha256.Sum256(b)) | ||
} | ||
|
||
// DoubleHashB calculates hash(hash(b)) and returns the resulting bytes. | ||
func DoubleHashB(b []byte) []byte { | ||
first := fastsha256.Sum256(b) | ||
second := fastsha256.Sum256(first[:]) | ||
first := sha256.Sum256(b) | ||
second := sha256.Sum256(first[:]) | ||
return second[:] | ||
} | ||
|
||
// DoubleHashH calculates hash(hash(b)) and returns the resulting bytes as a | ||
// Hash. | ||
func DoubleHashH(b []byte) Hash { | ||
first := fastsha256.Sum256(b) | ||
return Hash(fastsha256.Sum256(first[:])) | ||
first := sha256.Sum256(b) | ||
return Hash(sha256.Sum256(first[:])) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.