added url_to_id

master
KatolaZ 6 years ago
parent 181800b700
commit 06eee07065
  1. 23
      url_to_id

@ -0,0 +1,23 @@
#!/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"
Loading…
Cancel
Save