Format like this (note that in many cases the secret has been hex encoded) otpauth://totp/?secret=&digits=6 This is a couple of ways to hex decode and base32 encode a secret that is in this case separated by $IFS (space or newline) for hex in $( cat ); do printf "\x$hex"; done | base32 for hex in 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff 00 11 22 33; do printf "\x$hex"; done | base32 To generate a secret dd if=/dev/urandom bs=20 count=1 | xxd -ps