Created
May 10, 2019 07:09
-
-
Save touhonoob/755e137ae67758f5c247c8432be1d821 to your computer and use it in GitHub Desktop.
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
package main | |
import ( | |
"crypto/sha256" | |
"encoding/hex" | |
"fmt" | |
) | |
func main() { | |
right := "3187c721dc9913aef26a6cf1677a29a0c1c24229730911e68091eadf8839873" | |
data := make([]byte, 64) | |
right_bytes, _ := hex.DecodeString(right) | |
copy(data[32:], right_bytes) | |
hashed_with_empty_bytes := sha256.Sum256(data) | |
fmt.Printf("with empty bytes: %s\n", hex.EncodeToString(hashed_with_empty_bytes[:])) | |
hashed_without_empty_bytes := sha256.Sum256(right_bytes) | |
fmt.Printf("without empty bytes: %s\n", hex.EncodeToString(hashed_without_empty_bytes[:])) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment