轉換/反轉換BASE64資料及HEX字串
Convert hex string to binary file printf 1716d547cd7c0398bd244ac06c8a2ec8 | xxd -r -p > x.bin # show original bytes xxd x.bin # 00000000: 1716 d547 cd7c 0398 bd24 4ac0 6c8a 2ec8 ...G.|...$J.l... Convert binary file to base64 file base64 x.bin > x.base64 # default line wrapping=76 base64 -w 0 x.bin > x.base64 # w/o line wrapping # show base64 cat x.base64 # FxbVR818A5i9JErAbIouyA== Revert base64 file to binary base64 -d x.base64 > r_x.bin # show reverted bytes xxd r_x.bin ---- Convert hex string to base64 string printf 1716d547cd7c0398bd244ac06c8a2ec8 | xxd -r -p | base64 # FxbVR818A5i9JErAbIouyA== Revert base64 string to binary file echo -n "FxbVR818A5i9JErAbIouyA==" | base64 -d - > x.bin # show bytes xxd x.bin # 00000000: 1716 d547 cd7c 0398 bd24 4ac0 6c8a 2ec8 ...G.|...$J.l... ---- Convert plain text to base64 string echo -n "{your-plain-text}" | base64 # e3lvdXItcGxhaW4tdGV4dH0= Revert base...