Skip to content

Instantly share code, notes, and snippets.

@touhonoob
Created May 10, 2019 07:09
Show Gist options
  • Save touhonoob/755e137ae67758f5c247c8432be1d821 to your computer and use it in GitHub Desktop.
Save touhonoob/755e137ae67758f5c247c8432be1d821 to your computer and use it in GitHub Desktop.
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