3 added 302 characters in body edited Oct 24 '10 at 16:36 sepp2k 4,35711 gold badge1717 silver badges2222 bronze badges Convert the number into hex than use `echo` to print the according byte sequence and pipe that into `base64`. So to encode the integer 10 with base64, you can use: ``````echo -en '\xA' | base64 `````` To explain the result. The byte 10 has the following binary representation: ``````00001010 `````` What base64 does is, it chunks those into groups of 6 bits. So with padding we get the following two 6lets: ``````000010 100000 `````` Which in decimal are 2 and 32, which correspond to the letters C and g. Convert the number into hex than use `echo` to print the according byte sequence and pipe that into `base64`. So to encode the integer 10 with base64, you can use: ``````echo -en '\xA' | base64 `````` Convert the number into hex than use `echo` to print the according byte sequence and pipe that into `base64`. So to encode the integer 10 with base64, you can use: ``````echo -en '\xA' | base64 `````` To explain the result. The byte 10 has the following binary representation: ``````00001010 `````` What base64 does is, it chunks those into groups of 6 bits. So with padding we get the following two 6lets: ``````000010 100000 `````` Which in decimal are 2 and 32, which correspond to the letters C and g. 2 added 1 characters in body edited Oct 24 '10 at 16:02 sepp2k 4,35711 gold badge1717 silver badges2222 bronze badges Convert the number into hex than use `echo` to print the according byte sequence and pipe that into `base64`. So to encode the integer 10 with base64, you can use: ``````echo -nen '\xA' | base64 `````` Convert the number into hex than use `echo` to print the according byte sequence and pipe that into `base64`. So to encode the integer 10 with base64, you can use: ``````echo -n '\xA' | base64 `````` Convert the number into hex than use `echo` to print the according byte sequence and pipe that into `base64`. So to encode the integer 10 with base64, you can use: ``````echo -en '\xA' | base64 `````` 1 answered Oct 24 '10 at 15:38 sepp2k 4,35711 gold badge1717 silver badges2222 bronze badges Convert the number into hex than use `echo` to print the according byte sequence and pipe that into `base64`. So to encode the integer 10 with base64, you can use: ``````echo -n '\xA' | base64 ``````