File tree Expand file tree Collapse file tree 4 files changed +28
-2
lines changed
Expand file tree Collapse file tree 4 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -124,6 +124,7 @@ devd convert decode_base64 [base64]
124124``` bash
125125devd hash md5 [input]
126126devd hash keccak256 [input]
127+ devd hash keccak512 [input]
127128```
128129
129130### Debug tools
Original file line number Diff line number Diff line change @@ -15,8 +15,8 @@ func GetKeccak256Command() *cobra.Command {
1515 Args : cobra .ExactArgs (1 ),
1616 Run : func (_ * cobra.Command , args []string ) {
1717 input := strings .Join (args , " " )
18- hash := crypto .Keccak256Hash ([]byte (input ))
19- fmt .Println (hex .EncodeToString (hash . Bytes () ))
18+ hash := crypto .Keccak256 ([]byte (input ))
19+ fmt .Println (hex .EncodeToString (hash ))
2020 },
2121 }
2222
Original file line number Diff line number Diff line change 1+ package hash
2+
3+ import (
4+ "encoding/hex"
5+ "fmt"
6+ "github.com/ethereum/go-ethereum/crypto"
7+ "github.com/spf13/cobra"
8+ "strings"
9+ )
10+
11+ func GetKeccak512Command () * cobra.Command {
12+ cmd := & cobra.Command {
13+ Use : "keccak512 [input]" ,
14+ Short : "keccak512 hashing input" ,
15+ Args : cobra .ExactArgs (1 ),
16+ Run : func (_ * cobra.Command , args []string ) {
17+ input := strings .Join (args , " " )
18+ hash := crypto .Keccak512 ([]byte (input ))
19+ fmt .Println (hex .EncodeToString (hash ))
20+ },
21+ }
22+
23+ return cmd
24+ }
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ func Commands() *cobra.Command {
1414 cmd .AddCommand (
1515 GetMd5Command (),
1616 GetKeccak256Command (),
17+ GetKeccak512Command (),
1718 )
1819
1920 return cmd
You can’t perform that action at this time.
0 commit comments