What is the meaning of an equal sign = or == at the end of a SSH public key?

I just noticed that most of the ssh pubkeys in my authorized_keys end on == or =

E.g.

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA9ZUwxXn2HZAAUswoaV8t2sQPvolVWDI053f0giNN154Zyi9FtWJKvyLHXoxW4IzFxgx+m6EYqXG/XCtfamLhwvGZv9FXkgQKeF6HJv/rjyKRBHPRyX0vV4S9uQU+xQV7f0Ock3urSzbUyoCgngA8Ax6AkYGmMTLLjx1HOBO/TJ477aysWt4IAg1gviT50I4xOYiHT4vC67czoDTnPl0UfKQJaM0+6WrneK7FJbd/8CAX7P7IxOhj1OxVbnEoh9FvecLbSDdOx/LF+kJcav/LThuoG7NR+Y+rS9lNkta3/KPi3IBMPum+bZpXJF7fkHl9Kx/iOMitT7KjNW/mty74xw== foo@bar

However today I saw a pubkey without an equal sign at the end. Also I noticed that the only place where an = ever occurs in a pubkey is at the end and never anywhere else.

Now I'm just curious as to what is the meaning of zero, one or two equal signs at the end of a pub key?


Solution 1:

I believe there is no technical reason, it's merely an artifact of Base64 and the length of the string. Try it out with any base 64 encoder

1     -> MQ==     (1 characters, 2 equals)
12    -> MTI=     (2 characters, 1 equals)
123   -> MTIz     (3 characters, 0 equals)
1234  -> MTIzNA== (4 characters, 2 equals)
[repeat]

But I may be wrong about that