-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Added explanations to the scripts
- Loading branch information
1 parent
558a83c
commit 616e5b2
Showing
2 changed files
with
22 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,14 @@ | ||
#!/bin/bash | ||
|
||
cat $1 | head -3 | tail -2 | base64 --decode | xxd -c 0 -ps | tail -c 129 | ||
# Read content of file in the first argument and concatenate at terminal | ||
cat $1 | \ | ||
# Retain only first 3 lines (i.e. remove "-----END PUBLIC KEY-----" line) | ||
head -3 | \ | ||
# Retain only the last 2 lines (i.e. remove "-----BEGIN PUBLIC KEY----- line) | ||
tail -2 | \ | ||
# Decode base64 to binary | ||
base64 --decode | \ | ||
# Convert binary to hex as one line and print to terminal | ||
xxd -c 0 -ps | \ | ||
# Retain only the last 129 characters (inclusive of EOL) | ||
tail -c 129 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
#!/bin/bash | ||
|
||
cat $1 | keccak-256sum -x -l | tr -d ' -' | tail -c 41 | xargs -I % echo 0x% | ||
# Read content of file in the first argument and concatenate at terminal | ||
cat $1 | \ | ||
# Compute Keccak256 sum of hexed public key literal and express in lowercase hexadecimal | ||
keccak-256sum -x -l | \ | ||
# Remove the trailing "[:space:][:hyphen:]" characters | ||
tr -d ' -' | \ | ||
# Retain only the last 41 characters (inclusive of EOL) | ||
tail -c 41 | \ | ||
# Prepend the address with "0x" | ||
xargs -I % echo 0x% |