base conversion - How to convert decimal number to Base58 in Bash -


mynumber=$(date +%s) # big number in decimal mynumberinb58=$(tobase58 $mynumber)  tobase58() {   # <your answer here> } 

what elegant and/or concise way encode integer in base58?

would do?

a=( {1..9} {a..h} {j..n} {p..z} {a..k} {m..z} ) tobase58() {     # todo: check $1 valid number     local nb=$1 b58= fiftyeight=${#a[@]}     while ((nb));         b58=${a[nb%fiftyeight]}$b58         ((nb/=fiftyeight))     done     printf '%s\n' "$b58" } 

Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -