diff options
| author | d0x471b <0x471@protonmail.com> | 2022-12-31 03:45:30 +0300 |
|---|---|---|
| committer | d0x471b <0x471@protonmail.com> | 2022-12-31 03:45:30 +0300 |
| commit | 0f1d7d51de1baa21256fdb7ddafe54aab66172f7 (patch) | |
| tree | 30373f9b64ba6301096f26cdade55ebac4f5e59f /cli/generate_signature.go | |
| parent | 517ad8d13a6b23328927154226575605be70669f (diff) | |
Diffstat (limited to 'cli/generate_signature.go')
| -rw-r--r-- | cli/generate_signature.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/cli/generate_signature.go b/cli/generate_signature.go new file mode 100644 index 0000000..32963f1 --- /dev/null +++ b/cli/generate_signature.go @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "log" + + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/crypto" +) + +func main() { + privateKey, err := crypto.HexToECDSA("fad9c8855b740a0b7ed4c221dbad0f33a83a49cad6b3fe8d5817ac83d38b6a19") + if err != nil { + log.Fatal(err) + } + + data := []byte("decartography") + hash := crypto.Keccak256Hash(data) + fmt.Println(hash.Hex()) // 0xfe2b8f0bae0d344e95a421b9cc1a32ef07083cc85d007146259221fece9264a7 + + signature, err := crypto.Sign(hash.Bytes(), privateKey) + if err != nil { + log.Fatal(err) + } + + fmt.Println(hexutil.Encode(signature)) +}
\ No newline at end of file |
