You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
401 B
24 lines
401 B
7 years ago
|
#!/bin/sh
|
||
|
|
||
|
## get a selector in gph format:
|
||
|
##
|
||
|
## [TYPE|SEL|HOST|PORT]
|
||
|
##
|
||
|
## and print on output the corresponding selectorid:
|
||
|
##
|
||
|
## TYPE|SEL|HOST|PORT|SHA256
|
||
|
##
|
||
|
## which is understood by `burrow`
|
||
|
|
||
|
gph_to_id(){
|
||
|
gph="$( echo $1| sed 's/\[//g;s/\]//g')"
|
||
|
OLDIFS=$IFS
|
||
|
#IFS=$'\t\n'
|
||
|
IFS="|"
|
||
|
sid=$(echo "${gph}" | sha256sum | cut -d " " -f 1)
|
||
|
echo "${gph}|${sid}"
|
||
|
IFS="$OLDIFS"
|
||
|
}
|
||
|
|
||
|
gph_to_id "$1"
|