Guest User

Untitled

a guest
Jun 19th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. //create a big int for test and set to 1
  2. b1 := new(big.Int)
  3. b1.SetInt64(1)
  4. //create empty array with 32 bytes for padding
  5. empty := make([]byte,32)
  6. //turn the big int into a hex string (let me know if there is a more
  7. //elegant way^^)
  8. String := bytes.NewBufferString(b1.Text(16))
  9. copy(empty[len(empty)-len(String.Bytes()):],String.Bytes())
  10. //output of empty : [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 49]
  11. res:= new(big.Int)
  12. temp:=sha3.Sum256(empty)
  13. res.SetBytes(temp[:])
  14. fmt.Println("nresult ",res.Text(16))
  15.  
  16. sha3(uint(1))
  17. b10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6
Add Comment
Please, Sign In to add comment